ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | List of all members
pool::CollectionDescription Class Reference

#include <CollectionBase/CollectionDescription.h>

Inheritance diagram for pool::CollectionDescription:
Collaboration diagram for pool::CollectionDescription:

Public Member Functions

 CollectionDescription (const std::string &name, const std::string &type, const std::string &connection="", const std::string &eventReferenceColumnName="")
 Constructor that takes as input the minimum amount of properties needed to describe the collection. More...
 
 CollectionDescription (const ICollectionDescription &rhs)
 Copy constructor. More...
 
 CollectionDescription (const CollectionDescription &rhs)
 
virtual ~CollectionDescription ()
 Default destructor. More...
 
CollectionDescriptionoperator= (const ICollectionDescription &rhs)
 Assignment operator. More...
 
CollectionDescriptionoperator= (const CollectionDescription &rhs)
 Assignment operator. More...
 
bool operator== (const CollectionDescription &rhs) const
 Equality operator. More...
 
bool operator!= (const CollectionDescription &rhs) const
 Inequality operator. More...
 
virtual bool equals (const ICollectionDescription &rhs) const
 Check if both Descriptions have the same columns. More...
 
virtual bool isSubsetOf (const ICollectionDescription &rhs) const
 Check if all columns from this Description are present in the rhs Description and if they have the same type. More...
 
virtual void setName (const std::string &name)
 Sets the name of the collection. More...
 
virtual void setType (const std::string &type)
 Sets the storage technology type of the collection. More...
 
virtual void setConnection (const std::string &connection)
 Sets the connection to the database containing the collection. More...
 
virtual void setEventReferenceColumnName (const std::string &columnName)
 Sets the name of the event reference Token column. More...
 
virtual const ICollectionColumninsertColumn (const std::string &columnName, const std::string &columnType, const std::string &annotation="", int maxSize=0, bool sizeIsFixed=true)
 Adds a new column to the collection. More...
 
virtual const ICollectionColumninsertColumn (const std::string &columnName, const std::type_info &columnType, const std::string &annotation="", int maxSize=0, bool sizeIsFixed=true)
 Adds a new column to the collection. More...
 
virtual const ICollectionColumninsertTokenColumn (const std::string &columnName, const std::string &annotation="")
 Adds a new column of type pool::Token to the collection. More...
 
virtual const ICollectionColumnannotateColumn (const std::string &columnName, const std::string &annotation)
 add annotation to column More...
 
virtual void dropColumn (const std::string &columnName)
 Removes a column from the collection description. More...
 
virtual void renameColumn (const std::string &oldName, const std::string &newName)
 Renames a column of the collection description. More...
 
virtual void changeColumnType (const std::string &columnName, const std::string &newType, int maxSize=0, bool sizeIsFixed=true)
 Changes the data type of a column in the collection description. More...
 
virtual void changeColumnType (const std::string &columnName, const std::type_info &newType, int maxSize=0, bool sizeIsFixed=true)
 Changes the data type of a column in the collection description. More...
 
virtual void createIndex (std::string indexName, const std::string &columnName, bool isUnique=false)
 Creates an index on a column of the collection description. More...
 
virtual void createIndex (std::string indexName, const std::vector< std::string > &columnNames, bool isUnique=false)
 Creates an index on one or more columns of the collection description. More...
 
virtual void dropIndex (const std::string &columnName)
 Removes an index from the collection description, given the name of the column on which the index to be removed is applied. More...
 
virtual void dropIndex (const std::vector< std::string > &columnNames)
 Removes an index from a column of the collection description, given the names of the columns on which the index to be removed is applied. More...
 
virtual const std::string & name () const
 Returns the name of the collection and the top level collection fragment. More...
 
virtual const std::string & type () const
 Returns the storage technology type of the collection. More...
 
virtual const std::string & connection () const
 Returns the connection to the database containing the collection. More...
 
virtual const std::string & eventReferenceColumnName () const
 Returns the name reserved for the event reference Token column. More...
 
virtual bool hasEventReferenceColumn () const
 Indicates whether the top level collection fragment contains the event reference column and is therefore defined as a collection. More...
 
virtual int numberOfColumns () const
 Returns the number of columns (including the event reference column if it is used) in the collection. More...
 
