attributePool Class Reference
[Attributes and attribute pools]

A class for graph attribute management. More...

#include <attributePool.h>


Public Types

enum  TAttributeType {
  ATTR_FULL_RANK = 0,
  ATTR_ALLOW_NULL = 1,
  ATTR_REQ_SINGLETON = 2
}

Public Member Functions

 attributePool (const TPoolTable *_table, TPoolEnum _dim, TAttributeType _poolType) throw ()
 attributePool (const attributePool &P) throw ()
 ~attributePool () throw ()
size_t Size () const throw ()
void Flush () throw ()
TPoolEnum ReadAttribute (goblinRootObject &, goblinImport &F) throw ()
void ReadPool (goblinRootObject &F, goblinImport &) throw ()
bool ReadStringAttribute (goblinImport &F, TPoolEnum token) throw (ERParse)
void WriteAttribute (const goblinRootObject &, goblinExport &F, TPoolEnum token, attributeBase *_attribute=NULL) const throw ()
void WritePool (const goblinRootObject &, goblinExport &F, const char *) const throw ()
void ExportAttributes (attributePool &P) const throw ()
template<typename T>
void ImportAttribute (attribute< T > &A, TPoolEnum token) throw ()
template<typename T>
attribute< T > * ImportArray (TPoolEnum token, const T *_value, size_t size) throw ()
template<typename T>
attribute< T > * MakeAttribute (goblinRootObject &X, TPoolEnum _token, TAttributeType attributeType, void *_value_ptr=NULL) throw ()
void ReleaseAttribute (TPoolEnum token) throw ()
template<typename T>
attribute< T > * GetAttribute (TPoolEnum token) const throw ()
template<typename T>
vector< T > * GetVector (TPoolEnum token) const throw ()
template<typename T>
T * GetArray (TPoolEnum token) const throw ()
template<typename T>
attribute< T > * InitAttribute (goblinRootObject &X, TPoolEnum token, T _value) throw ()
template<typename T>
vector< T > * InitVector (goblinRootObject &X, TPoolEnum token, T _value) throw ()
template<typename T>
T * InitArray (goblinRootObject &X, TPoolEnum token, T _value) throw ()
template<typename T>
attribute< T > * RawAttribute (goblinRootObject &X, TPoolEnum token) throw ()
template<typename T>
vector< T > * RawVector (goblinRootObject &X, TPoolEnum token) throw ()
template<typename T>
T * RawArray (goblinRootObject &X, TPoolEnum token) throw ()
void ReserveItems (TArrayDim attributeType, TIndex capacity) throw (ERRange)
void AppendItems (TArrayDim attributeType, TIndex numItems) throw ()
void EraseItems (TArrayDim attributeType, TIndex numItems) throw (ERRange)
void SwapItems (TArrayDim attributeType, TIndex i1, TIndex i2) throw (ERRange)
template<typename T>
GetValue (TPoolEnum token, TIndex i, T _default) const throw ()
template<typename T>
DefaultValue (TPoolEnum token, T _default) const throw ()
template<typename T>
MinValue (TPoolEnum token, T _default) const throw ()
template<typename T>
MaxValue (TPoolEnum token, T _default) const throw ()
template<typename T>
TIndex MinIndex (TPoolEnum token) const throw ()
template<typename T>
TIndex MaxIndex (TPoolEnum token) const throw ()
template<typename T>
bool IsConstant (TPoolEnum token) const throw ()

Protected Member Functions

attributeBaseFindAttribute (TPoolEnum token) const throw ()

Protected Attributes

const TPoolTabletable
const unsigned short dim
list< attributeBase * > attributes
list< TPoolEnumtokens
const TAttributeType poolType


Detailed Description

A class for graph attribute management.

The objects of this class are containers for attribute objects. The potentially contained attributes are specified by a TPoolTable[] array and a matching enum type.

Attribute pools manage the following:


Member Enumeration Documentation

enum TAttributeType
 

Specifies how many indices are represented by embedded attributes.

Enumerator:
ATTR_FULL_RANK  All referenced attributes have full rank.
ATTR_ALLOW_NULL  Referenced attributes have either full or zero rank.
ATTR_REQ_SINGLETON  Referenced attributes have either full rank or rank 1.


Constructor & Destructor Documentation

attributePool const TPoolTable _table,
TPoolEnum  _dim,
TAttributeType  _poolType
throw ()
 

Construct an attribute pool.

Parameters:
_table A pool table
_dim The number of records in this table
_poolType Specifies if zero size attributes are allowed

attributePool const attributePool P  )  throw ()
 

Copy constructor.

~attributePool  )  throw ()
 

Destruct an attribute pool.


Member Function Documentation

void AppendItems TArrayDim  attributeType,
TIndex  numItems
throw ()
 

