ONE - On-device Neural Engine
Loading...
Searching...
No Matches
coco::PtrManager< T > Class Template Reference

#include <PtrManager.h>

Public Member Functions

uint32_t size (void) const
 Return the number of managed objects.
 
T * at (uint32_t n) const
 

Protected Member Functions

template<typename U >
U * take (std::unique_ptr< U > &&o)
 
std::unique_ptr< T > release (T *ptr)
 

Detailed Description

template<typename T>
class coco::PtrManager< T >

Definition at line 28 of file PtrManager.h.

Member Function Documentation

◆ at()

template<typename T >
T * coco::PtrManager< T >::at ( uint32_t  n) const
inline

Definition at line 35 of file PtrManager.h.

35{ return _ptrs.at(n).get(); }

Referenced by enco::generate_bypass_shuffle(), and enco::lower_copy().

◆ release()

template<typename T >
std::unique_ptr< T > coco::PtrManager< T >::release ( T *  ptr)
inlineprotected

Definition at line 46 of file PtrManager.h.

47 {
48 for (auto it = _ptrs.begin(); it != _ptrs.end(); ++it)
49 {
50 if (it->get() == ptr)
51 {
52 std::unique_ptr<T> res = std::move(*it);
53 _ptrs.erase(it);
54 return res;
55 }
56 }
57
58 throw std::invalid_argument{"ptr"};
59 }

◆ size()

template<typename T >
uint32_t coco::PtrManager< T >::size ( void  ) const
inline

Return the number of managed objects.

Definition at line 32 of file PtrManager.h.

32{ return _ptrs.size(); }

◆ take()

template<typename T >
template<typename U >
U * coco::PtrManager< T >::take ( std::unique_ptr< U > &&  o)
inlineprotected

Definition at line 38 of file PtrManager.h.

39 {
40 auto res = o.get();
41 _ptrs.emplace_back(std::move(o));
42 return res;
43 }

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