te::da::PrimaryKey Class Reference

It describes a primary key (pk) constraint. More...

#include <PrimaryKey.h>

Inheritance diagram for te::da::PrimaryKey:
te::da::Constraint

Public Member Functions

void add (te::dt::Property *p)
 It adds a property to the list of properties of the primary 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 take part of the primary key. More...
 
ConstraintType getType () const
 It returns the constraint type: PRIMARYKEY. More...
 
bool has (const te::dt::Property *p) const
 It verifies if Property is associated to the primary key. More...
 
PrimaryKeyoperator= (const PrimaryKey &rhs)
 Assignment operator. More...
 
 PrimaryKey (DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 PrimaryKey (const std::string &name, DataSetType *dt=0, unsigned int id=0)
 Constructor. More...
 
 PrimaryKey (const PrimaryKey &rhs)
 Copy constructor. More...
 
void replace (te::dt::Property *p, te::dt::Property *pp)
 It changes a reference to property p to pp. More...
 
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 primary key. More...
 
 ~PrimaryKey ()
 Destructor. More...
 

Private Attributes

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

Detailed Description

It describes a primary key (pk) constraint.

See also
DataSetType, UniqueKey, ForeignKey, CheckConstraint

Definition at line 52 of file PrimaryKey.h.

Constructor & Destructor Documentation

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

Constructor.

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

Constructor.

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

Copy constructor.

The new object will not have an assigned DataSetType.

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

Destructor.

Definition at line 91 of file PrimaryKey.h.

Member Function Documentation

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

It adds a property to the list of properties of the primary key.

Parameters
pThe property that will take part of the primary key.

Definition at line 123 of file PrimaryKey.h.

Constraint* te::da::PrimaryKey::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::PrimaryKey::getAssociatedIndex ( ) const
inline

It returns the associated index if one exists.

Returns
An associated index if one exists.

Definition at line 137 of file PrimaryKey.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::PrimaryKey::getProperties ( ) const
inline

It returns the properties that take part of the primary key.

Returns
The properties that take part of the primary key.

Definition at line 109 of file PrimaryKey.h.

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

It returns the constraint type: PRIMARYKEY.

Returns
The constraint type PRIMARYKEY.

Implements te::da::Constraint.

Definition at line 163 of file PrimaryKey.h.

References te::da::PRIMARY_KEY.

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

It verifies if Property is associated to the primary key.

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

It changes a reference to property p to pp.

Parameters
pA property that takes part of the primary key.
ppThe property that will take p place.
Note
If p is not found in the primary key attribute list this method does nothing.
void te::da::PrimaryKey::setAssociatedIndex ( Index idx)
inline

It sets the associated index.

Parameters
idxIf the primary key is associated to an index, this method will associate them.

Definition at line 130 of file PrimaryKey.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::PrimaryKey::setProperties ( const std::vector< te::dt::Property * > &  properties)
inline

It sets the properties that form the primary key.

Parameters
propertiesThe properties that form the primary key.

Definition at line 116 of file PrimaryKey.h.

Member Data Documentation

Index* te::da::PrimaryKey::m_index
private

A pointer to an associated index.

Definition at line 176 of file PrimaryKey.h.

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

The properties that take part of primary key constraint.

Definition at line 177 of file PrimaryKey.h.


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