Add numItems to all attributes of the specified type.

T DefaultValue TPoolEnum  token,
_default
const throw ()
 

Return the default attribute value.

void EraseItems TArrayDim  attributeType,
TIndex  numItems
throw (ERRange)
 

Delete numItems from all attributes of the specified type.

void ExportAttributes attributePool P  )  const throw ()
 

Copy all attributes into a specified attribute pool.

But only those attribute which are not associated with graph nodes, layout nodes or graph arcs.

attributeBase * FindAttribute TPoolEnum  token  )  const throw () [protected]
 

Lookup for the specified attribute.

void Flush  )  throw ()
 

Delete all attributes from this pool.

T * GetArray TPoolEnum  token  )  const throw ()
 

Export the array encapsulated into a pool attribute.

attribute< T > * GetAttribute TPoolEnum  token  )  const throw ()
 

Direct access to an attribute in this pool.

T GetValue TPoolEnum  token,
TIndex  i,
_default
const throw ()
 

Return the attribute value for a given index.

vector< T > * GetVector TPoolEnum  token  )  const throw ()
 

Export the vector encapsulated into a pool attribute.

attribute< T > * ImportArray TPoolEnum  token,
const T *  _value,
size_t  size
throw ()
 

Assign an attribute with a given sequence of values.

void ImportAttribute attribute< T > &  A,
TPoolEnum  token
throw ()
 

Copy an attribute into this attribute pool.

T * InitArray goblinRootObject X,
TPoolEnum  token,
_value
throw ()
 

Obtain a full rank array, initialized with a default value.

attribute< T > * InitAttribute goblinRootObject X,
TPoolEnum  token,
_value
throw ()
 

Obtain a full rank attribute, initialized with a default value.

vector< T > * InitVector goblinRootObject X,
TPoolEnum  token,
_value
throw ()
 

Obtain a full rank vector, initialized with a default value.

bool IsConstant TPoolEnum  token  )  const throw ()
 

Check if attribute values coincide for all indices.

attribute< T > * MakeAttribute goblinRootObject X,
TPoolEnum  _token,
TAttributeType  attributeType,
void *  _value_ptr = NULL
throw ()
 

Allocate a new attribute and add it to the pool.

Parameters:
X The data object to which the attributes belong
_token The index of the attribute in the pool table
attributeType Specifies the attribute rank
_value_ptr Either NULL or a pointer to the default value
Other than the InitAttribute() and RawAttribute() methods which result in full rank attributes, this operation supports constant attributes

TIndex MaxIndex TPoolEnum  token  )  const throw ()
 

Return an index at which the maximum attribute value is achieved.

T MaxValue TPoolEnum  token,
_default
const throw ()
 

Return the maximum attribute value.

TIndex MinIndex TPoolEnum  token  )  const throw ()
 

Return an index at which the minimum attribute value is achieved.

T MinValue TPoolEnum  token,
_default
const throw ()
 

Return the minimum attribute value.

T * RawArray goblinRootObject X,
TPoolEnum  token
throw ()
 

Obtain a full rank array without initialization.

attribute< T > * RawAttribute goblinRootObject X,
TPoolEnum  token
throw ()
 

Obtain a full rank attribute without initialization.

vector< T > * RawVector goblinRootObject X,
TPoolEnum  token
throw ()
 

Obtain a full rank vector without initialization.

TPoolEnum ReadAttribute goblinRootObject ,
goblinImport F
throw ()
 

Read pool data as a part of the graph object file representation.

void ReadPool goblinRootObject F,
goblinImport
throw ()
 

Read pool data as a part of the graph object file representation.

bool ReadStringAttribute goblinImport F,
TPoolEnum  token
throw (ERParse)
 

Read a string attribute as a part of the graph object file representation.

void ReleaseAttribute TPoolEnum  token  )  throw ()
 

Remove an attribute from the pool and deallocate it.

void ReserveItems TArrayDim  attributeType,
TIndex  capacity
throw (ERRange)
 

Set the capacity of all attributes of the specified type.

size_t Size  )  const throw ()
 

void SwapItems TArrayDim  attributeType,
TIndex  i1,
TIndex  i2
throw (ERRange)
 

Swap the specified items in all attributes of the specified type.

void WriteAttribute const goblinRootObject ,
goblinExport F,
TPoolEnum  token,
attributeBase _attribute = NULL
const throw ()
 

Write an attribute to s file.

void WritePool const goblinRootObject ,
goblinExport F,
const char * 
const throw ()
 

Write all pool data to file.


Field Documentation

list<attributeBase*> attributes [protected]
 

const unsigned short dim [protected]
 

const TAttributeType poolType [protected]
 

const TPoolTable* table [protected]
 

list<TPoolEnum> tokens [protected]