te::da::DataSetTypeConverter Class Reference

An converter for DataSetType. More...

#include <DataSetTypeConverter.h>

Public Member Functions

void add (const std::string &propertyName, te::dt::Property *p, const std::string &attributeConverterName="GenericAttributeConverter")
 It adds a conversions to the given property of the input data set type. More...
 
void add (std::size_t propertyPos, te::dt::Property *p, const std::string &attributeConverterName="GenericAttributeConverter")
 It adds a conversions to the given property of the input data set type. More...
 
void add (std::size_t propertyPos, te::dt::Property *p, AttributeConverter conv)
 It adds a conversions to the given property of the input data set type. More...
 
void add (const std::vector< std::string > &propertyNames, te::dt::Property *p, const std::string &attributeConverterName="GenericAttributeConverter")
 It adds a conversion to the given properties of the input data set type. More...
 
void add (const std::vector< std::size_t > &propertyPos, te::dt::Property *p, const std::string &attributeConverterName="GenericAttributeConverter")
 It adds a conversion to the given properties of the input data set type. More...
 
void add (const std::vector< std::size_t > &propertyPos, te::dt::Property *p, AttributeConverter conv)
 It adds a conversion to the given properties of the input data set type. More...
 
void getConvertedProperties (const std::string &propertyName, std::vector< std::size_t > &convertedPropertyPos)
 This method tells which properties of the input data set type that have been converted based on the given property name. More...
 
void getConvertedProperties (std::size_t propertyPos, std::vector< std::size_t > &convertedPropertyPos)
 This method tells which properties of the input data set type that have been converted based on the given property name. More...
 
const std::vector< std::vector< std::size_t > > & getConvertedPropertyIndexes () const
 
DataSetTypegetConvertee ()
 This method returns the pointer to the DataSetType that is handled by the converter. More...
 
std::string getConverterName (std::size_t propertyPos)
 This method tells which Attribute Converter was used in the porperty position. More...
 
const std::vector< AttributeConverter > & getConverters () const
 
void getNonConvertedProperties (std::vector< std::string > &propertyNames) const
 This method returns the name of the properties that have not yet been converted. More...
 
void getNonConvertedProperties (std::vector< std::size_t > &propertyPos) const
 This method returns the position of the properties that have not yet been converted. More...
 
DataSetTypegetResult () const
 
void remove (const std::string &propertyName)
 This method removes a property of DataSetTypeConverter. More...
 
void remove (std::size_t propertyPos)
 This method removes a property of DataSetTypeConverter. More...
 
Constructor/Destructor

Initilizer methods.

 DataSetTypeConverter (DataSetType *type)
 Constructor. More...
 
 DataSetTypeConverter (DataSetType *type, const DataSourceCapabilities &capabilities, te::core::EncodingType et=te::core::EncodingType::UTF8)
 Constructor. More...
 
 ~DataSetTypeConverter ()
 Destructor. More...
 

Static Public Member Functions

static bool needConverter (DataSetType *type, const DataSourceCapabilities &capabilities)
 Static method that verifies if the given data set type need an converter based on given data source capabilities. More...
 

Private Member Functions

bool isConverted (std::size_t i) const
 

Private Attributes

std::vector< std::size_t > m_convertedProperties
 Internal vector to count the references to converted properties. More...
 
std::vector< AttributeConverterm_converters
 A vector that stores the attribute converters functions. More...
 
std::vector< std::string > m_functionsNames
 A vector that stores the attribute converters functions names. More...
 
DataSetTypem_inDataSetType
 A pointer to DataSetType that will be converted. More...
 
DataSetTypem_outDataSetType
 The converted DataSetType. More...
 
std::vector< std::vector< std::size_t > > m_propertyIndexes
 A vector that stores the converted property indexes. More...
 

Friends

class DataSetAdapter
 

Detailed Description

An converter for DataSetType.

See also
DataSetType

