Essentia  2.1-beta6-dev
Pool Class Reference

#include <pool.h>

Public Member Functions

void add (const std::string &name, const Real &value, bool validityCheck=false)
 
void add (const std::string &name, const std::vector< Real > &value, bool validityCheck=false)
 
void add (const std::string &name, const std::string &value, bool validityCheck=false)
 
void add (const std::string &name, const std::vector< std::string > &value, bool validityCheck=false)
 
void add (const std::string &name, const TNT::Array2D< Real > &value, bool validityCheck=false)
 
void add (const std::string &name, const Tensor< Real > &value, bool validityCheck=false)
 
void add (const std::string &name, const StereoSample &value, bool validityCheck=false)
 
template<typename T >
void append (const std::string &name, const std::vector< T > &values)
 
void set (const std::string &name, const Real &value, bool validityCheck=false)
 Sets the value of a descriptor name. More...
 
void set (const std::string &name, const std::vector< Real > &value, bool validityCheck=false)
 Sets the value of a descriptor name. More...
 
void set (const std::string &name, const std::string &value, bool validityCheck=false)
 Sets the value of a descriptor name. More...
 
void set (const std::string &name, const std::vector< std::string > &value, bool validityCheck=false)
 Sets the value of a descriptor name. More...
 
void set (const std::string &name, const Tensor< Real > &value, bool validityCheck=false)
 
void merge (Pool &p, const std::string &type="")
 Merges the current pool with the given one p. More...
 
