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.
te::dt::CompositeData::CompositeData ( const std::string &  name)
te::dt::CompositeData::CompositeData ( const CompositeData rhs)

Copy constructor.

Parameters
rhsThe right-hand-side composite.
te::dt::CompositeData::~CompositeData ( )

Destructor.

Member Function Documentation

void te::dt::CompositeData::add ( const std::string &  name,
AbstractData value 
)
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!
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.

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.

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!
CompositeData& te::dt::CompositeData::operator= ( const CompositeData rhs)

Copy constructor.

Parameters
rhsThe right-hand-side composite.
Returns
A reference to this composite.
void te::dt::CompositeData::setName ( const std::string &  name)
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.
std::string te::dt::CompositeData::toString ( ) const
virtual

It returns the data value in a string representation.

Returns
The data value in a string representation.

Implements te::dt::AbstractData.

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.

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

The component values.

Definition at line 143 of file CompositeData.h.


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