Definition at line 59 of file DataSetTypeConverter.h.

Constructor & Destructor Documentation

te::da::DataSetTypeConverter::DataSetTypeConverter ( DataSetType type)

Constructor.

Parameters
typeA pointer to the DataSetType that will be converted.
Note
Here no automatic property conversion will be made.
The method "add" can be used to do manual conversions.
This class will NOT take the ownership of the given pointer.
See also
DataSetType
te::da::DataSetTypeConverter::DataSetTypeConverter ( DataSetType type,
const DataSourceCapabilities capabilities,
te::core::EncodingType  et = te::core::EncodingType::UTF8 
)

Constructor.

Parameters
typeA pointer to the DataSetType that will be converted.
capabilitiesA data source capabilities of the data source that the user intend use. e.g. the data source where the given data set type will be saved.
ceThe destintion character encoding.
Note
This method will try to create automatic property conversions based on the given capabilities. Here we will look up the data type support of DataSourceCapabilities. If there is not support for a given data type, the method "getHint" will be used in attempt to retrieve an appropriate data type.
If the method "getHint" does not inform any hint, the specific property will not have a conversion.
The method "add" can be used to do manual conversions.
The method "getNonConvertedProperties" can be used to retrieve that properties that have no defined conversion.
See also
DataSetType, DataSourceCapabilities DataTypeCapabilities
te::da::DataSetTypeConverter::~DataSetTypeConverter ( )

Destructor.

Member Function Documentation

void te::da::DataSetTypeConverter::add ( const std::string &  propertyName,
te::dt::Property p,
const std::string &  attributeConverterName = "GenericAttributeConverter" 
)

It adds a conversions to the given property of the input data set type.

Parameters
propertyNameThe property name that will be converted.
pThe converted property.
attributeConverterNameThe function name that will be used to do the property values conversion.
void te::da::DataSetTypeConverter::add ( std::size_t  propertyPos,
te::dt::Property p,
const std::string &  attributeConverterName = "GenericAttributeConverter" 
)

It adds a conversions to the given property of the input data set type.

Parameters
propertyPosThe property position that will be converted.
pThe converted property.
attributeConverterNameThe function name that will be used to do the property values conversion.
void te::da::DataSetTypeConverter::add ( std::size_t  propertyPos,
te::dt::Property p,
AttributeConverter  conv 
)

It adds a conversions to the given property of the input data set type.

Parameters
propertyPosThe property position that will be converted.
pThe converted property.
convThe function that will be used to do the property values conversion.
void te::da::DataSetTypeConverter::add ( const std::vector< std::string > &  propertyNames,
te::dt::Property p,
const std::string &  attributeConverterName = "GenericAttributeConverter" 
)

It adds a conversion to the given properties of the input data set type.

Parameters
propertyNamesThe property names that will be converted.
pThe converted property.
attributeConverterNameThe function name that will be used to do the property values conversion.
void te::da::DataSetTypeConverter::add ( const std::vector< std::size_t > &  propertyPos,
te::dt::Property p,
const std::string &  attributeConverterName = "GenericAttributeConverter" 
)

It adds a conversion to the given properties of the input data set type.

Parameters
propertyPosThe property positions that will be converted.
pThe converted property.
attributeConverterNameThe function name that will be used to do the property values conversion.
void te::da::DataSetTypeConverter::add ( const std::vector< std::size_t > &  propertyPos,
te::dt::Property p,
AttributeConverter  conv 
)

It adds a conversion to the given properties of the input data set type.

Parameters
propertyPosThe property positions that will be converted.
pThe converted property.
convThe function that will be used to do the property values conversion.
void te::da::DataSetTypeConverter::getConvertedProperties ( const std::string &  propertyName,
std::vector< std::size_t > &  convertedPropertyPos 
)

This method tells which properties of the input data set type that have been converted based on the given property name.

