Main Page   Class Hierarchy   Compound List   Compound Members  

SCOREC_Attribute::Attribute Class Template Reference

#include <Attribute.h>

Inheritance diagram for SCOREC_Attribute::Attribute::

SCOREC_Attribute::AttributeBase List of all members.

Public Types

typedef T value_type
typedef std::vector<variant_t> container
typedef container::const_iterator constIter

Public Methods

 Attribute (const std::string &name, const std::vector< variant_t >::const_iterator &it1, const std::vector< variant_t >::const_iterator &it2)
 Constructor. Construct by giving the attribute name and two iterators that iterate over the values that this attribute is supposed to have.

 Attribute (const std::string &name, variant_t)
 Use this constructor if the Attribute has only one component.

 Attribute (const std::string &name, const T &)
 If we have only one value we want to store, and the value is exactly the type of attribute we don't have to go through the construction of a variant_t type first, we can pass in the value directly. Note: That will not work if the type we want to store is e.g. a double, but given as an expression. In that case the attribute is templated over double, but a string is parsed in. The we have to create the variant_t object from the string and pass that in.

void CreateOutput (std::vector< std::string > &v) const
std::string getCreator () const
virtual ~Attribute ()
void DumpDiagnostics () const
 DumpDiagnostics() dumps the object's state to standard output.


Public Attributes

container values

Detailed Description

template<typename T, typename StorageHandler> class SCOREC_Attribute::Attribute

Attribute class. Represents attributes that can be stored in the AttributeManager by associating them with the model name, attribute name, model entity tag and the dimension of the entity. The attribute class is being templated over the object that is supposed to be attributed with the model entity. The constructor will accept a pair of iterators specifying a range of pointers to variant_t objects. The variant_t object can contain different types (int, double or string). If a string is encountered in an attribute that is not of type string (e.g. AttributeInt) it will considered to be an expression and evaluated when accessed by dereferencing the AttributeIterator object. The second template parameter specifies a class that knows how to write and read the attribute to/from a source (file, database etc.) See file DoubleValuedToFromFile as an example. The requirements for the class that is passed in as the second template parameter are: 1. provide a static function create that takes in a vector of strings and returns a pointer to an Attribute. 2. provide a static function createOutput that takes in a vector of strings and a pointer to the Attribute. The function has to convert the attribute information into strings stored in the vector in a way that it can later on recreate the attribute by means of the same string. 3. provide a static string ID as the type identifier. That string will be used by the AttributeFactory to construct the attribute. 4. throw a runtime exception (std::runtime_error(error)) if an error occurs during the construction of the attribute. The string "error" should explain what type of error occured.


The documentation for this class was generated from the following file:
Generated at Mon Jul 23 10:23:24 2001 for SCOREC_UnitSystem by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001