virtual const ICollectionColumncolumn (const std::string &columnName) const
 Returns a description object for a column of the collection, given the name of the column. More...
 
virtual const ICollectionColumncolumnPtr (const std::string &columnName) const
 return pointer to Column or NULL if it's not found (will not throw exceptions) More...
 
virtual int numberOfTokenColumns () const
 Returns the number of Token columns (including the event reference column if it is used) More...
 
virtual const ICollectionColumntokenColumn (const std::string &columnName) const
 Returns a description object for a Token column of the collection, given the name of the column. More...
 
virtual const ICollectionColumntokenColumn (int columnId) const
 Returns a description object for a Token column of the collection, given the position of the column. More...
 
virtual int numberOfAttributeColumns () const
 Returns the number of Attribute columns in the collection. More...
 
virtual const ICollectionColumnattributeColumn (const std::string &columnName) const
 Returns a description object for an Attribute column of the collection, given the name of the column. More...
 
virtual const ICollectionColumnattributeColumn (int columnId) const
 Returns a description object for an Attribute column of the collection, given the position of the column. More...
 
const std::vector< pool::CollectionColumn * > & tokenColumns () const
 Returns the Token column description objects. More...
 
const std::vector< pool::CollectionColumn * > & attributeColumns () const
 Returns the Attribute column description objects. More...
 
virtual int numberOfIndices () const
 Returns the number of indices used by the collection. More...
 
virtual const ICollectionIndexindex (const std::string &columnName) const
 Returns a description object for an index of the collection, given the name of the column on which the index is applied. More...
 
virtual const ICollectionIndexindex (const std::vector< std::string > &columnNames) const
 Returns a description object for an index of the collection, given the names of the columns on which the index is applied. More...
 
virtual const ICollectionIndexindex (int indexId) const
 Returns a description object for an index of the collection, given the ID number of the index. More...
 
virtual int setColumnId (const std::string &columnName, int id, const std::string &methodName)
 
virtual void printOut () const
 print out the description (debugging) More...
 

Protected Member Functions

virtual void copyFrom (const ICollectionDescription &rhs)
 make this description a copy of 'rhs' More...
 
virtual void clearAll ()
 
virtual int setColumnId (pool::CollectionColumn *column, int id=-1)
 
virtual void checkNewColumnName (const std::string &name, const std::string &method) const
 
virtual bool isTokenColumn (const std::string &columnName, const std::string &method) const
 
virtual pool::CollectionColumncolumn (const std::string &columnName, const std::string &methodName)
 
virtual const pool::CollectionColumncolumn (const std::string &columnName, const std::string &methodName) const
 

Private Types

typedef std::map< std::string, CollectionColumn * > ColumnByName
 

Private Attributes

std::string m_name
 Name of the collection. More...
 
std::string m_type
 Storage technology type of collection. More...
 
std::string m_connection
 Connection to database containing collection. More...
 
std::string m_eventReferenceColumnName
 Name of event reference column. More...
 
std::vector< pool::CollectionColumn * > m_tokenColumns
 
std::vector< pool::CollectionColumn * > m_attributeColumns
 Attribute column description objects. More...
 
std::map< std::string, int > m_columnIdForColumnName
 Map of column ID numbers for column names IDs are unique in the collection. More...
 
ColumnByName m_tokenColumnForColumnName
 Map of Token CollectionColumn objects using column names as keys. More...
 
ColumnByName m_attributeColumnForColumnName
 Map of Attribute CollectionColumn objects using column names as keys. More...
 
std::vector< CollectionIndex * > m_indices
 Vector of CollectionIndex objects. More...
 

Detailed Description

An implementation of the ICollectionDescription interface used to define the properties of a collection to be constructed and to retrieve these properties after construction. The schema editor of the collection should be used for any modifications to these properties after construction.

Definition at line 27 of file CollectionDescription.h.

Member Typedef Documentation

◆ ColumnByName

typedef std::map< std::string, CollectionColumn* > pool::CollectionDescription::ColumnByName
private

Definition at line 423 of file CollectionDescription.h.

Constructor & Destructor Documentation

◆ CollectionDescription() [1/3]

pool::CollectionDescription::CollectionDescription ( const std::string &  name,
const std::string &  type,
const std::string &  connection = "",
const std::string &  eventReferenceColumnName = "" 
)

