CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::persistency::TableDescription< Types > Class Template Reference

#include <DbCore.h>

Public Member Functions

template<typename... ColumnTypes>
void createIndex (const std::string &name)
 
const coral::TableDescription & get ()
 
template<typename Column , typename ReferencedColumn >
void setForeignKey (const std::string &name)
 
template<typename... ColumnTypes>
void setPrimaryKey ()
 
template<typename... ColumnTypes>
void setUniqueConstraint (const std::string &name)
 
 TableDescription (const char *name)
 

Private Member Functions

template<int n>
void _makeList (std::vector< std::string > &)
 
template<int n, typename Arg1 , typename... Args>
void _makeList (std::vector< std::string > &columnNames)
 
template<int n>
void addColumn (coral::TableDescription &)
 
template<int n, typename Arg1 , typename... Args>
void addColumn (coral::TableDescription &tableDescription)
 
template<int , typename Col1 , typename... Cols>
void checkColumns ()
 
template<int >
void checkColumns ()
 
template<typename... ColumnTypes>
std::vector< std::string > makeList ()
 

Private Attributes

coral::TableDescription m_description
 

Detailed Description

template<typename... Types>
class cond::persistency::TableDescription< Types >

Definition at line 219 of file DbCore.h.

Constructor & Destructor Documentation

template<typename... Types>
cond::persistency::TableDescription< Types >::TableDescription ( const char *  name)
inlineexplicit

Definition at line 239 of file DbCore.h.

References cond::persistency::TableDescription< Types >::addColumn(), and cond::persistency::TableDescription< Types >::m_description.

239  :
240  m_description( "ConditionDatabase" ){
241  m_description.setName( name );
242  addColumn<0,Types...>( m_description );
243  }
void addColumn(coral::TableDescription &)
Definition: DbCore.h:222
coral::TableDescription m_description
Definition: DbCore.h:285

Member Function Documentation

template<typename... Types>
template<int n>
void cond::persistency::TableDescription< Types >::_makeList ( std::vector< std::string > &  )
inlineprivate
template<typename... Types>
template<int n, typename Arg1 , typename... Args>
void cond::persistency::TableDescription< Types >::_makeList ( std::vector< std::string > &  columnNames)
inlineprivate

Definition at line 273 of file DbCore.h.

References cond::persistency::TableDescription< Types >::_makeList(), n, and mergeVDriftHistosByStation::name.

273  {
274  columnNames.push_back( Arg1::name );
275  _makeList<n+1, Args...>( columnNames );
276  }
void _makeList(std::vector< std::string > &)
Definition: DbCore.h:271
template<typename... Types>
template<int n>
void cond::persistency::TableDescription< Types >::addColumn ( coral::TableDescription< Types > &  )
inlineprivate
template<typename... Types>
template<int n, typename Arg1 , typename... Args>
void cond::persistency::TableDescription< Types >::addColumn ( coral::TableDescription< Types > &  tableDescription)
inlineprivate
template<typename... Types>
template<int , typename Col1 , typename... Cols>
void cond::persistency::TableDescription< Types >::checkColumns ( )
inlineprivate

Definition at line 230 of file DbCore.h.

Referenced by cond::persistency::TableDescription< Types >::createIndex(), cond::persistency::TableDescription< Types >::setPrimaryKey(), and cond::persistency::TableDescription< Types >::setUniqueConstraint().

230  {
231  static_assert(is_same_any<Col1,Types...>(), "Specified Column has not been found in the table.");
232  checkColumns<0,Cols...>();
233  }
template<typename... Types>
template<int >
void cond::persistency::TableDescription< Types >::checkColumns ( )
inlineprivate

Definition at line 235 of file DbCore.h.

235  {
236  }
template<typename... Types>
template<typename... ColumnTypes>
void cond::persistency::TableDescription< Types >::createIndex ( const std::string &  name)
inline

Definition at line 256 of file DbCore.h.

References cond::persistency::TableDescription< Types >::checkColumns(), and cond::persistency::TableDescription< Types >::m_description.

256  {
257  checkColumns<0,ColumnTypes...>();
258  m_description.createIndex( name, makeList<ColumnTypes...>() );
259  }
coral::TableDescription m_description
Definition: DbCore.h:285
template<typename... Types>
const coral::TableDescription& cond::persistency::TableDescription< Types >::get ( void  )
inline
template<typename... Types>
template<typename... ColumnTypes>
std::vector<std::string> cond::persistency::TableDescription< Types >::makeList ( )
inlineprivate

Definition at line 278 of file DbCore.h.

References cond::persistency::TableDescription< Types >::_makeList().

278  {
279  std::vector<std::string> columnList;
280  _makeList<0,ColumnTypes...>( columnList );
281  return columnList;
282  }
void _makeList(std::vector< std::string > &)
Definition: DbCore.h:271
template<typename... Types>
template<typename Column , typename ReferencedColumn >
void cond::persistency::TableDescription< Types >::setForeignKey ( const std::string &  name)
inline

Definition at line 261 of file DbCore.h.

References cond::persistency::TableDescription< Types >::m_description, and mergeVDriftHistosByStation::name.

Referenced by cond::persistency::IOV::Table::create(), and cond::persistency::TAG_MIGRATION::Table::create().

261  {
262  checkColumns<0,Column>();
263  m_description.createForeignKey( name, Column::name, ReferencedColumn::tableName(), ReferencedColumn::name );
264  }
coral::TableDescription m_description
Definition: DbCore.h:285
template<typename... Types>
template<typename... ColumnTypes>
void cond::persistency::TableDescription< Types >::setPrimaryKey ( )
inline
template<typename... Types>
template<typename... ColumnTypes>
void cond::persistency::TableDescription< Types >::setUniqueConstraint ( const std::string &  name)
inline

Definition at line 251 of file DbCore.h.

References cond::persistency::TableDescription< Types >::checkColumns(), and cond::persistency::TableDescription< Types >::m_description.

251  {
252  checkColumns<0,ColumnTypes...>();
253  m_description.setUniqueConstraint( makeList<ColumnTypes...>(), name );
254  }
coral::TableDescription m_description
Definition: DbCore.h:285

Member Data Documentation

template<typename... Types>
coral::TableDescription cond::persistency::TableDescription< Types >::m_description
private