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

#include <BlockManager.h>

Collaboration diagram for coco::BlockManager:

Public Member Functions

 BlockManager (Module *m=nullptr)
 
Blockcreate (void)
 
void destroy (Block *)
 Free 'Block' object.
 
- Public Member Functions inherited from coco::PtrManager< Block >
uint32_t size (void) const
 Return the number of managed objects.
 
Blockat (uint32_t n) const
 
- Public Member Functions inherited from coco::EntityBuilder
virtual ~EntityBuilder ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from coco::PtrManager< Block >
U * take (std::unique_ptr< U > &&o)
 
std::unique_ptr< Blockrelease (Block *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 28 of file BlockManager.h.

Constructor & Destructor Documentation

◆ BlockManager()

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

Definition at line 31 of file BlockManager.h.

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

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

Member Function Documentation

◆ create()

Block * coco::BlockManager::create ( void  )

Definition at line 25 of file BlockManager.cpp.

26{
27 auto blk = std::make_unique<Block>();
28 modulize(blk.get());
29 return take(std::move(blk));
30}
void modulize(Entity *entity) const
U * take(std::unique_ptr< U > &&o)
Definition PtrManager.h:38

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

◆ destroy()

void coco::BlockManager::destroy ( Block blk)

Free 'Block' object.

NOTE Block SHOULD be detached from any list before it is destructed

Definition at line 32 of file BlockManager.cpp.

33{
34 assert(blk->parent() == nullptr);
35 assert(blk->prev() == nullptr);
36 assert(blk->next() == nullptr);
37 release(blk);
38}
std::unique_ptr< Block > release(Block *ptr)
Definition PtrManager.h:46

References coco::DLinkedList< Child, Parent >::Node::next(), coco::DLinkedList< Child, Parent >::Node::parent(), coco::DLinkedList< Child, Parent >::Node::prev(), and coco::PtrManager< Block >::release().


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