ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::ObjectManager Class Referencefinal

#include <ObjectManager.h>

Collaboration diagram for coco::ObjectManager:

Public Member Functions

 ObjectManager (Module *m=nullptr)
 
template<typename T >
T * create (void)
 
void destroy (Object *o)
 Destroy (= deallocate) an Object entity.
 
template<>
FeatureObjectcreate (void)
 
template<>
KernelObjectcreate (void)
 
- Public Member Functions inherited from coco::PtrManager< Object >
uint32_t size (void) const
 Return the number of managed objects.
 
Objectat (uint32_t n) const
 
- Public Member Functions inherited from coco::EntityBuilder
virtual ~EntityBuilder ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from coco::PtrManager< Object >
U * take (std::unique_ptr< U > &&o)
 
std::unique_ptr< Objectrelease (Object *ptr)
 
- Protected Member Functions inherited from coco::EntityBuilder
Modulemodule (void) const
 
void module (Module *m)
 
void modulize (Entity *entity) const
 

Detailed Description

Definition at line 33 of file ObjectManager.h.

Constructor & Destructor Documentation

◆ ObjectManager()

coco::ObjectManager::ObjectManager ( Module m = nullptr)
inline

Definition at line 36 of file ObjectManager.h.

36{ module(m); }
Module * module(void) const

References m, and coco::EntityBuilder::module().

Member Function Documentation

◆ create() [1/3]

template<typename T >
T * coco::ObjectManager::create ( void  )

◆ create() [2/3]

template<>
FeatureObject * coco::ObjectManager::create ( void  )

Definition at line 30 of file ObjectManager.cpp.

31{
32 auto feature = make_unique<FeatureObject>();
33 modulize(feature.get());
34 return take(std::move(feature));
35}
void modulize(Entity *entity) const
U * take(std::unique_ptr< U > &&o)
Definition PtrManager.h:38

References coco::EntityBuilder::modulize(), and coco::PtrManager< Object >::take().

◆ create() [3/3]

template<>
KernelObject * coco::ObjectManager::create ( void  )

Definition at line 37 of file ObjectManager.cpp.

38{
39 auto kernel = make_unique<KernelObject>();
40 modulize(kernel.get());
41 return take(std::move(kernel));
42}

References coco::EntityBuilder::modulize(), and coco::PtrManager< Object >::take().

◆ destroy()

void coco::ObjectManager::destroy ( Object o)

Destroy (= deallocate) an Object entity.

NOTE An Object SHOULD HAVE NO DEF & USES to be destructed NOTE An Object WILL BE unlinked from its dependent bag (if has) on destruction

Definition at line 44 of file ObjectManager.cpp.

45{
46 assert(o->def() == nullptr);
47 assert(o->uses()->size() == 0);
48 release(o);
49}
std::unique_ptr< Object > release(Object *ptr)
Definition PtrManager.h:46

References coco::Object::def(), coco::PtrManager< Object >::release(), and coco::Object::uses().


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