CppFactory  0.1.0
Modern c++ object factory implementation in <200 lines
Static Public Member Functions | List of all members
CppFactory::GlobalObject< TObject > Class Template Reference

Represents an Object that has a global lifetime, meaning it doesn't get destroyed when it leaves scope More...

#include <CppFactory.hpp>

Static Public Member Functions

template<int TZone = 0>
static std::shared_ptr< TObject > Get ()
 Gets (and allocates, if needed) a global object (optionally from a particular zone) for type TObject More...
 
template<int TZone>
static void Reset ()
 Resets the global object cache for all zones for type TObject More...
 
static void Reset ()
 Resets the global object cache for all zones for type TObject More...
 

Detailed Description

template<class TObject>
class CppFactory::GlobalObject< TObject >

Represents an Object that has a global lifetime, meaning it doesn't get destroyed when it leaves scope

Parameters
TObjectThe type of object

Member Function Documentation

◆ Get()

template<class TObject>
template<int TZone = 0>
static std::shared_ptr<TObject> CppFactory::GlobalObject< TObject >::Get ( )
inlinestatic

Gets (and allocates, if needed) a global object (optionally from a particular zone) for type TObject

Parameters
TZoneThe zone to get from
Returns
The object

GlobalObject<TObject>::Get();

◆ Reset() [1/2]

template<class TObject>
template<int TZone>
static void CppFactory::GlobalObject< TObject >::Reset ( )
inlinestatic

Resets the global object cache for all zones for type TObject

Parameters
TZoneThe zone to reset

GlobalObject<TObject>::Reset<1>();

◆ Reset() [2/2]

template<class TObject>
static void CppFactory::GlobalObject< TObject >::Reset ( )
inlinestatic

Resets the global object cache for all zones for type TObject

GlobalObject<TObject>::Reset();


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