A class that models the description of a dataset. More...
#include <DataSetType.h>
Public Member Functions | |
void | add (Property *p) |
It adds a new property to the CompositeProperty. More... | |
void | add (const std::vector< Property * > &ps) |
It adds a list of property types to the CompositeProperty. More... | |
void | add (const boost::ptr_vector< te::dt::Property > &ps) |
void | copy (const std::vector< Property * > &ps) |
It copies the properties from the vector. More... | |
Property * | findFirstPropertyOfType (const int t) const |
returns the first property of the given data type. Caller doesn't take ownership of the returned pointer. More... | |
const std::string & | getCompositeName () const |
It returns the name of the composite type. More... | |
const std::string & | getDatasetName () const |
It returns the name of the propery's dataset. More... | |
unsigned int | getId () const |
It returns the property identifier. More... | |
const std::string & | getName () const |
It returns the property name. More... | |
Property * | getParent () const |
It returns the parent of this property, or NULL, if it doesn't have one. More... | |
const std::vector< Property * > & | getProperties () const |
It returns the list of properties describing the CompositeProperty. More... | |
std::vector< Property * > & | getProperties () |
It returns the list of properties describing the CompositeProperty. More... | |
Property * | getProperty (std::size_t i) const |
It returns the i-th property. More... | |
Property * | getProperty (const std::string &name) const |
It returns the property with the given name or NULL if none is found. More... | |
Property * | getPropertyById (unsigned int id) const |
It searches for a property with the given ID. More... | |
std::size_t | getPropertyPosition (const std::string &name) const |
It returns the property position based on its name. More... | |
std::size_t | getPropertyPosition (const Property *p) const |
It returns the property position . More... | |
int | getType () const |
It returns the property data type. More... | |
bool | has (Property *p) const |
It checks if the Property "p" is associated to this property or any other parent. More... | |
bool | hasPropertyOfType (const int t) const |
Tells if there is a property of the given data type. More... | |
virtual void | remove (Property *p) |
It removes the property from the composite. More... | |
void | setCompositeName (const std::string &cname) |
It sets the composite type name. More... | |
void | setDatasetName (const std::string &dsName) |
It sets the property name. More... | |
void | setId (unsigned int id) |
It sets the property identifier. More... | |
void | setName (const std::string &name) |
It sets the property name. More... | |
void | setParent (Property *p) |
It associate this property to the informed parent. More... | |
std::size_t | size () const |
It returns the number of properties of the CompositeProperty. More... | |
DataSetType Basic Methods | |
Basic methods for a DataSetType. | |
DataSetType (const std::string &name, unsigned int id=0) | |
It creates a new DataSetType not associated to any DataSetType or Catalog. More... | |
DataSetType (const DataSetType &rhs) | |
Copy constructor. More... | |
~DataSetType () | |
DataSetType & | operator= (const DataSetType &rhs) |
Assignment operator not allowed. More... | |
General Descriptive Methods | |
Methods for obtainning information about a given dataset. | |
const std::string & | getTitle () const |
A human descriptive title for the DataSetType. More... | |
void | setTitle (const std::string &title) |
It sets a human descriptive title for the DataSetType. More... | |
bool | hasGeom () const |
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false. More... | |
bool | hasRaster () const |
It returns true if the DataSetType has at least one raster property; otherwise, it returns false. More... | |
DataSourceCatalog * | getCatalog () const |
It returns the catalog that owns the DataSetType. More... | |
void | setCatalog (DataSourceCatalog *catalog) |
It sets the DataSetType associated catalog. More... | |
int | getCategory () const |
It returns the dataset category. More... | |
void | setCategory (int c) |
It sets the dataset category. More... | |
Primary Key Methods | |
Methods for managing Primary Key | |
void | setPrimaryKey (PrimaryKey *pk) |
It sets the primary key constraint. More... | |
PrimaryKey * | getPrimaryKey () const |
It returns the primary key associated to the dataset type. More... | |
Constraint Methods | |
Methods for managing constraints | |
void | add (Constraint *c) |
It adds a new constraint. More... | |
void | remove (Constraint *c) |
It removes the constraint. More... | |
Unique Keys Methods | |
Methods for managing Unique Keys | |
std::size_t | getNumberOfUniqueKeys () const |
It returns the number of unique keys defined for the dataset type. More... | |
void | add (const std::vector< UniqueKey * > &uks) |
It adds the unique key constraints. More... | |
UniqueKey * | getUniqueKey (std::size_t i) const |
It returns the i-th unique key. More... | |
UniqueKey * | getUniqueKey (const std::string &name) const |
It returns a unique key with the given name or NULL if none is found. More... | |
void | remove (UniqueKey *uk) |
It removes the unique key. More... | |
void | clearUniqueKeys () |
It removes all unique keys from the dataset type. More... | |
Check Constraint Methods | |
Methods for managing Check Constraints | |
std::size_t | getNumberOfCheckConstraints () const |
It returns the number of check-constraints defined over the dataset type. More... | |
void | add (const std::vector< CheckConstraint * > &ccs) |
It adds the check constraints. More... | |
CheckConstraint * | getCheckConstraint (std::size_t i) const |
It returns the i-th check-constraint associated to the dataset type. More... | |
CheckConstraint * | getCheckConstraint (const std::string &name) const |
It returns a check-constraint with the given name or NULL if none is found. More... | |
void | remove (CheckConstraint *cc) |
It removes the check constraint. More... | |
void | clearCheckConstraints () |
It removes all check constraints. More... | |
Index Methods | |
Methods for managing Indexes | |
std::size_t | getNumberOfIndexes () const |
It returns the number of indexes defined for the dataset type. More... | |
void | add (Index *idx) |
It adds a new index. More... | |
void | add (const std::vector< Index * > &idxs) |
It adds all the indexes. More... | |
Index * | getIndex (std::size_t i) const |
It returns the i-th index associated to the dataset type. More... | |
Index * | getIndex (const std::string &name) const |
It returns an index with the given name or NULL if none is found. More... | |
void | remove (Index *idx) |
It removes the index. More... | |
void | clearIndexes () |
It removes all indexes from the dataset type. More... | |
Foreign Key Methods | |
Methods for managing foreign Keys | |
std::size_t | getNumberOfForeignKeys () const |
It returns the number of foreign keys defined for the dataset type. More... | |
ForeignKey * | getForeignKey (std::size_t i) const |
It returns the i-th foreign key associated to the dataset type. More... | |
ForeignKey * | getForeignKey (const std::string &name) const |
It returns a foreign key with the given name or NULL if none is found. More... | |
void | add (ForeignKey *fk) |
It adds a new foreign key. More... | |
void | remove (ForeignKey *fk) |
It removes the foreign key. More... | |
Re-implementation from CompositeProperty | |
Re-implementation from CompositeProperty. | |
void | remove (Property *p) |
It removes the Property. More... | |
void | clear () |
It clears the DataSetType definition. More... | |
Auxiliary Methods | |
Auxiliary methods. | |
void | replace (Property *p, Property *pp) |
It replaces the property p by pp and adjust all pointers inclusive in the catalog. More... | |
Implementation From Superclass Property | |
Methods re-implemented from the superclass Property. | |
Property * | clone () const |
It returns a clone of the object. More... | |
Protected Member Functions | |
Protected Helper Methods | |
Methods for dealing with some regular tasks related to DataSetType constraints. | |
void | removeUniqueKeys (Property *p) |
It removes all unique keys related to the given Property. More... | |
void | removeIndexes (Property *p) |
It removes all indexes related to the given Property. More... | |
void | removeForeignKeys (Property *p) |
It removes all foreign keys that p takes part and all foreign keys that references p. More... | |
Protected Attributes | |
std::string | m_cname |
The composite type name. More... | |
std::string | m_datasetName |
The property's dataset name. More... | |
unsigned int | m_id |
An identification number that can be used internally. More... | |
std::string | m_name |
The property name. More... | |
Property * | m_parent |
The parent property type: it must be a CompositeProperty. More... | |
std::vector< Property * > | m_properties |
The list of property types that make the CompositeProperty. More... | |
int | m_type |
The property data type. More... | |
Private Attributes | |
DataSourceCatalog * | m_catalog |
The associated catalog. More... | |
int | m_category |
A category. More... | |
std::vector< CheckConstraint * > | m_checkConstraints |
A vector of check constraints. More... | |
std::vector< ForeignKey * > | m_foreignKeys |
A vector of foreign key constraints. More... | |
std::vector< Index * > | m_idxs |
A vector of indexes. More... | |
PrimaryKey * | m_pk |
The DataSetType primary key. More... | |
std::string | m_title |
A brief description of the DataSetType. More... | |
std::vector< UniqueKey * > | m_uniqueKeys |
A vector of unique key constraints. More... | |
A class that models the description of a dataset.
A DataSetType may be used to describe the dataset schema. It lists the attributes of the dataset, including their names and types.
The information about the properties (or attributes) of datasets are stored in instances of the Property class. To a property it is associated a name, the data type and other metadata necessary to fully specify the type, such as the attribute size.
Definition at line 72 of file DataSetType.h.
te::da::DataSetType::DataSetType | ( | const std::string & | name, |
unsigned int | id = 0 |
||
) |
It creates a new DataSetType not associated to any DataSetType or Catalog.
By default the DataSetType doesn't have a geometric property nor a default geometry property.
name | The DataSetType name. |
id | The DataSetType identifier. |
te::da::DataSetType::DataSetType | ( | const DataSetType & | rhs | ) |
te::da::DataSetType::~DataSetType | ( | ) |
Destructor
|
inherited |
It adds a new property to the CompositeProperty.
p | The property to be inserted. |
|
inherited |
It adds a list of property types to the CompositeProperty.
ps | The list of properties to be added. |
|
inherited |
void te::da::DataSetType::add | ( | Constraint * | c | ) |
It adds a new constraint.
A constraint can be a: foreign key, unique key, check constraint or primary key
c | The constraint to be added to the DataSetType. |
Exception | For foreign keys, it throws an exception if the DataSetType is associated to a DataSourceCatalog and the foreign key is referencing another DataSetType that is not. |
void te::da::DataSetType::add | ( | const std::vector< UniqueKey * > & | uks | ) |
It adds the unique key constraints.
uks | The unique key constraints to be added to the DataSetType. |
void te::da::DataSetType::add | ( | const std::vector< CheckConstraint * > & | ccs | ) |
It adds the check constraints.
ccs | The check constraints to be added to the DataSetType. |
void te::da::DataSetType::add | ( | Index * | idx | ) |
It adds a new index.
idx | The index to be added to the DataSetType. |
void te::da::DataSetType::add | ( | const std::vector< Index * > & | idxs | ) |
It adds all the indexes.
idxs | A list of indexes to be added to the DataSetType. |
void te::da::DataSetType::add | ( | ForeignKey * | fk | ) |
It adds a new foreign key.
fk | The foreign key to be added to the DataSetType. |
Exception | It throws an exception if the DataSetType is associated to a DataSourceCatalog and the fk is referencing another DataSetType that is not. |
|
virtual |
It clears the DataSetType definition.
Reimplemented from te::dt::CompositeProperty.
void te::da::DataSetType::clearCheckConstraints | ( | ) |
It removes all check constraints.
void te::da::DataSetType::clearIndexes | ( | ) |
It removes all indexes from the dataset type.
void te::da::DataSetType::clearUniqueKeys | ( | ) |
It removes all unique keys from the dataset type.
|
virtual |
It returns a clone of the object.
The new DataSetType will not be associated to any DataSourceCatalog. All associated constraints names, like indexes, unique keys, primary keys, foreign keys and check constraints will preserve the name. This is also true for the DataSetType name. So, be carefull when trying to persist the DataSetType in the same data source as the cloned dataset type.
Foreign keys are copied and will reference the same objects as the cloned object.
Reimplemented from te::dt::CompositeProperty.
|
inherited |
It copies the properties from the vector.
ps | The list of properties to be copied. |
|
inlineinherited |
returns the first property of the given data type. Caller doesn't take ownership of the returned pointer.
Definition at line 278 of file CompositeProperty.h.
References te::dt::Property::getType(), te::dt::CompositeProperty::m_properties, and te::dt::CompositeProperty::size().
Referenced by te::dt::CompositeProperty::hasPropertyOfType().
|
inline |
It returns the catalog that owns the DataSetType.
Definition at line 158 of file DataSetType.h.
|
inline |
It returns the dataset category.
Some drivers and applications can use this value to refine their functionalities.
Definition at line 177 of file DataSetType.h.
|
inline |
It returns the i-th check-constraint associated to the dataset type.
i | The check-constraint position. |
Definition at line 354 of file DataSetType.h.
CheckConstraint* te::da::DataSetType::getCheckConstraint | ( | const std::string & | name | ) | const |
It returns a check-constraint with the given name or NULL if none is found.
name | The check-constraint name. |
|
inlineinherited |
It returns the name of the composite type.
Definition at line 96 of file CompositeProperty.h.
|
inlineinherited |
It returns the name of the propery's dataset.
Definition at line 144 of file Property.h.
|
inline |
It returns the i-th foreign key associated to the dataset type.
i | The foreign key position. |
Definition at line 480 of file DataSetType.h.
ForeignKey* te::da::DataSetType::getForeignKey | ( | const std::string & | name | ) | const |
It returns a foreign key with the given name or NULL if none is found.
name | The foreign key name. |
|
inlineinherited |
It returns the property identifier.
Definition at line 109 of file Property.h.
|
inline |
It returns the i-th index associated to the dataset type.
i | The index position. |
Definition at line 428 of file DataSetType.h.
Index* te::da::DataSetType::getIndex | ( | const std::string & | name | ) | const |
It returns an index with the given name or NULL if none is found.
name | The index name. |
|
inlineinherited |
It returns the property name.
Definition at line 127 of file Property.h.
|
inline |
It returns the number of check-constraints defined over the dataset type.
Definition at line 331 of file DataSetType.h.
|
inline |
It returns the number of foreign keys defined for the dataset type.
Definition at line 467 of file DataSetType.h.
|
inline |
It returns the number of indexes defined for the dataset type.
Definition at line 391 of file DataSetType.h.
|
inline |
It returns the number of unique keys defined for the dataset type.
Definition at line 269 of file DataSetType.h.
|
inlineinherited |
It returns the parent of this property, or NULL, if it doesn't have one.
Definition at line 168 of file Property.h.
|
inline |
It returns the primary key associated to the dataset type.
The primary key associated to the dataset type or NULL if none exists.
Definition at line 214 of file DataSetType.h.
|
inlineinherited |
It returns the list of properties describing the CompositeProperty.
Definition at line 153 of file CompositeProperty.h.
|
inlineinherited |
It returns the list of properties describing the CompositeProperty.
Definition at line 160 of file CompositeProperty.h.
|
inlineinherited |
It returns the i-th property.
i | The property position in the property array. |
Definition at line 171 of file CompositeProperty.h.
|
inherited |
It returns the property with the given name or NULL if none is found.
name | The name of the property we are looking for. |
|
inherited |
It searches for a property with the given ID.
id | The property ID. |
|
inherited |
It returns the property position based on its name.
name | The property name. |
|
inherited |
It returns the property position .
p | The property. |
|
inline |
A human descriptive title for the DataSetType.
Definition at line 130 of file DataSetType.h.
|
inlineinherited |
It returns the property data type.
Definition at line 161 of file Property.h.
Referenced by te::dt::CompositeProperty::findFirstPropertyOfType().
|
inline |
It returns the i-th unique key.
i | The unique key position. |
Definition at line 294 of file DataSetType.h.
UniqueKey* te::da::DataSetType::getUniqueKey | ( | const std::string & | name | ) | const |
It returns a unique key with the given name or NULL if none is found.
name | The unique key name. |
|
virtualinherited |
It checks if the Property "p" is associated to this property or any other parent.
p | The Property we are checking. |
Implements te::dt::Property.
|
inline |
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false.
Definition at line 655 of file DataSetType.h.
References te::dt::GEOMETRY_TYPE.
|
inlineinherited |
Tells if there is a property of the given data type.
Definition at line 273 of file CompositeProperty.h.
References te::dt::CompositeProperty::findFirstPropertyOfType().
Referenced by hasRaster().
|
inline |
It returns true if the DataSetType has at least one raster property; otherwise, it returns false.
Definition at line 660 of file DataSetType.h.
References te::dt::CompositeProperty::hasPropertyOfType(), and te::dt::RASTER_TYPE.
DataSetType& te::da::DataSetType::operator= | ( | const DataSetType & | rhs | ) |
Assignment operator not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
|
virtualinherited |
It removes the property from the composite.
p | The property to be removed from the composite. |
void te::da::DataSetType::remove | ( | Constraint * | c | ) |
It removes the constraint.
A constraint can be a: foreign key, unique key, check constraint or primary key
c | The constraint to be removed from the DataSetType. |
void te::da::DataSetType::remove | ( | UniqueKey * | uk | ) |
It removes the unique key.
uk | The unique key to be removed from the DataSetType. |
void te::da::DataSetType::remove | ( | CheckConstraint * | cc | ) |
It removes the check constraint.
cc | The check constraint to be removed from the DataSetType. |
void te::da::DataSetType::remove | ( | Index * | idx | ) |
It removes the index.
idx | The index to be removed from the DataSetType. |
void te::da::DataSetType::remove | ( | ForeignKey * | fk | ) |
It removes the foreign key.
fk | The foreign key to be removed from the DataSetType. |
Exception | It throws an exception if the fk can not be removed. |
void te::da::DataSetType::remove | ( | Property * | p | ) |
It removes the Property.
This method may propagate changes to: indexes, unique keys, primary key, foreign key, check-constraints, sequences and catalog.
If the property to be removed is a geometry this method will take care of the default geometry property finding the first onde available or setting it to NULL if no other geometry property exists.
p | The Property to be removed. |
|
protected |
It removes all foreign keys that p takes part and all foreign keys that references p.
This method may change this DataSetType and all other DataSetTypes in the DataSourceCatalog that has a foreign key referencing this property.
p | A Property that may take part of a foreign key. |
|
protected |
It removes all indexes related to the given Property.
p | A Property that may take part of a index. |
|
protected |
It removes all unique keys related to the given Property.
p | A Property that may take part of a unique key. |
It replaces the property p by pp and adjust all pointers inclusive in the catalog.
p | The property to be replaced. |
pp | The property that will be added in the datasettype. |
|
inline |
It sets the DataSetType associated catalog.
catalog | The catalog associated to the DataSetType. |
Definition at line 168 of file DataSetType.h.
|
inline |
It sets the dataset category.
c | The dataset category. |
Definition at line 184 of file DataSetType.h.
|
inlineinherited |
It sets the composite type name.
name | The composite type name. |
Definition at line 103 of file CompositeProperty.h.
|
inlineinherited |
It sets the property name.
name | The new property name. |
Definition at line 154 of file Property.h.
|
inlineinherited |
It sets the property identifier.
id | A number used to identify the property. |
Definition at line 118 of file Property.h.
|
inlineinherited |
It sets the property name.
name | The new property name. |
Definition at line 137 of file Property.h.
|
inlineinherited |
It associate this property to the informed parent.
p | Teh parent property. |
Definition at line 177 of file Property.h.
void te::da::DataSetType::setPrimaryKey | ( | PrimaryKey * | pk | ) |
It sets the primary key constraint.
pk | The primary key constraint. |
|
inline |
It sets a human descriptive title for the DataSetType.
title | This value can be used to display a human descriptive title for the DataSetType. |
Definition at line 137 of file DataSetType.h.
|
inlineinherited |
It returns the number of properties of the CompositeProperty.
Definition at line 146 of file CompositeProperty.h.
Referenced by te::dt::CompositeProperty::findFirstPropertyOfType().
|
private |
The associated catalog.
Definition at line 643 of file DataSetType.h.
|
private |
A category.
Definition at line 650 of file DataSetType.h.
|
private |
A vector of check constraints.
Definition at line 647 of file DataSetType.h.
|
protectedinherited |
The composite type name.
Definition at line 269 of file CompositeProperty.h.
|
protectedinherited |
The property's dataset name.
Definition at line 208 of file Property.h.
|
private |
A vector of foreign key constraints.
Definition at line 646 of file DataSetType.h.
|
protectedinherited |
An identification number that can be used internally.
Definition at line 205 of file Property.h.
|
private |
A vector of indexes.
Definition at line 648 of file DataSetType.h.
|
protectedinherited |
The property name.
Definition at line 207 of file Property.h.
|
protectedinherited |
The parent property type: it must be a CompositeProperty.
Definition at line 204 of file Property.h.
|
private |
The DataSetType primary key.
Definition at line 644 of file DataSetType.h.
|
protectedinherited |
The list of property types that make the CompositeProperty.
Definition at line 270 of file CompositeProperty.h.
Referenced by te::dt::CompositeProperty::findFirstPropertyOfType().
|
private |
A brief description of the DataSetType.
Definition at line 645 of file DataSetType.h.
|
protectedinherited |
The property data type.
Definition at line 206 of file Property.h.
|
private |
A vector of unique key constraints.
Definition at line 649 of file DataSetType.h.