26#ifndef __TERRALIB_DATAACCESS_INTERNAL_DATASOURCECATALOG_H 
   27#define __TERRALIB_DATAACCESS_INTERNAL_DATASOURCECATALOG_H 
   31#include "../dataset/DataSetType.h" 
   39#include <boost/multi_index_container.hpp> 
   40#include <boost/multi_index/mem_fun.hpp> 
   41#include <boost/multi_index/ordered_index.hpp> 
   42#include <boost/multi_index/random_access_index.hpp> 
   43#include <boost/noncopyable.hpp> 
   48  namespace dt { 
class Property; }
 
   90        unsigned int getId() 
const;
 
  100        void setId(
unsigned int id);
 
  135        std::size_t getNumberOfDataSets() 
const;
 
  225        std::size_t getNumberOfSequences() 
const;
 
  338        std::pair<std::multimap<DataSetType*, ForeignKey*>::const_iterator,
 
  339                  std::multimap<DataSetType*, ForeignKey*>::const_iterator>
 
  453        typedef boost::multi_index::multi_index_container<
 
  455                  boost::multi_index::indexed_by<
 
  456                    boost::multi_index::ordered_unique<dataset_name_cmp>,
 
  457                    boost::multi_index::random_access<>
 
  468        typedef boost::multi_index::multi_index_container<
 
  470                  boost::multi_index::indexed_by<
 
  471                    boost::multi_index::ordered_unique<sequence_name_cmp>,
 
  472                    boost::multi_index::random_access<>
 
  482        std::multimap<DataSetType*, sequence_idx_type::iterator> 
m_seqFTIdx;    
 
A class that models the description of a dataset.
 
It represents the system catalog of a DataSource.
 
const DataSetTypePtr & getDataSetType(const std::string &name) const
It searches for a dataset schema with the given name in the catalog.
 
~DataSourceCatalog()
Destructor.
 
void clear()
It clears the catalog, releasing all the resources used by it.
 
void indexSequenceDependency(Sequence *s)
It looks if the sequence is owned by a given DataSetType property and insert this information into th...
 
dataset_idx_type m_datasets
 
void dropDependentSequences(DataSetType *dt)
It drops Sequences that depends on the DataSetType dt.
 
void add(Sequence *s)
It adds a new sequence to the catalog.
 
Sequence * getSequence(std::size_t i) const
It returns the i-th Sequence.
 
std::pair< std::multimap< DataSetType *, ForeignKey * >::const_iterator, std::multimap< DataSetType *, ForeignKey * >::const_iterator > getRefFK(DataSetType *dt) const
It returns the list of fk referencing the given DataSetType in the catalog.
 
void dropDependentSequenceEntry(Sequence *s)
It drops the Sequence entry in the DataSetType sequence dependency list.
 
DataSource * m_ds
The DataSource associated to the Catalog.
 
void dropDependentSequences(te::dt::Property *p)
It drops Sequences that depends on the property.
 
Sequence * getSequence(const std::string &name) const
It searches for a Sequence with the given name in the catalog.
 
std::multimap< DataSetType *, sequence_idx_type::iterator > m_seqFTIdx
A multimap : owner-dt -> sequence-it.
 
void dropDependentFKs(DataSetType *dt)
It drops foreign keys from other DataSetTypes that depends on the attributes in the given DataSetType...
 
std::multimap< DataSetType *, ForeignKey * > m_dependentFkIdx
A multimap : datasettype -> fk. It tells for a DataSetType the list of fk referencing it.
 
void detach(Sequence *s)
It will detaches the Sequence from the catalog.
 
void rename(DataSetType *dt, const std::string &newName)
It renames the dataset schema in the catalog.
 
void setDataSource(DataSource *ds)
It sets the DataSource associated to the catalog.
 
void checkSequenceDependency(Sequence *s) const
It checks if the Sequence is owned by a DataSetType property and if that DataSetType is in the catalo...
 
DataSource * getDataSource() const
It returns the DataSource associated to the catalog.
 
void addRef(ForeignKey *fk)
It checks if the referenced DataSetType is in the catalog and associate the fk to it.
 
void remove(DataSetType *dt, const bool cascade=false)
It removes the dataset schema from the catalog.
 
void checkFKsDependency(DataSetType *dt) const
It checks if the DataSetTypes referenced by dt's foreign keys are in the catalog.
 
sequence_idx_type m_sequences
 
static DataSetTypePtr sm_nullds
 
void add(const DataSetTypePtr &dt)
It adds a new dataset schema to the catalog.
 
std::size_t getNumberOfDataSets() const
It returns the number of datasets in the catalog.
 
void removeRef(ForeignKey *fk)
It drops the reference between the foreign key and its referenced DataSetType.
 
const DataSetTypePtr & getDataSetType(std::size_t i) const
It returns the i-th dataset schema.
 
unsigned int getId() const
It returns the catalog identifier.
 
boost::multi_index::multi_index_container< DataSetTypePtr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< dataset_name_cmp >, boost::multi_index::random_access<> > > dataset_idx_type
 
void indexFKs(DataSetType *dt)
It looks for foreign keys in the DataSetType dt and try to index then with respect to referenced Data...
 
bool datasetExists(const std::string &name) const
It checks if a dataset schema with the given name is in the catalog.
 
boost::multi_index::multi_index_container< Sequence *, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< sequence_name_cmp >, boost::multi_index::random_access<> > > sequence_idx_type
 
std::size_t getNumberOfSequences() const
It returns the number of sequences in the catalog.
 
DataSourceCatalog()
It creates a new DataSourceCatalog.
 
void setId(unsigned int id)
It sets the catalog identifier.
 
void remove(Sequence *s)
It removes the sequence from the catalog.
 
unsigned int m_id
An identification number inside the DataSource.
 
An abstract class for data providers like a DBMS, Web Services or a regular file.
 
It models a foreign key constraint for a DataSetType.
 
It describes a sequence (a number generator).
 
It models a property definition.
 
boost::shared_ptr< DataSetType > DataSetTypePtr
 
boost::shared_ptr< DataSourceCatalog > DataSourceCatalogPtr
 
result_type operator()(const DataSetTypePtr &dt) const
 
result_type operator()(const Sequence *const s) const
 
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.