Public Types | Public Member Functions | Static Public Member Functions

data_container< KeyType, DataType, ObjectType > Class Template Reference

The central container class holding the data. Uses the singleton pattern for a particular key, value and object type triple. More...

#include <data_container.hpp>

Public Types

typedef
traits::data_type_reference
< DataType, container_type >
::type 
reference

Public Member Functions

reference access (ObjectType const &obj, KeyType const &key)
 Accesses data for object 'obj' stored at key 'key' using a full key dispatch (object and type). Used internally only, use viennadata::access() instead.
reference access (ObjectType const &obj)
 Accesses data for object 'obj' stored at key 'key' using a type based key dispatch. Used internally only, use viennadata::access() instead.
template<typename ObjectDestType >
void copy (ObjectType const &obj_src, ObjectDestType const &obj_dest)
 Copy data from one object to another. This is the first stage of the process. Called via viennadata::copy().
template<typename ContainerSrcType , typename ObjectSrcType >
void copy (ContainerSrcType &cont_src, ObjectSrcType const &obj_src, ObjectType const &obj_dest)
 Copy data from one object to another. This is the second stage of the process. Called via viennadata::copy().
void erase (ObjectType const &obj, KeyType const &key)
 Erases data stored for a particular key. Called via viennadata::erase().
void erase (ObjectType const &obj)
 Erases all data stored the particular key type. Called via viennadata::erase().
void reserve (long num)
 Reserves memory for data associated with up to 'num' objects. Object IDs have to be in the range 0...(num-1).
DataType * find (ObjectType const &obj, KeyType const &key)
 Checks whether data for a particular object with a particular key is already stored.
DataType * find (ObjectType const &obj)
 Checks whether data for a particular object with a particular key is already stored.

Static Public Member Functions

static data_containerinstance ()
 Returns the only instance of data_container (Singleton Pattern).

Detailed Description

template<typename KeyType, typename DataType, typename ObjectType>
class viennadata::data_container< KeyType, DataType, ObjectType >

The central container class holding the data. Uses the singleton pattern for a particular key, value and object type triple.

Template Parameters:
KeyType The type of the key used for access
DataType Type of the data that is stored for the element
ObjectType The type of the object the data is associated with

Member Typedef Documentation

typedef traits::data_type_reference<DataType, container_type>::type reference

Member Function Documentation

reference access ( ObjectType const &  obj,
KeyType const &  key 
) [inline]

Accesses data for object 'obj' stored at key 'key' using a full key dispatch (object and type). Used internally only, use viennadata::access() instead.

reference access ( ObjectType const &  obj  )  [inline]

Accesses data for object 'obj' stored at key 'key' using a type based key dispatch. Used internally only, use viennadata::access() instead.

void copy ( ObjectType const &  obj_src,
ObjectDestType const &  obj_dest 
) [inline]

Copy data from one object to another. This is the first stage of the process. Called via viennadata::copy().

Parameters:
obj_src The source object
obj_dest The destination object
void copy ( ContainerSrcType &  cont_src,
ObjectSrcType const &  obj_src,
ObjectType const &  obj_dest 
) [inline]

Copy data from one object to another. This is the second stage of the process. Called via viennadata::copy().

Parameters:
cont_src The container of the source object
obj_src The source object
obj_dest The destination object
void erase ( ObjectType const &  obj  )  [inline]

Erases all data stored the particular key type. Called via viennadata::erase().

Parameters:
obj The object for which data should be deleted
void erase ( ObjectType const &  obj,
KeyType const &  key 
) [inline]

Erases data stored for a particular key. Called via viennadata::erase().

Parameters:
obj The object for which data should be deleted
key The key the data is associated with
DataType* find ( ObjectType const &  obj,
KeyType const &  key 
) [inline]

Checks whether data for a particular object with a particular key is already stored.

Returns:
Returns NULL if no data is found, otherwise returns a pointer to the data
DataType* find ( ObjectType const &  obj  )  [inline]

Checks whether data for a particular object with a particular key is already stored.

Returns:
Returns NULL if no data is found, otherwise returns a pointer to the data
static data_container& instance (  )  [inline, static]

Returns the only instance of data_container (Singleton Pattern).

void reserve ( long  num  )  [inline]

Reserves memory for data associated with up to 'num' objects. Object IDs have to be in the range 0...(num-1).


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