Constructor that takes as input the minimum amount of properties needed to describe the collection.

An event reference Token column is inserted by default but may be renamed via a call to ‘setEventReferenceColumnName’ or ‘renameColumn()’ or removed via a call to ‘dropColumn()’ after the collection description object has been constructed.

Parameters
nameName of collection.
typeStorage technology type of collection.
connectionConnection to database containing collection.
eventReferenceColumnNameName of event reference column.

◆ CollectionDescription() [2/3]

pool::CollectionDescription::CollectionDescription ( const ICollectionDescription rhs)

Copy constructor.

Parameters
rhsCollection description object to copy.

◆ CollectionDescription() [3/3]

pool::CollectionDescription::CollectionDescription ( const CollectionDescription rhs)

◆ ~CollectionDescription()

virtual pool::CollectionDescription::~CollectionDescription ( )
virtual

Default destructor.

Member Function Documentation

◆ annotateColumn()

virtual const ICollectionColumn& pool::CollectionDescription::annotateColumn ( const std::string &  columnName,
const std::string &  annotation 
)
virtual

add annotation to column

Implements pool::ICollectionSchemaEditor.

◆ attributeColumn() [1/2]

virtual const ICollectionColumn& pool::CollectionDescription::attributeColumn ( const std::string &  columnName) const
virtual

Returns a description object for an Attribute column of the collection, given the name of the column.

Parameters
columnNameName of column.

Implements pool::ICollectionDescription.

◆ attributeColumn() [2/2]

virtual const ICollectionColumn& pool::CollectionDescription::attributeColumn ( int  columnId) const
virtual

Returns a description object for an Attribute column of the collection, given the position of the column.

Parameters
columnIdPosition of column in associated collection fragment.

Implements pool::ICollectionDescription.

◆ attributeColumns()

const std::vector< pool::CollectionColumn* >& pool::CollectionDescription::attributeColumns ( ) const
inline

Returns the Attribute column description objects.

Definition at line 338 of file CollectionDescription.h.

338 { return m_attributeColumns; }

◆ changeColumnType() [1/2]

virtual void pool::CollectionDescription::changeColumnType ( const std::string &  columnName,
const std::string &  newType,
int  maxSize = 0,
bool  sizeIsFixed = true 
)
virtual

Changes the data type of a column in the collection description.

Throws and exception if an attempt is made to change the data type of the event reference Token column.

Parameters
columnNameName of column whose type is to be changed.
newTypeNew data type assigned to column.
maxSizeMaximum size of new data type (useful for string and blob types).
sizeIsFixedFlag indicating whether size of new data type is fixed (useful for string and blob types).

◆ changeColumnType() [2/2]

virtual void pool::CollectionDescription::changeColumnType ( const std::string &  columnName,
const std::type_info &  newType,
int  maxSize = 0,
bool  sizeIsFixed = true 
)
virtual

Changes the data type of a column in the collection description.

Throws and exception if an attempt is made to change the data type of the event reference Token column.

Parameters
columnNameName of column whose type is to be changed.
newTypeNew data type assigned to column.
maxSizeMaximum size of new data type (useful for string and blob types).
sizeIsFixedFlag indicating whether size of new data type is fixed (useful for string and blob types).

◆ checkNewColumnName()

virtual void pool::CollectionDescription::checkNewColumnName ( const std::string &  name,
const std::string &  method 
) const
protectedvirtual

◆ clearAll()

virtual void pool::CollectionDescription::clearAll ( )
protectedvirtual

◆ column() [1/3]

virtual const ICollectionColumn& pool::CollectionDescription::column ( const std::string &  columnName) const
virtual

Returns a description object for a column of the collection, given the name of the column.

Parameters
columnNameName of column.

Implements pool::ICollectionDescription.

◆ column() [2/3]

virtual pool::CollectionColumn* pool::CollectionDescription::column ( const std::string &  columnName,
const std::string &  methodName 
)
protectedvirtual

◆ column() [3/3]

virtual const pool::CollectionColumn* pool::CollectionDescription::column ( const std::string &  columnName,
const std::string &  methodName 
) const
protectedvirtual

◆ columnPtr()

