Represents an object that is created via a "factory"
More...
#include <CppFactory.hpp>
|
template<int TZone = 0> |
static void | RegisterAllocator (const std::function< std::shared_ptr< TObject >()> &alloc) |
| Registers logic capable of allocating (and optionally deallocating) an object of type TObject More...
|
|
static void | UnregisterAllocator () |
| Unregisters all allocators for all zones for type TObject More...
|
|
template<int TZone> |
static void | UnregisterAllocator () |
| Unregisters all allocators for a particular zone for type TObject More...
|
|
template<int TZone = 0> |
static std::shared_ptr< TObject > | Get () |
| Gets (and allocates, if needed) an object (optionally from a particular zone) for type TObject More...
|
|
template<class TObject>
class CppFactory::Object< TObject >
Represents an object that is created via a "factory"
- Parameters
-
TObject | The type of object |
◆ Get()
template<class TObject>
template<int TZone = 0>
Gets (and allocates, if needed) an object (optionally from a particular zone) for type TObject
- Parameters
-
TZone | The zone to get from |
- Returns
- The object
Object<TObject>::Get();
◆ RegisterAllocator()
template<class TObject>
template<int TZone = 0>
static void CppFactory::Object< TObject >::RegisterAllocator |
( |
const std::function< std::shared_ptr< TObject< TObject > >()> & |
alloc | ) |
|
|
inlinestatic |
Registers logic capable of allocating (and optionally deallocating) an object of type TObject
- Parameters
-
TZone | The zone to register for |
alloc | Function that allocates an object |
Object<TObject>::RegisterAllocator([] { return std::make_shared<TObject>(); });
◆ UnregisterAllocator() [1/2]
Unregisters all allocators for all zones for type TObject
Object<TObject>::UnregisterAllocator();
◆ UnregisterAllocator() [2/2]
template<class TObject>
template<int TZone>
Unregisters all allocators for a particular zone for type TObject
- Parameters
-
TZone | The zone to unregister |
Object<TObject>::UnregisterAllocator(10);
The documentation for this class was generated from the following file: