3#include "Arp/System/Core/TypeName.hxx" 
    4#include "Arp/System/Commons/Ipc/SharedMemory.hpp" 
    5#include "Arp/System/Commons/Threading/Thread.hpp" 
    6#include "boost/interprocess/allocators/allocator.hpp" 
    7#include "boost/interprocess/containers/string.hpp" 
    8#include "boost/interprocess/containers/vector.hpp" 
    9#include "boost/interprocess/containers/list.hpp" 
   10#include "boost/interprocess/containers/map.hpp" 
   11#include "boost/interprocess/containers/set.hpp" 
   15#ifdef ARP_PLATFORM_LINUX 
   19namespace Arp { 
namespace System { 
namespace Commons { 
namespace Ipc
 
   25template<
class Derived>
 
   29    using Base = SharedMemory;
 
   30    using DerivedType = Derived;
 
   31    using SharedMemory = boost::interprocess::managed_shared_memory;
 
   32    using SegmentManager = SharedMemory::segment_manager;
 
   33    using SharedMemoryPermission = boost::interprocess::permissions;
 
   37    using Ptr = boost::interprocess::offset_ptr<T>;
 
   41    using ConstPtr = boost::interprocess::offset_ptr<const T>;
 
   49    class Allocator : 
public boost::interprocess::allocator<T, SegmentManager>
 
   52        using AllocatorBase = boost::interprocess::allocator<T, SegmentManager>;
 
   53        using segment_manager = SegmentManager;
 
   54        using value_type = 
typename AllocatorBase::value_type;
 
   55        using pointer = 
typename AllocatorBase::pointer;
 
   56        using const_pointer = 
typename AllocatorBase::const_pointer;
 
   57        using void_pointer = 
typename AllocatorBase::void_pointer;
 
   58        using reference = 
typename AllocatorBase::reference;
 
   59        using const_reference = 
typename AllocatorBase::const_reference;
 
   60        using size_type = 
typename AllocatorBase::size_type;
 
   61        using difference_type = 
typename AllocatorBase::difference_type;
 
   62        using version = 
typename AllocatorBase::version;
 
   78#ifdef ARP_PLATFORM_LINUX 
   84            pthread_mutexattr_t attr;
 
   85            pthread_mutexattr_init(&attr);
 
   87            pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
 
   88            pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
 
   89            pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT);
 
   91            pthread_mutex_init(&this->mutex, &attr);
 
   93            pthread_mutexattr_destroy(&attr);
 
  101            pthread_mutex_destroy(&this->mutex);
 
  107            pthread_mutex_lock(&this->mutex);
 
  111            return (pthread_mutex_trylock(&this->mutex) == 0);
 
  115            pthread_mutex_unlock(&this->mutex);
 
  119        pthread_mutex_t mutex;
 
  125        Mutex(
void) = 
default;
 
  135            return this->mutex.try_lock();
 
  139            this->mutex.unlock();
 
  143        boost::interprocess::interprocess_mutex mutex;
 
  159    template <
class TMutex>
 
  165            this->pMutex->Lock();
 
  176                this->pMutex->Unlock();
 
  186    using String = boost::interprocess::basic_string<char, std::char_traits<char>, 
Allocator<char>>;
 
  189    using vector = boost::interprocess::vector<T, Allocator<T>>;
 
  192    using list = boost::interprocess::list<T, Allocator<T>>;
 
  194    template <
class TKey, 
class T, 
class TCompare = std::less<TKey>>
 
  195    using map = boost::interprocess::map<TKey, T, TCompare, Allocator<std::pair<const TKey, T>>>;
 
  197    template <
class T, 
class TCompare = std::less<T>>
 
  198    using set = boost::interprocess::set<T, TCompare, Allocator<T>>;
 
  203template<
class Derived>
 
  205    : Base(
TypeName<DerivedType>().GetSafeName())
 
  209template<
class Derived>
 
  211    : Base(
TypeName<DerivedType>().GetSafeName(), memorySize)
 
This (meta programming) class provides the C++ type-name of the as template argument passed type.
Definition: TypeName.hxx:20
 
Definition: SharedData.hxx:50
 
Definition: SharedData.hxx:123
 
Definition: SharedData.hxx:148
 
Definition: SharedData.hxx:161
 
Definition: SharedData.hxx:27
 
SharedMemoryImpl sharedMemoryImpl
Actual implementation of the shared memory functionality.
Definition: SharedMemory.hpp:74
 
Mutual exclusion object to prevent data from concurrent modifications.
Definition: Mutex.hpp:27
 
Root namespace for the PLCnext API
 
Definition: SharedData.hxx:70