virtual const ICollectionColumn* pool::CollectionDescription::columnPtr ( const std::string &  columnName) const
virtual

return pointer to Column or NULL if it's not found (will not throw exceptions)

Implements pool::ICollectionDescription.

◆ connection()

virtual const std::string& pool::CollectionDescription::connection ( ) const
virtual

Returns the connection to the database containing the collection.

Implements pool::ICollectionDescription.

◆ copyFrom()

virtual void pool::CollectionDescription::copyFrom ( const ICollectionDescription rhs)
protectedvirtual

make this description a copy of 'rhs'

◆ createIndex() [1/2]

virtual void pool::CollectionDescription::createIndex ( std::string  indexName,
const std::string &  columnName,
bool  isUnique = false 
)
virtual

Creates an index on a column of the collection description.

Automatically generates a unique name for the index.

Parameters
columnNameName of column for which index is created.
isUniqueFlag to indicate whether indexed column values must be unique.

◆ createIndex() [2/2]

virtual void pool::CollectionDescription::createIndex ( std::string  indexName,
const std::vector< std::string > &  columnNames,
bool  isUnique = false 
)
virtual

Creates an index on one or more columns of the collection description.

Automatically generates a unique name for the index.

Parameters
columnNamesNames of columns for which index is to be created.
isUniqueFlag to indicates whether combination of indexed column values must be unique.

◆ dropColumn()

virtual void pool::CollectionDescription::dropColumn ( const std::string &  columnName)
virtual

Removes a column from the collection description.

Parameters
columnNameName of column to be removed.

Implements pool::ICollectionSchemaEditor.

◆ dropIndex() [1/2]

virtual void pool::CollectionDescription::dropIndex ( const std::string &  columnName)
virtual

Removes an index from the collection description, given the name of the column on which the index to be removed is applied.

Parameters
columnNameName of column on which index to be removed is applied.

◆ dropIndex() [2/2]

virtual void pool::CollectionDescription::dropIndex ( const std::vector< std::string > &  columnNames)
virtual

Removes an index from a column of the collection description, given the names of the columns on which the index to be removed is applied.

Parameters
columnNamesNames of columns on which index to be removed is applied.

◆ equals()

virtual bool pool::CollectionDescription::equals ( const ICollectionDescription rhs) const
virtual

Check if both Descriptions have the same columns.

Parameters
rhsCollection description object to compare.

Implements pool::ICollectionDescription.

◆ eventReferenceColumnName()

virtual const std::string& pool::CollectionDescription::eventReferenceColumnName ( ) const
virtual

Returns the name reserved for the event reference Token column.

If the name has not been set by the user a default name is returned.

Implements pool::ICollectionDescription.

◆ hasEventReferenceColumn()

virtual bool pool::CollectionDescription::hasEventReferenceColumn ( ) const
virtual

Indicates whether the top level collection fragment contains the event reference column and is therefore defined as a collection.

Implements pool::ICollectionDescription.

◆ index() [1/3]

virtual const ICollectionIndex& pool::CollectionDescription::index ( const std::string &  columnName) const
virtual

Returns a description object for an index of the collection, given the name of the column on which the index is applied.

Parameters
columnNameName of column on which index is applied.

Implements pool::ICollectionDescription.

◆ index() [2/3]

virtual const ICollectionIndex& pool::CollectionDescription::index ( const std::vector< std::string > &  columnNames) const
virtual

Returns a description object for an index of the collection, given the names of the columns on which the index is applied.

Parameters
columnNamesNames of columns on which index is applied.

Implements pool::ICollectionDescription.

◆ index() [3/3]

virtual const ICollectionIndex& pool::CollectionDescription::index ( int  indexId) const
virtual

Returns a description object for an index of the collection, given the ID number of the index.

Parameters
indexIdID of index.

Implements pool::ICollectionDescription.

◆ insertColumn() [1/2]

virtual const ICollectionColumn& pool::CollectionDescription::insertColumn ( const std::string &  columnName,
const std::string &  columnType,
const std::string &  annotation = "",
int  maxSize = 0,
bool  sizeIsFixed = true 
)
virtual

Adds a new column to the collection.

Parameters
columnNameName of new column.
columnTypeData type of new column.
maxSizeMaximum size of column data type (useful for string or blob data types).
sizeIsFixedFlag indicating whether size of column data type is fixed (useful for string or blob data types).