void merge (const std::string &name, const std::vector< Real > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void merge (const std::string &name, const std::vector< std::vector< Real > > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void merge (const std::string &name, const std::vector< std::string > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void merge (const std::string &name, const std::vector< std::vector< std::string > > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void merge (const std::string &name, const std::vector< TNT::Array2D< Real > > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void merge (const std::string &name, const std::vector< Tensor< Real > > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void merge (const std::string &name, const std::vector< StereoSample > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void mergeSingle (const std::string &name, const Real &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void mergeSingle (const std::string &name, const std::vector< Real > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void mergeSingle (const std::string &name, const std::string &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void mergeSingle (const std::string &name, const std::vector< std::string > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void mergeSingle (const std::string &name, const Tensor< Real > &value, const std::string &type="")
 Merges the values given in value into the current pool's descriptor given by name. More...
 
void remove (const std::string &name)
 
void removeNamespace (const std::string &ns)
 
template<typename T >
const T & value (const std::string &name) const
 
template<typename T >
bool contains (const std::string &name) const
 
std::vector< std::string > descriptorNames () const
 
std::vector< std::string > descriptorNames (const std::string &ns) const
 
const std::map< std::string, std::vector< Real > > & getRealPool () const
 
const std::map< std::string, std::vector< std::vector< Real > > > & getVectorRealPool () const
 
const std::map< std::string, std::vector< std::string > > & getStringPool () const
 
const std::map< std::string, std::vector< std::vector< std::string > > > & getVectorStringPool () const
 
const std::map< std::string, std::vector< TNT::Array2D< Real > > > & getArray2DRealPool () const
 
const std::map< std::string, std::vector< Tensor< Real > > > & getTensorRealPool () const
 
const std::map< std::string, std::vector< StereoSample > > & getStereoSamplePool () const
 
const std::map< std::string, Real > & getSingleRealPool () const
 
const std::map< std::string, std::string > & getSingleStringPool () const
 
const std::map< std::string, std::vector< Real > > & getSingleVectorRealPool () const
 
const std::map< std::string, std::vector< std::string > > & getSingleVectorStringPool () const
 
const std::map< std::string, Tensor< Real > > & getSingleTensorRealPool () const
 
void checkIntegrity () const
 
void clear ()
 
bool isSingleValue (const std::string &name)
 

Public Attributes

Mutex mutexReal
 
Mutex mutexVectorReal
 
Mutex mutexString
 
Mutex mutexVectorString
 
Mutex mutexArray2DReal
 
Mutex mutexStereoSample
 
Mutex mutexSingleReal
 
Mutex mutexSingleString
 
Mutex mutexSingleVectorReal
 
Mutex mutexSingleVectorString
 
Mutex mutexTensorReal
 
Mutex mutexSingleTensorReal
 

Protected Member Functions

std::vector< std::string > descriptorNamesNoLocking () const
 
void validateKey (const std::string &name)
 

Protected Attributes

std::map< std::string, Real_poolSingleReal
 
std::map< std::string, std::string > _poolSingleString
 
std::map< std::string, std::vector< Real > > _poolSingleVectorReal
 
std::map< std::string, std::vector< std::string > > _poolSingleVectorString
 
std::map< std::string, Tensor< Real > > _poolSingleTensorReal
 
std::map< std::string, std::vector< Real > > _poolReal
 
std::map< std::string, std::vector< std::vector< Real > > > _poolVectorReal
 
std::map< std::string, std::vector< std::string > > _poolString
 
std::map< std::string, std::vector< std::vector< std::string > > > _poolVectorString
 
std::map< std::string, std::vector< TNT::Array2D< Real > > > _poolArray2DReal
 
std::map< std::string, std::vector< Tensor< Real > > > _poolTensorReal
 
std::map< std::string, std::vector< StereoSample > > _poolStereoSample
 

Detailed Description

The pool is a storage structure which can hold frames of all kinds of descriptors. A Pool instance is thread-safe.

More specifically, a Pool maps descriptor names to data. A descriptor name is a period ('.') delimited string of identifiers that are associated with the values of some audio descriptor (or any other piece of data). For example, the descriptor name "lowlevel.bpm" identifies a low-level value of beats per minute. Currently, the Pool supports storing:

  • Reals
  • Strings
  • vectors of Reals
  • vectors of Strings
  • Array2D of Reals
  • StereoSamples

The Pool supports the ability to repeatedly add data under the same descriptor name as well as associating a descriptor name with only one datum. The set function is used in the latter case, and the former is explained in the next paragraph.

When data is added to the pool under a given descriptor name, it is added to a vector of data for that descriptor name. When the data is retrieved, a vector of data which was stored under that descriptor name is returned. For example, in the case of the descriptor name, "foo.bar", which maps to Real descriptor values, every time a Real is added under the name "foo.bar", it is actually stored in a vector. When the data mapped to by "foo.bar" is retrieved, a vector of Reals is returned, even if only one Real value was added under "foo.bar". In the case of data of type vector of Reals, a vector of vector of Reals is returned when the data is retrieved.

It is not allowed to mix data types under the same descriptor name. Each of the four types listed above are treated as separate types. In addition, a descriptor name that maps to a single datum is considered mapping to a different type than a descriptor name that maps to a vector of the same type.

After a Pool is filled with data, it can be passed to the YamlOutput algorithm for saving the data in the Pool to a file or it can be passed to the PoolAggregator algorithm for computing statistics on the data in the Pool. Similarly, the file generated by YamlOutput can be restored into a Pool using the YamlInput algorithm.

For each type, the pool has its own public mutex (i.e. mutexReal, mutexVectorReal, etc.) If locking the pool globally or partially, lock should be acquired in the following order:

    MutexLocker lockReal(mutexReal)
    MutexLocker lockVectorReal(mutexVectorReal)
    MutexLocker lockString(mutexString)
    MutexLocker lockVectorString(mutexVectorString)
    MutexLocker lockArray2DReal(mutexArray2DReal)
    MutexLocker lockStereoSample(mutexStereoSample)
    MutexLocker lockSingleReal(mutexSingleReal)
    MutexLocker lockSingleString(mutexSingleString)
    MutexLocker lockSingleVectorReal(mutexSingleVectorReal)
    MutexLocker lockSingleVectorString(mutexSingleVectorString)

To release the locks, the order should be reversed!

Member Function Documentation

◆ add() [1/7]

void add ( const std::string &  name,
const Real value,
bool  validityCheck = false 
)

Adds value to the Pool under name

Parameters
namea descriptor name that identifies the collection of data to add value to
valuethe value to add to the collection of data that name points to
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.
Remarks
If name already exists in the pool and points to data with the same data type as value, then value is concatenated to the vector stored therein. If, however, name already exists in the pool and points to a different data type than value, then this can cause unwanted behavior for the rest of the member functions of Pool. To avoid this, do not add data into the Pool whose descriptor name already exists in the Pool and points to a different data type than value.
If name has child descriptor names, this function will throw an exception. For example, if "foo.bar" exists in the pool, this function can no longer be called with "foo" as its name parameter, because "bar" is a child descriptor name of "foo".

Referenced by PoolStorage< TokenType, StorageType >::addToPool().

◆ add() [2/7]

void add ( const std::string &  name,
const std::string &  value,
bool  validityCheck = false 
)

Adds value to the Pool under name

Parameters
namea descriptor name that identifies the collection of data to add value to
valuethe value to add to the collection of data that name points to
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.
Remarks
If name already exists in the pool and points to data with the same data type as value, then value is concatenated to the vector stored therein. If, however, name already exists in the pool and points to a different data type than value, then this can cause unwanted behavior for the rest of the member functions of Pool. To avoid this, do not add data into the Pool whose descriptor name already exists in the Pool and points to a different data type than value.
If name has child descriptor names, this function will throw an exception. For example, if "foo.bar" exists in the pool, this function can no longer be called with "foo" as its name parameter, because "bar" is a child descriptor name of "foo".

◆ add() [3/7]

void add ( const std::string &  name,
const std::vector< Real > &  value,
bool  validityCheck = false 
)

Adds value to the Pool under name

Parameters
namea descriptor name that identifies the collection of data to add value to
valuethe value to add to the collection of data that name points to
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.
Remarks
If name already exists in the pool and points to data with the same data type as value, then value is concatenated to the vector stored therein. If, however, name already exists in the pool and points to a different data type than value, then this can cause unwanted behavior for the rest of the member functions of Pool. To avoid this, do not add data into the Pool whose descriptor name already exists in the Pool and points to a different data type than value.
If name has child descriptor names, this function will throw an exception. For example, if "foo.bar" exists in the pool, this function can no longer be called with "foo" as its name parameter, because "bar" is a child descriptor name of "foo".

◆ add() [4/7]

void add ( const std::string &  name,
const std::vector< std::string > &  value,
bool  validityCheck = false 
)

Adds value to the Pool under name

Parameters
namea descriptor name that identifies the collection of data to add value to
valuethe value to add to the collection of data that name points to
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.
Remarks
If name already exists in the pool and points to data with the same data type as value, then value is concatenated to the vector stored therein. If, however, name already exists in the pool and points to a different data type than value, then this can cause unwanted behavior for the rest of the member functions of Pool. To avoid this, do not add data into the Pool whose descriptor name already exists in the Pool and points to a different data type than value.
If name has child descriptor names, this function will throw an exception. For example, if "foo.bar" exists in the pool, this function can no longer be called with "foo" as its name parameter, because "bar" is a child descriptor name of "foo".

◆ add() [5/7]

void add ( const std::string &  name,
const StereoSample value,
bool  validityCheck = false 
)

Adds value to the Pool under name

Parameters
namea descriptor name that identifies the collection of data to add value to
valuethe value to add to the collection of data that name points to
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.
Remarks
If name already exists in the pool and points to data with the same data type as value, then value is concatenated to the vector stored therein. If, however, name already exists in the pool and points to a different data type than value, then this can cause unwanted behavior for the rest of the member functions of Pool. To avoid this, do not add data into the Pool whose descriptor name already exists in the Pool and points to a different data type than value.
If name has child descriptor names, this function will throw an exception. For example, if "foo.bar" exists in the pool, this function can no longer be called with "foo" as its name parameter, because "bar" is a child descriptor name of "foo".

◆ add() [6/7]

void add ( const std::string &  name,
const Tensor< Real > &  value,
bool  validityCheck = false 
)

◆ add() [7/7]

void add ( const std::string &  name,
const TNT::Array2D< Real > &  value,
bool  validityCheck = false 
)

Adds value to the Pool under name

Parameters
namea descriptor name that identifies the collection of data to add value to
valuethe value to add to the collection of data that name points to
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.
Remarks
If name already exists in the pool and points to data with the same data type as value, then value is concatenated to the vector stored therein. If, however, name already exists in the pool and points to a different data type than value, then this can cause unwanted behavior for the rest of the member functions of Pool. To avoid this, do not add data into the Pool whose descriptor name already exists in the Pool and points to a different data type than value.
If name has child descriptor names, this function will throw an exception. For example, if "foo.bar" exists in the pool, this function can no longer be called with "foo" as its name parameter, because "bar" is a child descriptor name of "foo".

◆ append()

void append ( const std::string &  name,
const std::vector< T > &  values 
)

WARNING: this is an utility method that might fail in weird ways if not used correctly. When in doubt, always use the add() method. This is provided for optimization only.

Referenced by PoolStorage< TokenType, StorageType >::process().

◆ checkIntegrity()

void checkIntegrity ( ) const

Checks that no descriptor name is in two different inner pool types at the same time, and throws an EssentiaException if there is

◆ clear()

void clear ( )

Clears all the values contained in the pool.

◆ contains()

bool contains ( const std::string &  name) const
Returns
whether the given descriptor name exists in the pool
Parameters
nameis the name of the descriptor you wish to check for
Template Parameters
Tis the type of data that name refers to

◆ descriptorNames() [1/2]

std::vector<std::string> descriptorNames ( ) const
Returns
a vector containing all descriptor names in the Pool

◆ descriptorNames() [2/2]

std::vector<std::string> descriptorNames ( const std::string &  ns) const
Returns
a vector containing all descriptor names in the Pool which belong to the specified namespace ns

◆ descriptorNamesNoLocking()

std::vector<std::string> descriptorNamesNoLocking ( ) const
protected

◆ getArray2DRealPool()

const std::map<std::string, std::vector< TNT::Array2D<Real> > >& getArray2DRealPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the values are of type TNT::Array2D<Real>

References Pool::_poolArray2DReal.

◆ getRealPool()

const std::map<std::string, std::vector< Real > >& getRealPool ( ) const
inline
Returns
a map where the key is a descriptor name and the values are of type Real

References Pool::_poolReal.

◆ getSingleRealPool()

const std::map<std::string, Real>& getSingleRealPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the value is of type Real

References Pool::_poolSingleReal.

◆ getSingleStringPool()

const std::map<std::string, std::string>& getSingleStringPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the value is of type string

References Pool::_poolSingleString.

◆ getSingleTensorRealPool()

const std::map<std::string, Tensor<Real> >& getSingleTensorRealPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the value is of type vector<string>

References Pool::_poolSingleTensorReal.

◆ getSingleVectorRealPool()

const std::map<std::string, std::vector<Real> >& getSingleVectorRealPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the value is of type vector<Real>

References Pool::_poolSingleVectorReal.

◆ getSingleVectorStringPool()

const std::map<std::string, std::vector<std::string> >& getSingleVectorStringPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the value is of type vector<string>

References Pool::_poolSingleVectorString.

◆ getStereoSamplePool()

const std::map<std::string, std::vector< StereoSample > >& getStereoSamplePool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the values are of type StereoSample

References Pool::_poolStereoSample.

◆ getStringPool()

const std::map<std::string, std::vector< std::string > >& getStringPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the values are of type string

References Pool::_poolString.

◆ getTensorRealPool()

const std::map<std::string, std::vector< Tensor<Real> > >& getTensorRealPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the values are of type Tensor<Real>

References Pool::_poolTensorReal.

◆ getVectorRealPool()

const std::map<std::string, std::vector< std::vector<Real> > >& getVectorRealPool ( ) const
inline
Returns
a map where the key is a descriptor name and the values are of type vector<Real>

References Pool::_poolVectorReal.

◆ getVectorStringPool()

const std::map<std::string, std::vector< std::vector<std::string> > >& getVectorStringPool ( ) const
inline
Returns
a std::map where the key is a descriptor name and the values are of type vector<string>

References Pool::_poolVectorString.

◆ isSingleValue()

bool isSingleValue ( const std::string &  name)

returns true if descriptor under name name is supposed to hold one single value

◆ merge() [1/8]

void merge ( const std::string &  name,
const std::vector< Real > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [2/8]

void merge ( const std::string &  name,
const std::vector< std::string > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [3/8]

void merge ( const std::string &  name,
const std::vector< std::vector< Real > > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [4/8]

void merge ( const std::string &  name,
const std::vector< std::vector< std::string > > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [5/8]

void merge ( const std::string &  name,
const std::vector< StereoSample > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [6/8]

void merge ( const std::string &  name,
const std::vector< Tensor< Real > > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [7/8]

void merge ( const std::string &  name,
const std::vector< TNT::Array2D< Real > > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ merge() [8/8]

void merge ( Pool p,
const std::string &  type = "" 
)

Merges the current pool with the given one p.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ mergeSingle() [1/5]

void mergeSingle ( const std::string &  name,
const Real value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ mergeSingle() [2/5]

void mergeSingle ( const std::string &  name,
const std::string &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ mergeSingle() [3/5]

void mergeSingle ( const std::string &  name,
const std::vector< Real > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ mergeSingle() [4/5]

void mergeSingle ( const std::string &  name,
const std::vector< std::string > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ mergeSingle() [5/5]

void mergeSingle ( const std::string &  name,
const Tensor< Real > &  value,
const std::string &  type = "" 
)

Merges the values given in value into the current pool's descriptor given by name.

If the pool contains a descriptor with name name, the current pool will keep its original descriptor values unless a type of merging is specified.

Merge types can be:

  • "replace" : if descriptor is not found it will be added to the pool otherwise it will remove the existing descriptor and subsitute it by the given one, regardless of type
  • "append" : if descriptor is not found it will be added to the pool otherwise it will appended to the existing descriptor if and only ifthey share the same type.
  • "interleave" : if descriptor is already in the pool, the new values will be interleaved with the existing ones if and only if they have the same type. If the descriptor is not found int the pool it will be added.

◆ remove()

void remove ( const std::string &  name)

Removes the descriptor name name from the Pool along with the data it points to. This function does nothing if name does not exist in the Pool.

Parameters
namethe descriptor name to remove

◆ removeNamespace()

void removeNamespace ( const std::string &  ns)

Removes the entire namespace given by ns from the Pool along with the data it points to. This function does nothing if ns does not exist in the Pool.

Parameters
nsthe descriptor namespace to remove

◆ set() [1/5]

void set ( const std::string &  name,
const Real value,
bool  validityCheck = false 
)

Sets the value of a descriptor name.

This function is different than the add functions because set does not append data to the existing data under a given descriptor name, it sets it. Thus there can only be one datum associated with a descriptor name introduced to the pool via the set function. This function is useful when there is only one value associated with a given descriptor name.

Parameters
nameis the descriptor name of the datum to set
valueis the datum to associate with name
Remarks
The set function cannot be used to override the data of a descriptor name that was introduced to the Pool via the add function. An EssentiaException will be thrown if the given descriptor name already exists in the pool and was put there via a call to an add function.
Parameters
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.

Referenced by PoolStorage< TokenType, StorageType >::addToPool().

◆ set() [2/5]

void set ( const std::string &  name,
const std::string &  value,
bool  validityCheck = false 
)

Sets the value of a descriptor name.

This function is different than the add functions because set does not append data to the existing data under a given descriptor name, it sets it. Thus there can only be one datum associated with a descriptor name introduced to the pool via the set function. This function is useful when there is only one value associated with a given descriptor name.

Parameters
nameis the descriptor name of the datum to set
valueis the datum to associate with name
Remarks
The set function cannot be used to override the data of a descriptor name that was introduced to the Pool via the add function. An EssentiaException will be thrown if the given descriptor name already exists in the pool and was put there via a call to an add function.
Parameters
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.

◆ set() [3/5]

void set ( const std::string &  name,
const std::vector< Real > &  value,
bool  validityCheck = false 
)

Sets the value of a descriptor name.

This function is different than the add functions because set does not append data to the existing data under a given descriptor name, it sets it. Thus there can only be one datum associated with a descriptor name introduced to the pool via the set function. This function is useful when there is only one value associated with a given descriptor name.

Parameters
nameis the descriptor name of the datum to set
valueis the datum to associate with name
Remarks
The set function cannot be used to override the data of a descriptor name that was introduced to the Pool via the add function. An EssentiaException will be thrown if the given descriptor name already exists in the pool and was put there via a call to an add function.
Parameters
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.

◆ set() [4/5]

void set ( const std::string &  name,
const std::vector< std::string > &  value,
bool  validityCheck = false 
)

Sets the value of a descriptor name.

This function is different than the add functions because set does not append data to the existing data under a given descriptor name, it sets it. Thus there can only be one datum associated with a descriptor name introduced to the pool via the set function. This function is useful when there is only one value associated with a given descriptor name.

Parameters
nameis the descriptor name of the datum to set
valueis the datum to associate with name
Remarks
The set function cannot be used to override the data of a descriptor name that was introduced to the Pool via the add function. An EssentiaException will be thrown if the given descriptor name already exists in the pool and was put there via a call to an add function.
Parameters
validityCheckindicates whether value should be checked for NaN or Inf values. If true, an exception is thrown if value is (or contains) a NaN or Inf.

◆ set() [5/5]

void set ( const std::string &  name,
const Tensor< Real > &  value,
bool  validityCheck = false 
)

◆ validateKey()

void validateKey ( const std::string &  name)
protected

helper function for key validation when adding/setting/merging values to the pool

◆ value()

const T& value ( const std::string &  name) const
Returns
a the data that is associated with name
Parameters
nameis the descriptor name that points to the data to return
Template Parameters
Tis the type of data that name points to

Member Data Documentation

◆ _poolArray2DReal

std::map<std::string, std::vector< TNT::Array2D<Real> > > _poolArray2DReal
protected

◆ _poolReal

std::map<std::string, std::vector< Real > > _poolReal
protected

Referenced by Pool::getRealPool().

◆ _poolSingleReal

std::map<std::string, Real> _poolSingleReal
protected

Referenced by Pool::getSingleRealPool().

◆ _poolSingleString

std::map<std::string, std::string> _poolSingleString
protected

◆ _poolSingleTensorReal

std::map<std::string, Tensor<Real> > _poolSingleTensorReal
protected

◆ _poolSingleVectorReal

std::map<std::string, std::vector<Real> > _poolSingleVectorReal
protected

◆ _poolSingleVectorString

std::map<std::string, std::vector<std::string> > _poolSingleVectorString
protected

◆ _poolStereoSample

std::map<std::string, std::vector< StereoSample > > _poolStereoSample
protected

◆ _poolString

std::map<std::string, std::vector< std::string > > _poolString
protected

Referenced by Pool::getStringPool().

◆ _poolTensorReal

std::map<std::string, std::vector< Tensor<Real> > > _poolTensorReal
protected

Referenced by Pool::getTensorRealPool().

◆ _poolVectorReal

std::map<std::string, std::vector< std::vector<Real> > > _poolVectorReal
protected

Referenced by Pool::getVectorRealPool().

◆ _poolVectorString

std::map<std::string, std::vector< std::vector<std::string> > > _poolVectorString
protected

◆ mutexArray2DReal

Mutex mutexArray2DReal

◆ mutexReal

Mutex mutexReal
mutable

◆ mutexSingleReal

Mutex mutexSingleReal

◆ mutexSingleString

Mutex mutexSingleString

◆ mutexSingleTensorReal

Mutex mutexSingleTensorReal

◆ mutexSingleVectorReal

Mutex mutexSingleVectorReal

◆ mutexSingleVectorString

Mutex mutexSingleVectorString

◆ mutexStereoSample

Mutex mutexStereoSample

◆ mutexString

Mutex mutexString

◆ mutexTensorReal

Mutex mutexTensorReal

◆ mutexVectorReal

Mutex mutexVectorReal

◆ mutexVectorString

Mutex mutexVectorString

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