ONE - On-device Neural Engine
Loading...
Searching...
No Matches
loco::NodePool Class Referencefinal

#include <NodePool.h>

Collaboration diagram for loco::NodePool:

Public Member Functions

 ~NodePool ()
 
template<typename Derived , typename... Args>
Derived * create (Args &&...args)
 
void destroy (Node *node)
 
- Public Member Functions inherited from loco::ObjectPool< Node >
virtual ~ObjectPool ()=default
 
uint32_t size (void) const
 Return the number of objects.
 
Nodeat (uint32_t n) const
 Access N-th object.
 

Friends

class Graph
 

Additional Inherited Members

- Protected Member Functions inherited from loco::ObjectPool< Node >
U * take (std::unique_ptr< U > &&o)
 Take the ownership of a given object and returns its raw pointer.
 
bool erase (Node *ptr)
 Erase an object from the pool.
 

Detailed Description

Definition at line 28 of file NodePool.h.

Constructor & Destructor Documentation

◆ ~NodePool()

loco::NodePool::~NodePool ( )

Definition at line 22 of file NodePool.cpp.

23{
24 // Drop all the references before deallocation
25 for (uint32_t n = 0; n < size(); ++n)
26 {
27 at(n)->drop();
28 }
29}
virtual void drop(void)=0
Drop all the reference of arguments.
Node * at(uint32_t n) const
Access N-th object.
Definition ObjectPool.h:41
uint32_t size(void) const
Return the number of objects.
Definition ObjectPool.h:38

References loco::ObjectPool< Node >::at(), loco::Node::drop(), and loco::ObjectPool< Node >::size().

Member Function Documentation

◆ create()

template<typename Derived , typename... Args>
Derived * loco::NodePool::create ( Args &&...  args)
inline

◆ destroy()

void loco::NodePool::destroy ( Node node)
inline

Definition at line 44 of file NodePool.h.

45 {
46 if (!ObjectPool<Node>::erase(node))
47 {
48 throw std::invalid_argument{"node"};
49 }
50 }

Friends And Related Symbol Documentation

◆ Graph

friend class Graph
friend

Definition at line 31 of file NodePool.h.


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