Implements pool::ICollectionSchemaEditor.

◆ insertColumn() [2/2]

virtual const ICollectionColumn& pool::CollectionDescription::insertColumn ( const std::string &  columnName,
const std::type_info &  columnType,
const std::string &  annotation = "",
int  maxSize = 0,
bool  sizeIsFixed = true 
)
virtual

Adds a new column to the collection.

Parameters
columnNameName of new column.
columnTypeData type of new column.
maxSizeMaximum size of column data type (useful for string or blob data types).
sizeIsFixedFlag indicating whether size of column data type is fixed (useful for string or blob data types).

Implements pool::ICollectionSchemaEditor.

◆ insertTokenColumn()

virtual const ICollectionColumn& pool::CollectionDescription::insertTokenColumn ( const std::string &  columnName,
const std::string &  annotation = "" 
)
virtual

Adds a new column of type pool::Token to the collection.

Parameters
columnNameName of new column.

Implements pool::ICollectionSchemaEditor.

◆ isSubsetOf()

virtual bool pool::CollectionDescription::isSubsetOf ( const ICollectionDescription rhs) const
virtual

Check if all columns from this Description are present in the rhs Description and if they have the same type.

Parameters
rhsCollection description object to compare.

Implements pool::ICollectionDescription.

◆ isTokenColumn()

virtual bool pool::CollectionDescription::isTokenColumn ( const std::string &  columnName,
const std::string &  method 
) const
protectedvirtual

◆ name()

virtual const std::string& pool::CollectionDescription::name ( ) const
virtual

Returns the name of the collection and the top level collection fragment.

Implements pool::ICollectionDescription.

◆ numberOfAttributeColumns()

virtual int pool::CollectionDescription::numberOfAttributeColumns ( ) const
virtual

Returns the number of Attribute columns in the collection.

Implements pool::ICollectionDescription.

◆ numberOfColumns()

virtual int pool::CollectionDescription::numberOfColumns ( ) const
virtual

Returns the number of columns (including the event reference column if it is used) in the collection.

Implements pool::ICollectionDescription.

◆ numberOfIndices()

virtual int pool::CollectionDescription::numberOfIndices ( ) const
virtual

Returns the number of indices used by the collection.

Implements pool::ICollectionDescription.

◆ numberOfTokenColumns()

virtual int pool::CollectionDescription::numberOfTokenColumns ( ) const
virtual

Returns the number of Token columns (including the event reference column if it is used)

Implements pool::ICollectionDescription.

◆ operator!=()

Inequality operator.

Parameters
rhsCollection description object to compare.

◆ operator=() [1/2]

CollectionDescription& pool::CollectionDescription::operator= ( const CollectionDescription rhs)
inline

Assignment operator.

Parameters
rhssource CollectionDescription object to copy.

Definition at line 70 of file CollectionDescription.h.

71  { operator=( (const ICollectionDescription&) rhs ); return *this; }

◆ operator=() [2/2]

CollectionDescription& pool::CollectionDescription::operator= ( const ICollectionDescription rhs)

Assignment operator.

Parameters
rhssource ICollectionDescription object to copy.

◆ operator==()

bool pool::CollectionDescription::operator== ( const CollectionDescription rhs) const

Equality operator.

Parameters
rhsCollection description object to compare.

◆ printOut()

virtual void pool::CollectionDescription::printOut ( ) const
virtual

print out the description (debugging)

Reimplemented from pool::ICollectionDescription.

◆ renameColumn()

virtual void pool::CollectionDescription::renameColumn ( const std::string &  oldName,
const std::string &  newName 
)
virtual

Renames a column of the collection description.

Parameters
oldNameOld name of column.
newNameNew name of column.

Implements pool::ICollectionSchemaEditor.

◆ setColumnId() [1/2]

virtual int pool::CollectionDescription::setColumnId ( const std::string &  columnName,
int  id,
const std::string &  methodName 
)
virtual

◆ setColumnId() [2/2]

virtual int pool::CollectionDescription::setColumnId ( pool::CollectionColumn column,
int  id = -1 
)
protectedvirtual

◆ setConnection()

virtual void pool::CollectionDescription::setConnection ( const std::string &  connection)
virtual

