te::da::Index Class Reference

It describes an index associated to a DataSetType. More...

#include <Index.h>

Public Member Functions

void add (te::dt::Property *p)
 It adds the property to the list of properties of the index. More...
 
Indexclone ()
 It returns a clone of the object. More...
 
DataSetTypegetDataSetType () const
 It returns the DataSetType associated to the index. More...
 
unsigned int getId () const
 It returns the index identifier. More...
 
IndexType getIndexType () const
 It gets the index type. More...
 
const std::string & getName () const
 It returns the index name. More...
 
const std::vector< te::dt::Property * > & getProperties () const
 It returns the properties that take part of the index. More...
 
bool has (te::dt::Property *p)
 It verifies if Property is associated to the index. More...
 
 Index (DataSetType *parent=0, unsigned int id=0)
 Constructor. More...
 
 Index (const std::string &name, IndexType t=B_TREE_TYPE, DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 Index (const std::string &name, IndexType t, const std::vector< te::dt::Property * > &properties, DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 Index (const Index &rhs)
 Copy constructor. More...
 
Indexoperator= (const Index &rhs)
 Assignment operator. More...
 
void replace (te::dt::Property *p, te::dt::Property *pp)
 It changes the reference to property p to pp. More...
 
void setDataSetType (DataSetType *dt)
 It sets the DataSetType associated to the index. More...
 
void setId (unsigned int id)
 It sets the DataSetType identifier. More...
 
void setIndexType (IndexType t)
 It sets the index type. More...
 
void setName (const std::string &name)
 It sets the index name. More...
 
void setProperties (const std::vector< te::dt::Property * > &properties)
 It sets the properties that take part of the index. More...
 
 ~Index ()
 Destructor. More...
 

Private Attributes

DataSetTypem_dt
 The parent DataSetType. More...
 
unsigned int m_id
 An identification number for the index. More...
 
std::string m_name
 The index name. More...
 
std::vector< te::dt::Property * > m_properties
 The list of properties that form the index. More...
 
IndexType m_type
 The index type. More...
 

Detailed Description

It describes an index associated to a DataSetType.

See also
DataSetType, PrimaryKey, ForeignKey, CheckConstraint, UniqueKey

Definition at line 54 of file Index.h.

Constructor & Destructor Documentation

te::da::Index::Index ( DataSetType parent = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
dtThe DataSetType associated to this index.
idThe index identifier.
Postcondition
If dt is provided, the index will belong to the given DataSetType.
By default the index type is BTreeType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!
te::da::Index::Index ( const std::string &  name,
IndexType  t = B_TREE_TYPE,
DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
nameThe index name.
tThe index type.
dtThe DataSetType associated to this index.
idThe index identifier.
Postcondition
If dt is provided, the index will belong to the given DataSetType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!
te::da::Index::Index ( const std::string &  name,
IndexType  t,
const std::vector< te::dt::Property * > &  properties,
DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
nameThe index name.
tThe index type.
propertiesThe properties that form the index.
dtThe DataSetType associated to this index.
idThe index identifier.
Precondition
The properties must belong to the same DataSetType as the index.
Postcondition
If dt is provided, the index will belong to the given DataSetType.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!
te::da::Index::Index ( const Index rhs)

Copy constructor.

The new object will not have an associated DataSetType.

Parameters
rhsRight-hand-side instance.
te::da::Index::~Index ( )
inline

Destructor.

Definition at line 119 of file Index.h.

Member Function Documentation

void te::da::Index::add ( te::dt::Property p)
inline

It adds the property to the list of properties of the index.

Parameters
pThe property that will take part of the index.

Definition at line 197 of file Index.h.

Index* te::da::Index::clone ( )

It returns a clone of the object.

The new object will not have an associated schema.

Returns
A clone of the object.
DataSetType* te::da::Index::getDataSetType ( ) const
inline

It returns the DataSetType associated to the index.

Returns
The DataSetType associated to the index.

Definition at line 204 of file Index.h.

unsigned int te::da::Index::getId ( ) const
inline

It returns the index identifier.

Returns
A number that identifies the index.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 139 of file Index.h.

IndexType te::da::Index::getIndexType ( ) const
inline

It gets the index type.

Returns
The index type.

Definition at line 169 of file Index.h.

const std::string& te::da::Index::getName ( ) const
inline

It returns the index name.

Returns
The index name.

Definition at line 155 of file Index.h.

const std::vector<te::dt::Property*>& te::da::Index::getProperties ( ) const
inline

It returns the properties that take part of the index.

Returns
The properties that take part of the index.

Definition at line 183 of file Index.h.

bool te::da::Index::has ( te::dt::Property p)

It verifies if Property is associated to the index.

Parameters
pThe Property to be verified.
Returns
True if Property is associated to the index, false otherwise.
Index& te::da::Index::operator= ( const Index rhs)

Assignment operator.

The new object will not have an assigned DataSetType.

Parameters
rhsRight-hand-side instance.
Returns
A reference to this.
void te::da::Index::replace ( te::dt::Property p,
te::dt::Property pp 
)

It changes the reference to property p to pp.

Parameters
pA property that takes part of the index.
ppThe property that will take p place.
Note
If the property p is not in the idx attribute list this method does nothing.
void te::da::Index::setDataSetType ( DataSetType dt)
inline

It sets the DataSetType associated to the index.

Parameters
dtThe DataSetType to which this index belongs.
Warning
Take care when calling this method. If the index belongs to a DataSetType, remember to detach it from the DataSetType before calling this method.

Definition at line 214 of file Index.h.

void te::da::Index::setId ( unsigned int  id)
inline

It sets the DataSetType identifier.

Parameters
idA unique number that identifies the DataSetType in its DataSource.
Warning
The identifier value (id) may be used by data source implementations. So, don't rely on its value!

Definition at line 148 of file Index.h.

void te::da::Index::setIndexType ( IndexType  t)
inline

It sets the index type.

Parameters
tThe index type.

Definition at line 176 of file Index.h.

void te::da::Index::setName ( const std::string &  name)
inline

It sets the index name.

Parameters
nameThe index name.

Definition at line 162 of file Index.h.

void te::da::Index::setProperties ( const std::vector< te::dt::Property * > &  properties)
inline

It sets the properties that take part of the index.

Parameters
propertiesThe properties that take part of the index.

Definition at line 190 of file Index.h.

Member Data Documentation

DataSetType* te::da::Index::m_dt
private

The parent DataSetType.

Definition at line 248 of file Index.h.

unsigned int te::da::Index::m_id
private

An identification number for the index.

Definition at line 246 of file Index.h.

std::string te::da::Index::m_name
private

The index name.

Definition at line 249 of file Index.h.

std::vector<te::dt::Property*> te::da::Index::m_properties
private

The list of properties that form the index.

Definition at line 250 of file Index.h.

IndexType te::da::Index::m_type
private

The index type.

Definition at line 247 of file Index.h.


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