| |
libFAUDES
Sections
Index
|
faudes::TBaseVector< T > Class Template Reference |
Public Types | |
typedef std::vector< int > ::size_type | Position |
convenience typedef for positions | |
Public Member Functions | |
virtual TBaseVector * | New (void) const |
Construct on heap. | |
virtual TBaseVector * | Copy (void) const |
Construct on heap. | |
virtual const TBaseVector * | Cast (const Type *pOther) const |
Cast other object to this type. | |
virtual TBaseVector & | Assign (const Type &rSrc) |
Assign configuration data from other object. | |
virtual bool | Equal (const Type &rOther) const |
Test equality of configuration data. | |
virtual TBaseVector & | operator= (const TBaseVector &rSrc) |
virtual bool | operator== (const TBaseVector &rOther) const |
virtual bool | operator!= (const TBaseVector &rOther) const |
TBaseVector (void) | |
Constructor. | |
TBaseVector (const TBaseVector &rOtherSet) | |
Copy-constructor. | |
TBaseVector (const std::string &rFilename, const std::string &rLabel="BaseVector") | |
Constructor from file. | |
virtual | ~TBaseVector (void) |
Virtual destructor. | |
const std::string & | Name (void) const |
Return name of TBaseVector. | |
void | Name (const std::string &rName) |
Set name of TBaseVector. | |
virtual void | Clear (void) |
Clear all vector. | |
Idx | Size (void) const |
Get size of vector. | |
void | Size (Idx len) |
Set size of vector. | |
bool | Empty (void) const |
Check if the TBaseVector ist Empty. | |
virtual const T & | At (const Position &pos) const |
Access elemend. | |
virtual T & | At (const Position &pos) |
Access elemend. | |
virtual void | Replace (const Position &pos, const T &rElem) |
Replace specified entry. | |
virtual void | Replace (const Position &pos, T *pElem) |
Replace specified entry. | |
virtual void | Replace (const Position &pos, const std::string &rFileName) |
Replace specified entry. | |
virtual void | Erase (const Position &pos) |
Erase entry by position. | |
virtual void | Insert (const Position &pos, const T &rElem) |
Insert specified entry. | |
virtual void | Insert (const Position &pos, T *rElem) |
Insert specified entry. | |
virtual void | Insert (const Position &pos, const std::string &rFileName) |
Insert specified entry. | |
virtual void | PushBack (const T &rElem) |
Append specified entry. | |
virtual void | PushBack (T *rElem) |
Append specified entry. | |
virtual void | PushBack (const std::string &rFileName) |
Append specified entry. | |
virtual void | Append (const T &rElem) |
Append specified entry. | |
virtual void | Append (T *rElem) |
Append specified entry. | |
virtual void | Append (const std::string &rFileName) |
Append specified entry. | |
void | FilenameAt (const Position &pos, const std::string &rFileName) |
Specify a filename. | |
const std::string & | FilenameAt (const Position &pos) const |
Get filename of entry. | |
void | TakeOwnership (void) |
Take ownership of all entries. | |
void | TakeCopies (void) |
Take local copies of all entries. | |
Protected Types | |
typedef std::vector< Element > ::iterator | iterator |
convenience typedef | |
Protected Member Functions | |
virtual void | DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Token output, debugging see Type::DWrite for public wrappers. | |
virtual void | DoSWrite (TokenWriter &rTw) const |
Token output, see Type::SWrite for public wrappers. | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Token output, see Type::Write for public wrappers. | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Token input, see Type::Read for public wrappers. | |
virtual TBaseVector & | DoAssign (const TBaseVector< T > &rSourceVector) |
Assignment method. | |
Protected Attributes | |
std::vector< Element > | mVector |
STL vector of element. | |
Private Attributes | |
std::string | mMyName |
Name of TBaseVector. | |
Classes | |
class | Element |
Internal entry data type. More... |
typedef std::vector<int>::size_type faudes::TBaseVector< T >::Position |
typedef std::vector<Element>::iterator faudes::TBaseVector< T >::iterator [protected] |
faudes::TBaseVector< T >::TBaseVector | ( | void | ) | [inline] |
faudes::TBaseVector< T >::TBaseVector | ( | const TBaseVector< T > & | rOtherSet | ) | [inline] |
Copy-constructor.
rOtherSet | Source to copy from |
Definition at line 525 of file basevector.h.
faudes::TBaseVector< T >::TBaseVector | ( | const std::string & | rFilename, | |
const std::string & | rLabel = "BaseVector" | |||
) | [inline] |
Constructor from file.
rFilename | Name of File | |
rLabel | Section for the set in the file; |
Definition at line 513 of file basevector.h.
faudes::TBaseVector< T >::~TBaseVector | ( | void | ) | [inline, virtual] |
TBaseVector< T > * faudes::TBaseVector< T >::New | ( | void | ) | const [inline, virtual] |
Construct on heap.
Technically not a constructor, this function creates an object with the same type Type. New() is defined as a virtual function and derived classes are meant to re-implement with the appropiate constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.
Reimplemented from faudes::Type.
Definition at line 499 of file basevector.h.
TBaseVector< T > * faudes::TBaseVector< T >::Copy | ( | void | ) | const [inline, virtual] |
Construct on heap.
Technically not a constructor, this function creates an object with the same type Type and the same configuration. Copy() is defined as a virtual function and derived classes are meant to re-implement with the appropiate copy constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.
Reimplemented from faudes::Type.
Definition at line 499 of file basevector.h.
const TBaseVector< T > * faudes::TBaseVector< T >::Cast | ( | const Type * | pOther | ) | const [inline, virtual] |
Cast other object to this type.
Enables the run-time interface to test whether pObject is derived from this object. This feature is used e.g. in the faudes container classes to test attributes. Derived classes must reimplement this function using the appropriate dynamic cast.
Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
Reimplemented from faudes::Type.
Definition at line 499 of file basevector.h.
TBaseVector< T > & faudes::TBaseVector< T >::Assign | ( | const Type & | rSrc | ) | [inline, virtual] |
Assign configuration data from other object.
Derived classes should reimplement this method to first try to cast the source to the respective class. If successful, the protected function DoAssign is invoked to perform the actual assignment. If the cast fails, the Assign method of the parent class is called. Thus, faudes objects are up- and downcatsted for assignment, maintaining as much of the source data as digestable by the destination object. On the downside, there is no sensible typechecking at compile-time.
Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
rSrc | Source to copy from |
Reimplemented from faudes::Type.
Definition at line 499 of file basevector.h.
bool faudes::TBaseVector< T >::Equal | ( | const Type & | rOther | ) | const [inline, virtual] |
Test equality of configuration data.
Derived classes should reimplement this method to return true if both actual types and configuration data match. The object name is not consired in the test.
This method calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
rOther | Other objevt to compare with. |
Reimplemented from faudes::Type.
Definition at line 499 of file basevector.h.
TBaseVector< T > & faudes::TBaseVector< T >::operator= | ( | const TBaseVector< T > & | rSrc | ) | [inline, virtual] |
Definition at line 499 of file basevector.h.
bool faudes::TBaseVector< T >::operator== | ( | const TBaseVector< T > & | rOther | ) | const [inline, virtual] |
Definition at line 499 of file basevector.h.
bool faudes::TBaseVector< T >::operator!= | ( | const TBaseVector< T > & | rOther | ) | const [inline, virtual] |
Definition at line 499 of file basevector.h.
const std::string & faudes::TBaseVector< T >::Name | ( | void | ) | const [inline, virtual] |
Return name of TBaseVector.
Reimplemented from faudes::Type.
Definition at line 575 of file basevector.h.
void faudes::TBaseVector< T >::Name | ( | const std::string & | rName | ) | [inline, virtual] |
Set name of TBaseVector.
rName | Name to set |
Reimplemented from faudes::Type.
Definition at line 580 of file basevector.h.
void faudes::TBaseVector< T >::Clear | ( | void | ) | [inline, virtual] |
Idx faudes::TBaseVector< T >::Size | ( | void | ) | const [inline] |
void faudes::TBaseVector< T >::Size | ( | Idx | len | ) | [inline] |
Set size of vector.
If the new size is smaller than the current size, the vector is truncated. If it is larger, default members are inserted at the end.
len | Number of entries in vector |
Definition at line 590 of file basevector.h.
bool faudes::TBaseVector< T >::Empty | ( | void | ) | const [inline] |
Check if the TBaseVector ist Empty.
Definition at line 611 of file basevector.h.
const T & faudes::TBaseVector< T >::At | ( | const Position & | pos | ) | const [inline, virtual] |
Access elemend.
pos | Specify entry to access |
Exception |
|
Definition at line 617 of file basevector.h.
T & faudes::TBaseVector< T >::At | ( | const Position & | pos | ) | [inline, virtual] |
Access elemend.
pos | Specify entry to access |
Exception |
|
Definition at line 629 of file basevector.h.
void faudes::TBaseVector< T >::Replace | ( | const Position & | pos, | |
const T & | rElem | |||
) | [inline, virtual] |
Replace specified entry.
This method takes a copy of the entry to replace and the vector becomes the owner of the copy.
pos | Position to replace | |
rElem | New entry |
Exception |
|
Definition at line 643 of file basevector.h.
void faudes::TBaseVector< T >::Replace | ( | const Position & | pos, | |
T * | pElem | |||
) | [inline, virtual] |
Replace specified entry.
This method avoids to copy the entry to replace and only records the reference. The vector does not take ownership of the new entry. I.e., when the vector is destroyed, or the entry is deleted from the vector, the entry itself remains allocated.
pos | Position to replace | |
pElem | New entry |
Exception |
|
Definition at line 659 of file basevector.h.
void faudes::TBaseVector< T >::Replace | ( | const Position & | pos, | |
const std::string & | rFileName | |||
) | [inline, virtual] |
Replace specified entry.
This method reads the sepcified entry from file and the vector becomes the owner of the new entry.
pos | Position to replace | |
rFileName | New entry to be read from file |
Exception |
|
Definition at line 675 of file basevector.h.
void faudes::TBaseVector< T >::Erase | ( | const Position & | pos | ) | [inline, virtual] |
Erase entry by position.
If the vector owns the entry, it will be destructed.
pos | Specify entry to erase |
Exception |
|
Definition at line 692 of file basevector.h.
void faudes::TBaseVector< T >::Insert | ( | const Position & | pos, | |
const T & | rElem | |||
) | [inline, virtual] |
Insert specified entry.
This method takes a copy of the entry to replace and the vector becomes the owner of the copy.
pos | Position at which to insert | |
rElem | Element to insert |
Exception |
|
Definition at line 707 of file basevector.h.
void faudes::TBaseVector< T >::Insert | ( | const Position & | pos, | |
T * | rElem | |||
) | [inline, virtual] |
Insert specified entry.
This method avoids to copy the entry to replace and only records the reference. The vector does not take ownership of the new entry. I.e., when the vector is destroyed, or the entry is deleted from the vector, the entry itself remains allocated.
pos | Position at which to insert | |
rElem | Element to insert |
Exception |
|
Definition at line 724 of file basevector.h.
void faudes::TBaseVector< T >::Insert | ( | const Position & | pos, | |
const std::string & | rFileName | |||
) | [inline, virtual] |
Insert specified entry.
This method reads the sepcified entry from file and the vector becomes the owner of the new entry.
pos | Position at which to insert | |
rFileName | Element to insert |
Exception |
|
Definition at line 741 of file basevector.h.
void faudes::TBaseVector< T >::PushBack | ( | const T & | rElem | ) | [inline, virtual] |
Append specified entry.
This method takes a copy of the entry to replace and the vector becomes the owner of the copy.
rElem | Element to append |
Definition at line 760 of file basevector.h.
void faudes::TBaseVector< T >::PushBack | ( | T * | rElem | ) | [inline, virtual] |
Append specified entry.
This method avoids to copy the entry to replace and only records the reference. The vector does not take ownership of the new entry. I.e., when the vector is destroyed, or the entry is deleted from the vector, the entry itself remains allocated.
rElem | Element to insert |
Definition at line 769 of file basevector.h.
void faudes::TBaseVector< T >::PushBack | ( | const std::string & | rFileName | ) | [inline, virtual] |
Append specified entry.
This method reads the sepcified entry from file and the vector becomes the owner of the new entry.
rFileName | Element to insert |
Definition at line 778 of file basevector.h.
void faudes::TBaseVector< T >::Append | ( | const T & | rElem | ) | [inline, virtual] |
Append specified entry.
Synonymous for PushBack. This method takes a copy of the entry to replace and the vector becomes the owner of the copy.
rElem | Element to append |
Definition at line 789 of file basevector.h.
void faudes::TBaseVector< T >::Append | ( | T * | rElem | ) | [inline, virtual] |
Append specified entry.
Synonymous for PushBack. This method avoids to copy the entry to replace and only records the reference. The vector does not take ownership of the new entry. I.e., when the vector is destroyed, or the entry is deleted from the vector, the entry itself remains allocated.
rElem | Element to insert |
Definition at line 794 of file basevector.h.
void faudes::TBaseVector< T >::Append | ( | const std::string & | rFileName | ) | [inline, virtual] |
Append specified entry.
Synonymous for PushBack. This method reads the sepcified entry from file and the vector becomes the owner of the new entry.
rFileName | Element to insert |
Definition at line 799 of file basevector.h.
void faudes::TBaseVector< T >::FilenameAt | ( | const Position & | pos, | |
const std::string & | rFileName | |||
) | [inline] |
Specify a filename.
When each entry has a filenam specified, file io of the vector will be to indivudual files.
pos | Position of entry | |
rFileName | Filename relative to vector file |
Exception |
|
Definition at line 817 of file basevector.h.
const std::string & faudes::TBaseVector< T >::FilenameAt | ( | const Position & | pos | ) | const [inline] |
Get filename of entry.
pos | Position of entry |
Exception |
|
Definition at line 805 of file basevector.h.
void faudes::TBaseVector< T >::TakeOwnership | ( | void | ) | [inline] |
Take ownership of all entries.
Thsi method will take ownership of all entries, including those, that have been set by pointer reference. When the vector is destructed, all entries will be destructed, too. However, write access may invalidate element pointers.
Definition at line 839 of file basevector.h.
void faudes::TBaseVector< T >::TakeCopies | ( | void | ) | [inline] |
Take local copies of all entries.
This method will construct local copies of all entries not previously owned.
Definition at line 829 of file basevector.h.
void faudes::TBaseVector< T >::DoDWrite | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [inline, protected, virtual] |
Token output, debugging see Type::DWrite for public wrappers.
The method assumes that the type parameter is a faudes type and uses the provide write method per entry. Reimplement this function in derived classes for non-faudes type vectors.
rTw | Reference to TokenWriter | |
rLabel | Label of section to write, defaults to name of set | |
pContext | Write context to provide contextual information |
Reimplemented from faudes::Type.
Definition at line 877 of file basevector.h.
void faudes::TBaseVector< T >::DoSWrite | ( | TokenWriter & | rTw | ) | const [inline, protected, virtual] |
Token output, see Type::SWrite for public wrappers.
The method assumes that the type parameter is a faudes type and uses the provide write method per entry. Reimplement this function in derived classes for non-faudes type vectors.
rTw | Reference to TokenWriter |
Exception |
|
Reimplemented from faudes::Type.
Definition at line 890 of file basevector.h.
void faudes::TBaseVector< T >::DoWrite | ( | TokenWriter & | rTw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [inline, protected, virtual] |
Token output, see Type::Write for public wrappers.
The method assumes that the type parameter is a faudes type and uses the provide write method per entry. Reimplement this function in derived classes for non-faudes type vectors.
rTw | Reference to TokenWriter | |
rLabel | Label of section to write, defaults to name of set | |
pContext | Write context to provide contextual information |
Reimplemented from faudes::Type.
Definition at line 846 of file basevector.h.
void faudes::TBaseVector< T >::DoRead | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [inline, protected, virtual] |
Token input, see Type::Read for public wrappers.
The method assumes that the type parameter is a faudes type and uses the provide read method per entry. Reimplement this function in derived classes for non-faudes type vectors. By convention, the default label "" should be translated to some meaningful default, eg "GeneratorVector" for a vector of generators. The pContext pointer can be type-checked and interpreted, ie as a symboltable to provide symbolic names. It is also passed on to vector entries.
rTr | Reference to TokenReader | |
rLabel | Label of section to read, defaults to name of set | |
pContext | Read context to provide contextual information |
Reimplemented from faudes::Type.
Definition at line 902 of file basevector.h.
TBaseVector< T > & faudes::TBaseVector< T >::DoAssign | ( | const TBaseVector< T > & | rSourceVector | ) | [inline, protected, virtual] |
std::vector<Element> faudes::TBaseVector< T >::mVector [protected] |
std::string faudes::TBaseVector< T >::mMyName [private] |
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6