te::da::UniqueKey Class Reference

It describes a unique key (uk) constraint. More...

#include <UniqueKey.h>

Inheritance diagram for te::da::UniqueKey:
te::da::Constraint

Public Member Functions

void add (te::dt::Property *p)
 It adds the property to the list of properties that participates in the unique key. More...
 
Constraintclone ()
 It returns a clone of the object. More...
 
IndexgetAssociatedIndex () const
 It returns the associated index if one exists. More...
 
virtual DataSetTypegetDataSetType () const
 It returns the DataSetType associated to the constraint. More...
 
virtual unsigned int getId () const
 It returns the constraint identifier. More...
 
virtual const std::string & getName () const
 It returns the constraint name. More...
 
const std::vector< te::dt::Property * > & getProperties () const
 It returns the properties that form the unique key. More...
 
ConstraintType getType () const
 It returns the constraint type: UNIQUEKEY. More...
 
bool has (const te::dt::Property *p) const
 It verifies if Property is associated to the unique key. More...
 
UniqueKeyoperator= (const UniqueKey &rhs)
 Assignment operator. More...
 
void replace (te::dt::Property *p, te::dt::Property *pp)
 
void setAssociatedIndex (Index *idx)
 It sets the associated index. More...
 
virtual void setDataSetType (DataSetType *dt)
 It sets the DataSetType associated to the constraint. More...
 
virtual void setId (unsigned int id)
 It sets the constraint identifier. More...
 
virtual void setName (const std::string &name)
 It sets the constraint name. More...
 
void setProperties (const std::vector< te::dt::Property * > &properties)
 It sets the properties that form the unique key. More...
 
 UniqueKey (DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 UniqueKey (const std::string &name, DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 UniqueKey (const UniqueKey &rhs)
 Copy constructor. More...
 
 ~UniqueKey ()
 Destructor. More...
 

Private Attributes

Indexm_index
 A pointer to an associated index. More...
 
std::vector< te::dt::Property * > m_properties
 The properties that are part of the unique key constraint. More...
 

Detailed Description

It describes a unique key (uk) constraint.

See also
DataSetType, Index, PrimaryKey, ForeignKey, DataSetTypeCheckRestriction

Definition at line 53 of file UniqueKey.h.

Constructor & Destructor Documentation

te::da::UniqueKey::UniqueKey ( DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
dtThe DataSetType associated to this uk.
idThe uk identifier.
Postcondition
If dt is provided, the uk 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::UniqueKey::UniqueKey ( const std::string &  name,
DataSetType dt = 0,
unsigned int  id = 0 
)

Constructor.

Parameters
nameThe unique key (uk) constraint name.
dtThe DataSetType associated to this uk.
idThe uk identifier.
Postcondition
If dt is provided, the uk 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::UniqueKey::UniqueKey ( const UniqueKey rhs)

Copy constructor.

The new object will not have an associated DataSetType.

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

Destructor.

Definition at line 92 of file UniqueKey.h.

Member Function Documentation

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

It adds the property to the list of properties that participates in the unique key.

Parameters
pThe Property that will take part of the unique key.

Definition at line 124 of file UniqueKey.h.

Constraint* te::da::UniqueKey::clone ( )
virtual

It returns a clone of the object.

The new object will not have an associated DataSetType.

Returns
A clone of the object.

Implements te::da::Constraint.

Index* te::da::UniqueKey::getAssociatedIndex ( ) const
inline

It returns the associated index if one exists.

Returns
An associated index if one exists.

Definition at line 131 of file UniqueKey.h.

virtual DataSetType* te::da::Constraint::getDataSetType ( ) const
inlinevirtualinherited

It returns the DataSetType associated to the constraint.

Returns
The DataSetType associated to the constraint.

Definition at line 133 of file Constraint.h.

virtual unsigned int te::da::Constraint::getId ( ) const
inlinevirtualinherited

It returns the constraint identifier.

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

Definition at line 103 of file Constraint.h.

virtual const std::string& te::da::Constraint::getName ( ) const
inlinevirtualinherited

It returns the constraint name.

Returns
The constraint name.

Definition at line 119 of file Constraint.h.

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

It returns the properties that form the unique key.

Returns
The properties that form the unique key.

Definition at line 110 of file UniqueKey.h.

ConstraintType te::da::UniqueKey::getType ( ) const
inlinevirtual

It returns the constraint type: UNIQUEKEY.

Returns
The constraint type UNIQUEKEY.

Implements te::da::Constraint.

Definition at line 164 of file UniqueKey.h.

References te::da::UNIQUE_KEY.

bool te::da::UniqueKey::has ( const te::dt::Property p) const

It verifies if Property is associated to the unique key.

Parameters
pThe Property to be verified.
Returns
True if Property is associated to the unique key, false otherwise.
UniqueKey& te::da::UniqueKey::operator= ( const UniqueKey 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::UniqueKey::replace ( te::dt::Property p,
te::dt::Property pp 
)
void te::da::UniqueKey::setAssociatedIndex ( Index idx)
inline

It sets the associated index.

Parameters
idxA index associated to the unique key.

Definition at line 138 of file UniqueKey.h.

virtual void te::da::Constraint::setDataSetType ( DataSetType dt)
inlinevirtualinherited

It sets the DataSetType associated to the constraint.

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

Definition at line 143 of file Constraint.h.

virtual void te::da::Constraint::setId ( unsigned int  id)
inlinevirtualinherited

It sets the constraint identifier.

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

Definition at line 112 of file Constraint.h.

virtual void te::da::Constraint::setName ( const std::string &  name)
inlinevirtualinherited

It sets the constraint name.

Parameters
nameThe constraint name.

Definition at line 126 of file Constraint.h.

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

It sets the properties that form the unique key.

Parameters
propertiesThe properties that form the unique key.

Definition at line 117 of file UniqueKey.h.

Member Data Documentation

Index* te::da::UniqueKey::m_index
private

A pointer to an associated index.

Definition at line 177 of file UniqueKey.h.

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

The properties that are part of the unique key constraint.

Definition at line 178 of file UniqueKey.h.


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