hpp-pinocchio 7.0.0
Wrapping of the kinematic/dynamic chain Pinocchio for HPP.
Loading...
Searching...
No Matches
hpp::pinocchio::Pool< T > Class Template Reference

Pool of objects. More...

#include <hpp/pinocchio/pool.hh>

Public Member Functions

T * acquire ()
void release (T *t)
bool available () const
 Returns true is at least one object is not locked.
std::size_t size () const
void clear ()
 Deletes all internal objects.
void push_back (T *t)
template<class InputIterator>
void push_back (InputIterator first, InputIterator last)
 ~Pool ()
 Pool ()
 Constructor.

Detailed Description

template<typename T>
class hpp::pinocchio::Pool< T >

Pool of objects.

Usage:

Pool<Foo> pool;
std::vector<Foo*> temporary_foos;
// Fill temporary_foos new objects.
// The ownership is passed to the pool.
pool.push_back (foo.begin(), foo.end());
Foo* foo = pool.acquire();
// Access to foo is thread safe.
pool.release(foo);
void push_back(T *t)
Definition pool.hh:99
T * acquire()
Definition pool.hh:61
void release(T *t)
Definition pool.hh:73
Pool()
Constructor.
Definition pool.hh:117

Constructor & Destructor Documentation

◆ ~Pool()

template<typename T>
hpp::pinocchio::Pool< T >::~Pool()
inline

Destructor Calls Pool::clear()

◆ Pool()

template<typename T>
hpp::pinocchio::Pool< T >::Pool()
inline

Constructor.

Member Function Documentation

◆ acquire()

template<typename T>
T * hpp::pinocchio::Pool< T >::acquire()
inline

Get an object from the pool. If the pool is empty, wait until one element becomes available.

◆ available()

template<typename T>
bool hpp::pinocchio::Pool< T >::available()const
inline

Returns true is at least one object is not locked.

◆ clear()

template<typename T>
void hpp::pinocchio::Pool< T >::clear()
inline

Deletes all internal objects.

◆ push_back() [1/2]

template<typename T>
template<class InputIterator>
void hpp::pinocchio::Pool< T >::push_back(InputIteratorfirst,
InputIteratorlast )
inline

Add objects to the pool The pool takes ownership of the object

◆ push_back() [2/2]

template<typename T>
void hpp::pinocchio::Pool< T >::push_back(T *t)
inline

Adds an object to the pool The pool takes ownership of the object

◆ release()

template<typename T>
void hpp::pinocchio::Pool< T >::release(T *t)
inline

Release a previously acquired object.

Warning
There is no check that the object was actually one returned by Pool::acquire

◆ size()

template<typename T>
std::size_t hpp::pinocchio::Pool< T >::size()const
inline

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