Parameters
propertyNameA property name of the DataSetTypeConverter.
convertedPropertyPosA vector that will be filled with the property positions of the input data set type have been converted.
void te::da::DataSetTypeConverter::getConvertedProperties ( std::size_t  propertyPos,
std::vector< std::size_t > &  convertedPropertyPos 
)

This method tells which properties of the input data set type that have been converted based on the given property name.

Parameters
propertyPosA property position of the DataSetTypeConverter.
convertedPropertyPosA vector that will be filled with the property positions of the input data set type have been converted.
const std::vector<std::vector<std::size_t> >& te::da::DataSetTypeConverter::getConvertedPropertyIndexes ( ) const
DataSetType* te::da::DataSetTypeConverter::getConvertee ( )

This method returns the pointer to the DataSetType that is handled by the converter.

Returns
The pointer to the DataSetType that is handled by the converter.
std::string te::da::DataSetTypeConverter::getConverterName ( std::size_t  propertyPos)

This method tells which Attribute Converter was used in the porperty position.

Parameters
propertyPosA property position of the DataSetTypeConverter.
Returns
Attribute Converter name.
const std::vector<AttributeConverter>& te::da::DataSetTypeConverter::getConverters ( ) const
void te::da::DataSetTypeConverter::getNonConvertedProperties ( std::vector< std::string > &  propertyNames) const

This method returns the name of the properties that have not yet been converted.

Parameters
propertyNamesA vector that will be filled with the name of the properties that have not yet been converted.
void te::da::DataSetTypeConverter::getNonConvertedProperties ( std::vector< std::size_t > &  propertyPos) const

This method returns the position of the properties that have not yet been converted.

Parameters
propertyPosA vector that will be filled with the position of the properties that have not yet been converted.
DataSetType* te::da::DataSetTypeConverter::getResult ( ) const
bool te::da::DataSetTypeConverter::isConverted ( std::size_t  i) const
private
static bool te::da::DataSetTypeConverter::needConverter ( DataSetType type,
const DataSourceCapabilities capabilities 
)
static

Static method that verifies if the given data set type need an converter based on given data source capabilities.

Parameters
typeThe data set type that will be verified.
capabilitiesThe data source capabilities that will be used.
Returns
Return true if the given data set type need a converter. Otherwise, return false.
void te::da::DataSetTypeConverter::remove ( const std::string &  propertyName)

This method removes a property of DataSetTypeConverter.

Parameters
propertyNameThe property name of the DataSetTypeConverter that will be removed.
void te::da::DataSetTypeConverter::remove ( std::size_t  propertyPos)

This method removes a property of DataSetTypeConverter.

Parameters
propertyPosThe property position of the DataSetTypeConverter that will be removed.

Friends And Related Function Documentation

friend class DataSetAdapter
friend

Definition at line 61 of file DataSetTypeConverter.h.

Member Data Documentation

std::vector<std::size_t> te::da::DataSetTypeConverter::m_convertedProperties
private

Internal vector to count the references to converted properties.

Definition at line 250 of file DataSetTypeConverter.h.

std::vector<AttributeConverter> te::da::DataSetTypeConverter::m_converters
private

A vector that stores the attribute converters functions.

Definition at line 248 of file DataSetTypeConverter.h.

std::vector<std::string> te::da::DataSetTypeConverter::m_functionsNames
private

A vector that stores the attribute converters functions names.

Definition at line 249 of file DataSetTypeConverter.h.

DataSetType* te::da::DataSetTypeConverter::m_inDataSetType
private

A pointer to DataSetType that will be converted.

Definition at line 245 of file DataSetTypeConverter.h.

DataSetType* te::da::DataSetTypeConverter::m_outDataSetType
private

The converted DataSetType.

Definition at line 246 of file DataSetTypeConverter.h.

std::vector<std::vector<std::size_t> > te::da::DataSetTypeConverter::m_propertyIndexes
private

A vector that stores the converted property indexes.

Definition at line 247 of file DataSetTypeConverter.h.


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