te::da::Index Class Reference

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

#include <Index.h>

Public Member Functions

void add (const te::dt::Property *p)
 It adds the property to the list of properties of the index. More...
 
Indexclone () const
 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 (const std::string &propertyName)
 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 Index &rhs)
 Copy constructor. More...
 
Indexoperator= (const Index &rhs)
 Assignment operator. More...
 
void replace (const std::string &propName, const 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...
 
 ~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 52 of file Index.h.

Constructor & Destructor Documentation

◆ Index() [1/3]

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!

◆ Index() [2/3]

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!

◆ Index() [3/3]

te::da::Index::Index ( const Index rhs)

Copy constructor.

The new object will not have an associated DataSetType.

Parameters
rhsRight-hand-side instance.

◆ ~Index()

te::da::Index::~Index ( )

Destructor.

Member Function Documentation

◆ add()

void te::da::Index::add ( const 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 168 of file Index.h.

References te::dt::Property::clone().

◆ clone()

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

It returns a clone of the object.

The new object will not have an associated schema.

Returns
A clone of the object.

◆ getDataSetType()

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 175 of file Index.h.

◆ getId()

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 117 of file Index.h.

◆ getIndexType()

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

It gets the index type.

Returns
The index type.

Definition at line 147 of file Index.h.

◆ getName()

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

It returns the index name.

Returns
The index name.

Definition at line 133 of file Index.h.

◆ getProperties()

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 161 of file Index.h.

◆ has()

bool te::da::Index::has ( const std::string &  propertyName)

It verifies if Property is associated to the index.

Parameters
propertyNameThe Property name to be verified.
Returns
True if Property is associated to the index, false otherwise.

◆ operator=()

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.

◆ replace()

void te::da::Index::replace ( const std::string &  propName,
const te::dt::Property pp 
)

It changes the reference to property p to pp.

Parameters
propNameA property name 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.

◆ setDataSetType()

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 185 of file Index.h.

◆ setId()

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 126 of file Index.h.

◆ setIndexType()

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

It sets the index type.

Parameters
tThe index type.

Definition at line 154 of file Index.h.

◆ setName()

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

It sets the index name.

Parameters
nameThe index name.

Definition at line 140 of file Index.h.

Member Data Documentation

◆ m_dt

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

The parent DataSetType.

Definition at line 219 of file Index.h.

◆ m_id

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

An identification number for the index.

Definition at line 217 of file Index.h.

◆ m_name

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

The index name.

Definition at line 220 of file Index.h.

◆ m_properties

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

The list of properties that form the index.

Definition at line 221 of file Index.h.

◆ m_type

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

The index type.

Definition at line 218 of file Index.h.


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