27 #include "../../common/Translator.h" 
   28 #include "../../dataaccess/dataset/PrimaryKey.h" 
   29 #include "../datasource/DataSourceCapabilities.h" 
   30 #include "../Exception.h" 
   39   : m_inDataSetType(dynamic_cast<
DataSetType*>(type->clone()))
 
   44   for(std::size_t i = 0; i != type->
size(); ++i)
 
   53   : m_inDataSetType(dynamic_cast<
DataSetType*>(type->clone()))
 
   58   for(std::size_t i = 0; i !=  type->
size(); ++i)
 
   68   const std::vector<te::dt::Property*> properties = type->
getProperties();
 
   69   for(std::size_t i = 0; i < properties.size(); ++i)
 
   74     if(dtCapabilities.supports(p->
getType()))
 
   87       int hintDataType = dtCapabilities.getHint(p->
getType());
 
  101     std::vector<te::dt::Property*> pkProps = pk->
getProperties();
 
  102     std::vector<te::dt::Property*> outPkProps;
 
  103     for(std::size_t i = 0; i < pkProps.size(); ++i)
 
  112   delete m_outDataSetType;
 
  113   delete m_inDataSetType;
 
  118   return m_inDataSetType;
 
  123   for(std::size_t i = 0; i < m_inDataSetType->size(); ++i)
 
  126       propertyNames.push_back(m_inDataSetType->getProperty(i)->getName());
 
  132   for(std::size_t i = 0; i < m_inDataSetType->size(); ++i)
 
  135       propertyPos.push_back(i);
 
  141   std::size_t pos = m_outDataSetType->getPropertyPosition(propertyName);
 
  142   assert(pos != std::string::npos);
 
  144   return getConvertedProperties(pos, convertedPropertyPos);
 
  149   assert(propertyPos >= 0 && propertyPos < m_propertyIndexes.size());
 
  151   std::vector<std::size_t> indexes = m_propertyIndexes[propertyPos];
 
  153   for(std::size_t i = 0; i < indexes.size(); ++i)
 
  155     assert(indexes[i] >= 0 && indexes[i] < m_inDataSetType->size());
 
  156     convertedPropertyPos.push_back(indexes[i]);
 
  162   return m_functionsNames[propertyPos];
 
  167   std::size_t pos = m_outDataSetType->getPropertyPosition(propertyName);
 
  173   assert(propertyPos >= 0 && propertyPos < m_outDataSetType->size());
 
  179   m_outDataSetType->remove(p);
 
  182   const std::vector<std::size_t> indexes = m_propertyIndexes[propertyPos];
 
  184   for(std::size_t i = 0; i < indexes.size(); ++i)
 
  185     m_convertedProperties[indexes[i]]--;
 
  187   m_propertyIndexes.erase(m_propertyIndexes.begin() + propertyPos);
 
  189   m_converters.erase(m_converters.begin() + propertyPos);
 
  194   std::size_t pos = m_inDataSetType->getPropertyPosition(propertyName);
 
  200   std::vector<std::size_t> indexes;
 
  201   indexes.push_back(propertyPos);
 
  202   add(indexes, p, attributeConverterName);
 
  207   std::vector<std::size_t> indexes;
 
  208   indexes.push_back(propertyPos);
 
  209   add(indexes, p, conv);
 
  214   std::vector<std::size_t> indexes;
 
  216   for(std::size_t i = 0; i < propertyNames.size(); ++i)
 
  217     indexes.push_back(m_inDataSetType->getPropertyPosition(propertyNames[i]));
 
  219   add(indexes, p, attributeConverterName);
 
  224   assert(!propertyPos.empty());
 
  230   m_outDataSetType->add(p);
 
  233   m_propertyIndexes.push_back(propertyPos);
 
  236   m_converters.push_back(conv);
 
  239   for(std::size_t i = 0; i < propertyPos.size(); ++i)
 
  240     m_convertedProperties[propertyPos[i]]++;
 
  242   m_functionsNames.push_back(attributeConverterName);
 
  247   assert(!propertyPos.empty());
 
  251   m_outDataSetType->add(p);
 
  254   m_propertyIndexes.push_back(propertyPos);
 
  257   m_converters.push_back(conv);
 
  260   for(std::size_t i = 0; i < propertyPos.size(); ++i)
 
  261     m_convertedProperties[propertyPos[i]]++;
 
  263   m_functionsNames.push_back(
"UnknownAttributeConverter");
 
  274   const std::vector<te::dt::Property*> properties = type->
getProperties();
 
  275   for(std::size_t i = 0; i < properties.size(); ++i)
 
  289   return m_outDataSetType;
 
  294   return m_propertyIndexes;
 
  304   assert(i < m_convertedProperties.size());
 
  305   return m_convertedProperties[i] > 0;
 
DataSetType * m_outDataSetType
The converted DataSetType. 
 
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType. 
 
Property * getProperty(std::size_t i) const 
It returns the i-th property. 
 
const std::vector< std::vector< std::size_t > > & getConvertedPropertyIndexes() const 
 
CharEncoding
Supported charsets (character encoding). 
 
An converter for DataSetType. 
 
A class that models the description of a dataset. 
 
bool isConverted(std::size_t i) const 
 
DataSetType * getResult() const 
 
virtual Property * clone() const =0
It returns a clone of the object. 
 
void getNonConvertedProperties(std::vector< std::string > &propertyNames) const 
This method returns the name of the properties that have not yet been converted. 
 
PrimaryKey * getPrimaryKey() const 
It returns the primary key associated to the dataset type. 
 
const DataTypeCapabilities & getDataTypeCapabilities() const 
 
A singleton to keep all the registered Attribute Converter. 
 
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
 
std::string getConverterName(std::size_t propertyPos)
This method tells which Attribute Converter was used in the porperty position. 
 
It models a property definition. 
 
DataSetType * getConvertee()
This method returns the pointer to the DataSetType that is handled by the converter. 
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that take part of the primary key. 
 
const std::vector< AttributeConverter > & getConverters() const 
 
A class that represents the supported data types of a specific data source. 
 
const std::vector< Property * > & getProperties() const 
It returns the list of properties describing the CompositeProperty. 
 
static AttributeConverterManager & getInstance()
It returns a reference to the singleton instance. 
 
te::da::DataSourceCapabilities capabilities
 
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 g...
 
boost::function3< te::dt::AbstractData *, DataSet *, const std::vector< std::size_t > &, int > AttributeConverter
The type of attribute converter functions. 
 
void setProperties(const std::vector< te::dt::Property * > &properties)
It sets the properties that form the primary key. 
 
DataSetTypeConverter(DataSetType *type)
Constructor. 
 
std::size_t size() const 
It returns the number of properties of the CompositeProperty. 
 
std::vector< std::size_t > m_convertedProperties
Internal vector to count the references to converted properties. 
 
int getType() const 
It returns the property data type. 
 
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 c...
 
bool supports(const int &type) const 
 
~DataSetTypeConverter()
Destructor. 
 
A class that models the description of a dataset. 
 
It describes a primary key (pk) constraint. 
 
void remove(const std::string &propertyName)
This method removes a property of DataSetTypeConverter. 
 
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. 
 
virtual const std::string & getName() const 
It returns the constraint name. 
 
AttributeConverter getConverter(const std::string &name)
 
unsigned int getId() const 
It returns the property identifier. 
 
const std::string & getName() const 
It returns the property name.