Detailed Description

template<class T>
class faudes::TBaseVector< T >

Vector template.

The vector templates specializes the bass vBaseVector in that it uses the template paremeter to specify the type of its entries. See vBaseVector for element access methods.

TVectorSet serves is used to implement the libFaudes vectors

  • GeneratorVector (vector or generators)
  • SytemVector (vector or generators)
  • EventSetVector (vector of event sets)
  • AlphabetVector (vector of event sets)

Definition at line 563 of file cfl_basevector.h.

#include <cfl_basevector.h>

Public Types

typedef std::vector< int >::size_type Position
 convenience typedef for positions More...
 
- Public Types inherited from faudes::vBaseVector
typedef size_t Position
 convenience typedef for positions (must be unsigned) More...
 

Public Member Functions

 TBaseVector (void)
 Constructor. More...
 
 TBaseVector (const TBaseVector &rOtherSet)
 Copy-constructor. More...
 
 TBaseVector (const vBaseVector &rOtherSet)
 Copy-constructor. More...
 
 TBaseVector (const std::string &rFilename, const std::string &rLabel="BaseVector")
 Constructor from file. More...
 
virtual ~TBaseVector (void)
 Virtual destructor. More...
 
virtual const T * Elementp (void) const
 Prototype for vector entries. More...
 
virtual bool ElementTry (const Type &rElement) const
 Test whether the specified element is acceptebla for this vector. More...
 
virtual const T & At (const Position &pos) const
 Access element. More...
 
virtual T & At (const Position &pos)
 Access element. More...
 
Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
- Public Member Functions inherited from faudes::vBaseVector
 vBaseVector (void)
 Constructor. More...
 
 vBaseVector (const vBaseVector &rOtherVector)
 Copy-constructor. More...
 
 vBaseVector (const std::string &rFilename, const std::string &rLabel="BaseVector")
 Constructor from file. More...
 
virtual ~vBaseVector (void)
 Virtual destructor. More...
 
virtual const TypeElement (void) const
 Prototype for vector entries. More...
 
virtual TypeNewElement (void)
 Factory method for vector entries. More...
 
const std::string & Name (void) const
 Return name of vBaseVector. More...
 
void Name (const std::string &rName)
 Set name of vBaseVector. More...
 
virtual void Clear (void)
 Clear all vector. More...
 
Idx Size (void) const
 Get size of vector. More...
 
void Size (Idx len)
 Set size of vector. More...
 
bool Empty (void) const
 Check if the vBaseVector ist Empty. More...
 
virtual void Replace (const Position &pos, const Type &rElem)
 Replace specified entry. More...
 
virtual void Replace (const Position &pos, Type *pElem)
 Replace specified entry. More...
 
virtual void Replace (const Position &pos, const std::string &rFileName)
 Replace specified entry. More...
 
virtual void Erase (const Position &pos)
 Erase entry by position. More...
 
virtual void Insert (const Position &pos, const Type &rElem)
 Insert specified entry. More...
 
virtual void Insert (const Position &pos, Type *rElem)
 Insert specified entry. More...
 
virtual void Insert (const Position &pos, const std::string &rFileName)
 Insert specified entry. More...
 
virtual void PushBack (const Type &rElem)
 Append specified entry. More...
 
virtual void PushBack (Type *rElem)
 Append specified entry. More...
 
virtual void PushBack (const std::string &rFileName)
 Append specified entry. More...
 
virtual void Append (const Type &rElem)
 Append specified entry. More...
 
virtual void Append (Type *rElem)
 Append specified entry. More...
 
virtual void Append (const std::string &rFileName)
 Append specified entry. More...
 
void FilenameAt (const Position &pos, const std::string &rFileName)
 Specify a filename. More...
 
const std::string & FilenameAt (const Position &pos) const
 Get filename of entry. More...
 
void TakeOwnership (void)
 Take ownership of all entries. More...
 
void TakeCopies (void)
 Take local copies of all entries. More...
 
Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 Constructor. More...
 
 Type (const Type &rType)
 Copy constructor. More...
 
virtual ~Type (void)
 Destructor. More...
 
virtual TypeNew (void) const
 Construct on heap. More...
 
virtual TypeCopy (void) const
 Construct on heap. More...
 
virtual const TypeCast (const Type *pOther) const
 Cast other object to this type. More...
 
virtual TypeAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual const std::string & TypeName (void) const
 Get objects's type name. More...
 
void Write (const Type *pContext=0) const
 Write configuration data to console. More...
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file. More...
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 Write configuration data to a file. More...
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to TokenWriter. More...
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to an XML file. More...
 
void XWrite (const Type *pContext=0) const
 Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in XML format to TokenWriter. More...
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a string. More...
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a formated string. More...
 
void DWrite (const Type *pContext=0) const
 Write configuration data to console, debugging format. More...
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 Write configuration data to a file, debugging format. More...
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debug format to TokenWriter. More...
 
void SWrite (TokenWriter &rTw) const
 Write statistics comment to TokenWriter. More...
 
void SWrite (void) const
 Write statistics comment to console. More...
 
std::string ToSText (void) const
 Write statistics to a string. More...
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from file with label specified. More...
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from a string. More...
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from TokenReader with label sepcified. More...
 

Protected Member Functions

void DoAssign (const TBaseVector< T > &rSourceVector)
 Assignment method
More...
 
- Protected Member Functions inherited from faudes::vBaseVector
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Token output, debugging see Type::DWrite for public wrappers. More...
 
virtual void DoSWrite (TokenWriter &rTw) const
 Token output, see Type::SWrite for public wrappers. More...
 
virtual void DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Token output, see Type::Write for public wrappers. More...
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Token input, see Type::Read for public wrappers. More...
 
void DoAssign (const vBaseVector &rSourceVector)
 Assignment method
More...
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
bool DoEqual (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter in XML format. More...
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 Get objects's type definition. More...
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Additional Inherited Members

- Protected Types inherited from faudes::vBaseVector
typedef std::vector< ElementRecord >::iterator iterator
 convenience typedef More...
 
- Protected Attributes inherited from faudes::vBaseVector
std::vector< ElementRecordmVector
 STL vector of element. More...
 

Member Typedef Documentation

◆ Position

template<class T >
typedef std::vector<int>::size_type faudes::TBaseVector< T >::Position

convenience typedef for positions

Definition at line 636 of file cfl_basevector.h.

Constructor & Destructor Documentation

◆ TBaseVector() [1/4]

template<class T >
faudes::TBaseVector< T >::TBaseVector ( void  )

Constructor.

Definition at line 693 of file cfl_basevector.h.

◆ TBaseVector() [2/4]

template<class T >
faudes::TBaseVector< T >::TBaseVector ( const TBaseVector< T > &  rOtherSet)

Copy-constructor.

Parameters
rOtherSetSource to copy from

Definition at line 711 of file cfl_basevector.h.

◆ TBaseVector() [3/4]

template<class T >
faudes::TBaseVector< T >::TBaseVector ( const vBaseVector rOtherSet)

Copy-constructor.

This version takes any vector as source, but throughs an exception, if element types dont match.

Parameters
rOtherSetSource to copy from
Exceptions
Exception
  • Cannot cast elements (63)

Definition at line 719 of file cfl_basevector.h.

◆ TBaseVector() [4/4]

template<class T >
faudes::TBaseVector< T >::TBaseVector ( const std::string &  rFilename,
const std::string &  rLabel = "BaseVector" 
)

Constructor from file.

Parameters
rFilenameName of File
rLabelSection for the set in the file;

Definition at line 701 of file cfl_basevector.h.

◆ ~TBaseVector()

template<class T >
faudes::TBaseVector< T >::~TBaseVector ( void  )
virtual

Virtual destructor.

Definition at line 727 of file cfl_basevector.h.

Member Function Documentation

◆ At() [1/2]

template<class T >
T & faudes::TBaseVector< T >::At ( const Position pos)
virtual

Access element.

Parameters
posSpecify entry to access
Exceptions
Exception
  • Position out of range (id 69)

Reimplemented from faudes::vBaseVector.

Definition at line 774 of file cfl_basevector.h.

◆ At() [2/2]

template<class T >
const T & faudes::TBaseVector< T >::At ( const Position pos) const
virtual

Access element.

Parameters
posSpecify entry to access
Exceptions
Exception
  • Position out of range (id 69)

Reimplemented from faudes::vBaseVector.

Definition at line 755 of file cfl_basevector.h.

◆ DoAssign()

template<class T >
void faudes::TBaseVector< T >::DoAssign ( const TBaseVector< T > &  rSourceVector)
protected

Assignment method

Definition at line 746 of file cfl_basevector.h.

◆ Elementp()

template<class T >
const T * faudes::TBaseVector< T >::Elementp ( void  ) const
virtual

Prototype for vector entries.

This template class uses the virtual function to know its element type.

Returns
Element protoype

Reimplemented from faudes::vBaseVector.

Definition at line 733 of file cfl_basevector.h.

◆ ElementTry()

template<class T >
bool faudes::TBaseVector< T >::ElementTry ( const Type rElement) const
virtual

Test whether the specified element is acceptebla for this vector.

This is a convenience wrapper for Elementp.

Parameters
rElementElement to type check.
Returns
True, if provided element is accepted by this vector.

Reimplemented from faudes::vBaseVector.

Definition at line 739 of file cfl_basevector.h.

◆ operator!=()

template<class T >
bool faudes::Type::operator!=

Test equality of configuration data.

See operator==(const Type&).

This method calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters
rOtherOther objevt to compare with.
Returns
True on mismatch.

Definition at line 83 of file cfl_types.cpp.

◆ operator=()

template<class T >
Type & faudes::Type::operator=

Assign configurationdata from other object.

Derived classes should implement the operator form for the assignment for each source type which allows for a non-trivial assignment. This includes the particular case were the source and destination types match exactly. In the latter case the DoAssign method should be invoked. In contrast to the Assign function, the operator form must not be reimplemented for missmatched source types: the operator form only accepts sensible source types. This allows for compiletime typeckecking. However, the downside is that when the type is not known at compiletime, configuration is not properly assigned.

Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters
rSrcSource to copy from
Returns
Reference to this object.

Definition at line 81 of file cfl_types.cpp.

◆ operator==()

template<class T >
bool faudes::Type::operator==

Test equality of configuration data.

The operator form of the equality test is only defined for matching types, no cast will be performed. Thus, the test will be optimistic if the type is not known at compiletime. The object name or id is not considered in the test.

This methoc calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.

Parameters
rOtherOther object to compare with.
Returns
True on match.

Definition at line 82 of file cfl_types.cpp.


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

libFAUDES 2.32f --- 2024.12.22 --- c++ api documentaion by doxygen