SOFA API  1e111313
Open source framework for multi-physics simuation
sofa::core::objectmodel::AspectPool Class Reference

#include <AspectPool.h>

Detailed Description

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)


class Aspect

Constructor details

sofa::core::objectmodel::AspectPool::AspectPool ( )

Constructor: creates a new aspect pool.

sofa::core::objectmodel::AspectPool::~AspectPool ( )


Function details

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.

AspectRef sofa::core::objectmodel::AspectPool::getAspect ( int  id)
int sofa::core::objectmodel::AspectPool::getAspectCounter ( int  id) const
int sofa::core::objectmodel::AspectPool::nbAspects ( ) const
void sofa::core::objectmodel::AspectPool::release ( int  id)

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)

Related details

friend class Aspect