VSM C++ SDK
Vehicle Specific Modules SDK
ugcs::vsm::Singleton< T > Class Template Reference

Helper class for implementing singletons. More...

#include <singleton.h>

Public Member Functions

 Singleton (const Singleton &)=delete
 Disable copying. More...
 
template<typename... Args>
std::shared_ptr< T > Get_instance (Args &&...args)
 Get singleton instance. More...
 

Detailed Description

template<class T>
class ugcs::vsm::Singleton< T >

Helper class for implementing singletons.

Parameters
Ttype for instantiated class.

Constructor & Destructor Documentation

template<class T>
ugcs::vsm::Singleton< T >::Singleton ( const Singleton< T > &  )
delete

Disable copying.

Member Function Documentation

template<class T>
template<typename... Args>
std::shared_ptr<T> ugcs::vsm::Singleton< T >::Get_instance ( Args &&...  args)
inline

Get singleton instance.

The same instance is returned until the last reference is released. In case the target class does not have default constructor and the constructor arguments are not provided, the new instance is not created - nullptr is returned if it was not previously created.

Parameters
argsArguments to constructor if any.
Returns
Global singleton instance.

The documentation for this class was generated from the following file: