All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
te::dt::CompositeData Class Reference

A base class for composite data values. More...

#include <CompositeData.h>

Inheritance diagram for te::dt::CompositeData:
te::dt::AbstractData

Public Member Functions

void add (const std::string &name, AbstractData *value)
 
void add (AbstractData *value)
 It adds the value as the last component of the composite data. More...
 
AbstractDataclone () const
 It creates a new clone of the composite. More...
 
 CompositeData ()
 Constructor. More...
 
 CompositeData (std::size_t nComponents)
 It prepares the internal container for at least nComponents. More...
 
 CompositeData (const std::string &name)
 
 CompositeData (const CompositeData &rhs)
 Copy constructor. More...
 
int getTypeCode () const
 It returns the associated data type code. More...
 
AbstractDatagetValue (std::size_t i) const
 It returns the i-th component value of the composite data. More...
 
CompositeDataoperator= (const CompositeData &rhs)
 Copy constructor. More...
 
void setName (const std::string &name)
 
void setValue (std::size_t i, AbstractData *value)
 It sets the i-th component value of the composite data. More...
 
std::string toString () const
 It returns the data value in a string representation. More...
 
 ~CompositeData ()
 Destructor. More...
 

Private Attributes

std::string m_name
 The composite name. More...
 
std::vector< std::string > m_names
 The component names. More...
 
std::vector< AbstractData * > m_values
 The component values. More...
 

Detailed Description

A base class for composite data values.

See also
AbstractData, DataType, ByteArray, DateTime, SimpleData

Definition at line 49 of file CompositeData.h.

Constructor & Destructor Documentation

te::dt::CompositeData::CompositeData ( )
inline

Constructor.

Definition at line 54 of file CompositeData.h.

te::dt::CompositeData::CompositeData ( std::size_t  nComponents)

It prepares the internal container for at least nComponents.

Parameters
nComponentsThe number of expected components for the composite.

Definition at line 34 of file CompositeData.cpp.

te::dt::CompositeData::CompositeData ( const std::string &  name)

Definition at line 40 of file CompositeData.cpp.

te::dt::CompositeData::CompositeData ( const CompositeData rhs)

Copy constructor.

Parameters
rhsThe right-hand-side composite.

Definition at line 45 of file CompositeData.cpp.

References te::common::Clone(), and m_values.

te::dt::CompositeData::~CompositeData ( )

Destructor.

Definition at line 51 of file CompositeData.cpp.

References te::common::FreeContents().

Member Function Documentation

void te::dt::CompositeData::add ( const std::string &  name,
AbstractData value 
)

Definition at line 77 of file CompositeData.cpp.

void te::dt::CompositeData::add ( AbstractData value)

It adds the value as the last component of the composite data.

Parameters
valueThe component value at the specified index. If there is another component at the specified index it will be released.
Note
The component index is 0-based!

Definition at line 95 of file CompositeData.cpp.

te::dt::AbstractData * te::dt::CompositeData::clone ( ) const
virtual

It creates a new clone of the composite.

Returns
A new clone of the composite. The caller will take its ownership.

Implements te::dt::AbstractData.

Definition at line 100 of file CompositeData.cpp.

int te::dt::CompositeData::getTypeCode ( ) const
inlinevirtual

It returns the associated data type code.

Returns
The associated data type code.

Implements te::dt::AbstractData.

Definition at line 132 of file CompositeData.h.

References te::dt::COMPOSITE_TYPE.

te::dt::AbstractData * te::dt::CompositeData::getValue ( std::size_t  i) const

It returns the i-th component value of the composite data.

Parameters
iThe position index of the component.
Returns
The i-th component value. The caller will not take the ownership of the returned pointer.
Note
The component index is 0-based!

Definition at line 83 of file CompositeData.cpp.

te::dt::CompositeData & te::dt::CompositeData::operator= ( const CompositeData rhs)

Copy constructor.

Parameters
rhsThe right-hand-side composite.
Returns
A reference to this composite.

Definition at line 56 of file CompositeData.cpp.

References te::common::Clone(), te::common::FreeContents(), m_names, and m_values.

void te::dt::CompositeData::setName ( const std::string &  name)

Definition at line 72 of file CompositeData.cpp.

void te::dt::CompositeData::setValue ( std::size_t  i,
AbstractData value 
)

It sets the i-th component value of the composite data.

Parameters
iThe position index of the component.
valueThe component value at the specified index. If there is another component at the specified index it will be released.
Note
The component index is 0-based!
Warning
Make sure you have prepared the composite for having at least i + 1 components.

Definition at line 89 of file CompositeData.cpp.

std::string te::dt::CompositeData::toString ( void  ) const
virtual

It returns the data value in a string representation.

Returns
The data value in a string representation.

Implements te::dt::AbstractData.

Definition at line 105 of file CompositeData.cpp.

Member Data Documentation

std::string te::dt::CompositeData::m_name
private

The composite name.

Definition at line 145 of file CompositeData.h.

std::vector<std::string> te::dt::CompositeData::m_names
private

The component names.

Definition at line 144 of file CompositeData.h.

Referenced by operator=().

std::vector<AbstractData*> te::dt::CompositeData::m_values
private

The component values.

Definition at line 143 of file CompositeData.h.

Referenced by CompositeData(), and operator=().


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