#include <AspectPool.h>
This class is responsible for managing the pool of available aspects numbers. It is safe to use this class from several thread.
Public Member Functions | |
| AspectPool () | |
| ~AspectPool () | |
| void | setReleaseCallback (const std::function< void(int)> &callback) |
| AspectRef | allocate () |
| AspectRef | getAspect (int id) |
| int | nbAspects () const |
| int | getAspectCounter (int id) const |
Protected Member Functions | |
| void | release (int id) |
Friends | |
| class | Aspect |
| sofa::core::objectmodel::AspectPool::AspectPool | ( | ) |
Constructor: creates a new aspect pool.
| sofa::core::objectmodel::AspectPool::~AspectPool | ( | ) |
Destructor.
| AspectRef sofa::core::objectmodel::AspectPool::allocate | ( | ) |
Request a new aspect. The returned object should stay alive as long as the aspect is in use. It it possible to duplicate the AspectRef if several threads/algorithm use the same aspect. If no aspect remains available, null pointer is returned.
|
inline |
|
protected |
Release the aspect having the specified number. It makes the number immediately available to satisfy subsequent AspectPool::allocate requests.
| void sofa::core::objectmodel::AspectPool::setReleaseCallback | ( | const std::function< void(int)> & | callback | ) |
|
friend |