16 #ifndef SURGSIM_FRAMEWORK_SHAREDINSTANCE_H 17 #define SURGSIM_FRAMEWORK_SHAREDINSTANCE_H 22 #include <boost/thread/mutex.hpp> 23 #include <boost/thread/locks.hpp> 104 template <
typename T>
132 std::shared_ptr<T>
get();
166 #endif // SURGSIM_FRAMEWORK_SHAREDINSTANCE_H SharedInstance & operator=(const SharedInstance &)
Prevent assignment.
Definition: CompoundShapeToGraphics.cpp:29
std::weak_ptr< T > m_weakInstance
A weak reference to the shared instance, if any.
Definition: SharedInstance.h:155
~SharedInstance()
Destroy the container and the data it contains.
Definition: SharedInstance-inl.h:46
boost::mutex m_mutex
Mutex for synchronization of object creation.
Definition: SharedInstance.h:158
static InstanceCreator defaultInstanceCreator()
Creates a function that can create an instance using std::make_shared<T>().
Definition: SharedInstance-inl.h:72
SharedInstance()
Create the SharedInstance object used to manage the shared instance.
Definition: SharedInstance-inl.h:34
InstanceCreator m_instanceCreator
A creator function used to construct the shared instance.
Definition: SharedInstance.h:152
The header that provides the assertion API.
std::function< std::shared_ptr< T >)> InstanceCreator
A type that can hold a function object or lambda that takes no arguments and returns std::shared_ptr<...
Definition: SharedInstance.h:109
A utility class to manage a shared instance of an object.
Definition: SharedInstance.h:105
std::shared_ptr< T > createInstance()
Creates an object instance.
Definition: SharedInstance-inl.h:64