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()))
 
   81       int hintDataType = dtCapabilities.getHint(p->
getType());
 
   96     std::vector<te::dt::Property*> outPkProps;
 
   97     for(std::size_t i = 0; i < pkProps.size(); ++i)
 
  106   delete m_outDataSetType;
 
  107   delete m_inDataSetType;
 
  112   return m_inDataSetType;
 
  117   for(std::size_t i = 0; i < m_inDataSetType->size(); ++i)
 
  120       propertyNames.push_back(m_inDataSetType->getProperty(i)->getName());
 
  126   for(std::size_t i = 0; i < m_inDataSetType->size(); ++i)
 
  129       propertyPos.push_back(i);
 
  135   std::size_t pos = m_outDataSetType->getPropertyPosition(propertyName);
 
  136   assert(pos != std::string::npos);
 
  138   return getConvertedProperties(pos, convertedPropertyPos);
 
  143   assert(propertyPos >= 0 && propertyPos < m_propertyIndexes.size());
 
  145   std::vector<std::size_t> indexes = m_propertyIndexes[propertyPos];
 
  147   for(std::size_t i = 0; i < indexes.size(); ++i)
 
  149     assert(indexes[i] >= 0 && indexes[i] < m_inDataSetType->size());
 
  150     convertedPropertyPos.push_back(indexes[i]);
 
  156   return m_functionsNames[propertyPos];
 
  161   std::size_t pos = m_outDataSetType->getPropertyPosition(propertyName);
 
  167   assert(propertyPos >= 0 && propertyPos < m_outDataSetType->size());
 
  173   m_outDataSetType->remove(p);
 
  176   const std::vector<std::size_t> indexes = m_propertyIndexes[propertyPos];
 
  178   for(std::size_t i = 0; i < indexes.size(); ++i)
 
  179     m_convertedProperties[indexes[i]]--;
 
  181   m_propertyIndexes.erase(m_propertyIndexes.begin() + propertyPos);
 
  183   m_converters.erase(m_converters.begin() + propertyPos);
 
  188   std::size_t pos = m_inDataSetType->getPropertyPosition(propertyName);
 
  194   std::vector<std::size_t> indexes;
 
  195   indexes.push_back(propertyPos);
 
  196   add(indexes, p, attributeConverterName);
 
  201   std::vector<std::size_t> indexes;
 
  203   for(std::size_t i = 0; i < propertyNames.size(); ++i)
 
  204     indexes.push_back(m_inDataSetType->getPropertyPosition(propertyNames[i]));
 
  206   add(indexes, p, attributeConverterName);
 
  211   assert(!propertyPos.empty());
 
  217   m_outDataSetType->add(p);
 
  220   m_propertyIndexes.push_back(propertyPos);
 
  223   m_converters.push_back(conv);
 
  226   for(std::size_t i = 0; i < propertyPos.size(); ++i)
 
  227     m_convertedProperties[propertyPos[i]]++;
 
  229   m_functionsNames.push_back(attributeConverterName);
 
  239   const std::vector<te::dt::Property*> properties = type->
getProperties();
 
  240   for(std::size_t i = 0; i < properties.size(); ++i)
 
  254   return m_outDataSetType;
 
  259   return m_propertyIndexes;
 
  269   assert(i < m_convertedProperties.size());
 
  270   return m_convertedProperties[i] > 0;
 
A class that models the description of a dataset. 
 
A singleton to keep all the registered Attribute Converter. 
 
void remove(const std::string &propertyName)
This method removes a property of DataSetTypeConverter. 
 
bool supports(const int &type) const 
 
std::vector< std::size_t > m_convertedProperties
Internal vector to count the references to converted properties. 
 
Property * getProperty(std::size_t i) const 
It returns the i-th property. 
 
std::size_t size() const 
It returns the number of properties of the CompositeProperty. 
 
AttributeConverter getConverter(const std::string &name)
 
bool isConverted(std::size_t i) const 
 
boost::function3< te::dt::AbstractData *, DataSet *, const std::vector< std::size_t > &, int > AttributeConverter
The type of attribute converter functions. 
 
~DataSetTypeConverter()
Destructor. 
 
DataSetType * m_outDataSetType
The converted DataSetType. 
 
It describes a primary key (pk) constraint. 
 
const std::string & getName() const 
It returns the property name. 
 
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
 
const std::vector< AttributeConverter > & getConverters() const 
 
const std::vector< te::dt::Property * > & getProperties() const 
It returns the properties that take part of the primary key. 
 
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. 
 
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...
 
const std::vector< Property * > & getProperties() const 
It returns the list of properties describing the CompositeProperty. 
 
virtual const std::string & getName() const 
It returns the constraint name. 
 
DataSetTypeConverter(DataSetType *type)
Constructor. 
 
const DataTypeCapabilities & getDataTypeCapabilities() const 
 
A class that models the description of a dataset. 
 
DataSetType * getResult() const 
 
An converter for DataSetType. 
 
It models a property definition. 
 
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...
 
int getType() const 
It returns the property data type. 
 
static AttributeConverterManager & getInstance()
It returns a reference to the singleton instance. 
 
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType. 
 
PrimaryKey * getPrimaryKey() const 
It returns the primary key associated to the dataset type. 
 
unsigned int getId() const 
It returns the property identifier. 
 
std::string getConverterName(std::size_t propertyPos)
This method tells which Attribute Converter was used in the porperty position. 
 
A class that represents the supported data types of a specific data source. 
 
void setProperties(const std::vector< te::dt::Property * > &properties)
It sets the properties that form the primary key. 
 
virtual Property * clone() const =0
It returns a clone of the object. 
 
const std::vector< std::vector< std::size_t > > & getConvertedPropertyIndexes() const 
 
te::da::DataSourceCapabilities capabilities
 
void getNonConvertedProperties(std::vector< std::string > &propertyNames) const 
This method returns the name of the properties that have not yet been converted. 
 
DataSetType * getConvertee()
This method returns the pointer to the DataSetType that is handled by the converter.