Sets the connection to the database containing the collection.

Parameters
connectionConnection to database where collection is stored.

◆ setEventReferenceColumnName()

virtual void pool::CollectionDescription::setEventReferenceColumnName ( const std::string &  columnName)
virtual

Sets the name of the event reference Token column.

Otherwise a default name is used.

Parameters
columnNameName of event reference Token column.

Implements pool::ICollectionSchemaEditor.

◆ setName()

virtual void pool::CollectionDescription::setName ( const std::string &  name)
virtual

Sets the name of the collection.

Parameters
nameName of collection.

◆ setType()

virtual void pool::CollectionDescription::setType ( const std::string &  type)
virtual

Sets the storage technology type of the collection.

Parameters
typeStorage technology type of collection.

◆ tokenColumn() [1/2]

virtual const ICollectionColumn& pool::CollectionDescription::tokenColumn ( const std::string &  columnName) const
virtual

Returns a description object for a Token column of the collection, given the name of the column.

Parameters
columnNameName of column.

Implements pool::ICollectionDescription.

◆ tokenColumn() [2/2]

virtual const ICollectionColumn& pool::CollectionDescription::tokenColumn ( int  columnId) const
virtual

Returns a description object for a Token column of the collection, given the position of the column.

Parameters
columnIdPosition of column in associated collection fragment.

Implements pool::ICollectionDescription.

◆ tokenColumns()

const std::vector< pool::CollectionColumn* >& pool::CollectionDescription::tokenColumns ( ) const
inline

Returns the Token column description objects.

Definition at line 335 of file CollectionDescription.h.

335 { return m_tokenColumns; }

◆ type()

virtual const std::string& pool::CollectionDescription::type ( ) const
virtual

Returns the storage technology type of the collection.

Implements pool::ICollectionDescription.

Member Data Documentation

◆ m_attributeColumnForColumnName

ColumnByName pool::CollectionDescription::m_attributeColumnForColumnName
private

Map of Attribute CollectionColumn objects using column names as keys.

Definition at line 428 of file CollectionDescription.h.

◆ m_attributeColumns

std::vector< pool::CollectionColumn* > pool::CollectionDescription::m_attributeColumns
private

Attribute column description objects.

Definition at line 417 of file CollectionDescription.h.

◆ m_columnIdForColumnName

std::map< std::string, int > pool::CollectionDescription::m_columnIdForColumnName
private

Map of column ID numbers for column names IDs are unique in the collection.

Definition at line 421 of file CollectionDescription.h.

◆ m_connection

std::string pool::CollectionDescription::m_connection
private

Connection to database containing collection.

Definition at line 408 of file CollectionDescription.h.

◆ m_eventReferenceColumnName

std::string pool::CollectionDescription::m_eventReferenceColumnName
private

Name of event reference column.

Definition at line 411 of file CollectionDescription.h.

◆ m_indices

std::vector< CollectionIndex* > pool::CollectionDescription::m_indices
private

Vector of CollectionIndex objects.

Definition at line 431 of file CollectionDescription.h.

◆ m_name

std::string pool::CollectionDescription::m_name
private

Name of the collection.

Definition at line 402 of file CollectionDescription.h.

◆ m_tokenColumnForColumnName

ColumnByName pool::CollectionDescription::m_tokenColumnForColumnName
private

Map of Token CollectionColumn objects using column names as keys.

Definition at line 425 of file CollectionDescription.h.

◆ m_tokenColumns

std::vector< pool::CollectionColumn* > pool::CollectionDescription::m_tokenColumns
private

Definition at line 414 of file CollectionDescription.h.

◆ m_type

std::string pool::CollectionDescription::m_type
private

Storage technology type of collection.

Definition at line 405 of file CollectionDescription.h.


The documentation for this class was generated from the following file:
pool::CollectionDescription::m_tokenColumns
std::vector< pool::CollectionColumn * > m_tokenColumns
Definition: CollectionDescription.h:414
pool::CollectionDescription::operator=
CollectionDescription & operator=(const ICollectionDescription &rhs)
Assignment operator.
pool::CollectionDescription::m_attributeColumns
std::vector< pool::CollectionColumn * > m_attributeColumns
Attribute column description objects.
Definition: CollectionDescription.h:417