CppCommon  1.0.4.1
C++ Common Library
shared_type.inl
Go to the documentation of this file.
1 
9 namespace CppCommon {
10 
11 template <typename T>
12 inline SharedType<T>::SharedType(const std::string& name) : _shared(name, sizeof(T))
13 {
14  // Check for the owner flag
15  if (_shared.owner())
16  {
17  // Call in place constructor
18  new (_shared.ptr()) T();
19  }
20 }
21 
22 } // namespace CppCommon
void * ptr()
Get the shared memory block pointer.
bool owner() const
Get the shared memory owner flag (true if the new one was created, false if the existing one was open...
SharedType(const std::string &name)
Create a new or open existing shared memory type with a given name.
Definition: shared_type.inl:12
C++ Common project definitions.
Definition: token_bucket.h:15