CppCommon 1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
shared_type.inl
Go to the documentation of this file.
1
9namespace CppCommon {
10
11template <typename T>
12inline 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.
C++ Common project definitions.