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
ora::TableRegister Class Reference

#include <TableRegister.h>

Public Member Functions

bool checkColumn (const std::string &tableName, const std::string &columnName)
 
bool checkTable (const std::string &tableName)
 
bool insertColumn (const std::string &tableName, const std::string &columnName)
 
bool insertColumns (const std::string &tableName, const std::vector< std::string > &columns)
 
void insertTable (const std::string &tableName)
 
size_t numberOfColumns (const std::string &tableName)
 
 TableRegister (coral::ISchema &schema)
 
virtual ~TableRegister ()
 

Private Member Functions

void init ()
 

Private Attributes

std::set< std::string > * m_currentColumns
 
const std::string * m_currentTable
 
bool m_init
 
std::map< std::string,
std::set< std::string > > 
m_register
 
coral::ISchema & m_schema
 

Detailed Description

Definition at line 16 of file TableRegister.h.

Constructor & Destructor Documentation

ora::TableRegister::TableRegister ( coral::ISchema &  schema)
explicit

Definition at line 9 of file TableRegister.cc.

9  :
11 }
coral::ISchema & m_schema
Definition: TableRegister.h:42
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
ora::TableRegister::~TableRegister ( )
virtual

Definition at line 13 of file TableRegister.cc.

13  {
14 }

Member Function Documentation

bool ora::TableRegister::checkColumn ( const std::string &  tableName,
const std::string &  columnName 
)

Definition at line 47 of file TableRegister.cc.

References init.

Referenced by ora::processLeafElement().

48  {
49  init();
50  if(!m_currentTable || (tableName!=*m_currentTable)){
51  std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
52  if(iT==m_register.end()) {
53  m_currentTable = 0;
54  m_currentColumns = 0;
55  return false;
56  }
57  m_currentTable = &iT->first;
58  m_currentColumns = &iT->second;
59  }
60  return m_currentColumns->find(columnName)!=m_currentColumns->end();
61 }
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
bool ora::TableRegister::checkTable ( const std::string &  tableName)

Definition at line 32 of file TableRegister.cc.

References init.

Referenced by ora::processLeafElement().

32  {
33  init();
34  if(!m_currentTable || (tableName!=*m_currentTable)){
35  std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
36  if(iT==m_register.end()) {
37  m_currentTable = 0;
38  m_currentColumns = 0;
39  return false;
40  }
41  m_currentTable = &iT->first;
42  m_currentColumns = &iT->second;
43  }
44  return true;
45 }
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
void ora::TableRegister::init ( void  )
private

Definition at line 16 of file TableRegister.cc.

References i, and asciidump::table.

16  {
17  if(!m_init){
18  std::set<std::string> tableList = m_schema.listTables();
19  for( std::set<std::string>::const_iterator iT = tableList.begin(); iT != tableList.end(); ++iT ){
20  coral::ITable& table = m_schema.tableHandle( *iT );
21  std::map<std::string,std::set<std::string> >::iterator iEntry =
22  m_register.insert( std::make_pair( *iT, std::set<std::string>() ) ).first;
23  int ncols = table.description().numberOfColumns();
24  for(int i=0;i<ncols;i++){
25  iEntry->second.insert( table.description().columnDescription( i ).name() );
26  }
27  }
28  m_init = true;
29  }
30 }
list table
Definition: asciidump.py:386
int i
Definition: DBlmapReader.cc:9
coral::ISchema & m_schema
Definition: TableRegister.h:42
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
bool ora::TableRegister::insertColumn ( const std::string &  tableName,
const std::string &  columnName 
)

Definition at line 71 of file TableRegister.cc.

References init.

Referenced by ora::processLeafElement().

72  {
73  init();
74  if(!m_currentTable || (tableName!=*m_currentTable)){
75  std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
76  if(iT==m_register.end()) {
77  m_currentTable = 0;
78  m_currentColumns = 0;
79  return false;
80  }
81  m_currentTable = &iT->first;
82  m_currentColumns = &iT->second;
83  }
84  m_currentColumns->insert( columnName );
85  return true;
86 }
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
bool ora::TableRegister::insertColumns ( const std::string &  tableName,
const std::vector< std::string > &  columns 
)

Definition at line 88 of file TableRegister.cc.

References init.

89  {
90 
91  init();
92  if(!m_currentTable || (tableName!=*m_currentTable)){
93  std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
94  if(iT==m_register.end()) {
95  m_currentTable = 0;
96  m_currentColumns = 0;
97  return false;
98  }
99  m_currentTable = &iT->first;
100  m_currentColumns = &iT->second;
101  }
102  for( std::vector<std::string>::const_iterator iC = columns.begin(); iC != columns.end(); iC++ ){
103  m_currentColumns->insert( *iC );
104  }
105  return true;
106 }
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
void ora::TableRegister::insertTable ( const std::string &  tableName)

Definition at line 64 of file TableRegister.cc.

References init.

64  {
65  init();
66  m_register.insert( std::make_pair(tableName, std::set<std::string>()) );
67  m_currentTable = 0;
68  m_currentColumns = 0;
69 }
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46
size_t ora::TableRegister::numberOfColumns ( const std::string &  tableName)

Definition at line 108 of file TableRegister.cc.

References init.

108  {
109  init();
110  if(!m_currentTable || (tableName!=*m_currentTable)){
111  std::map<std::string, std::set<std::string> >::iterator iT = m_register.find( tableName );
112  if(iT==m_register.end()) {
113  m_currentTable = 0;
114  m_currentColumns = 0;
115  return 0;
116  }
117  m_currentTable = &iT->first;
118  m_currentColumns = &iT->second;
119  }
120  return m_currentColumns->size();
121 }
const std::string * m_currentTable
Definition: TableRegister.h:48
std::set< std::string > * m_currentColumns
Definition: TableRegister.h:50
std::map< std::string, std::set< std::string > > m_register
Definition: TableRegister.h:46

Member Data Documentation

std::set<std::string>* ora::TableRegister::m_currentColumns
private

Definition at line 50 of file TableRegister.h.

const std::string* ora::TableRegister::m_currentTable
private

Definition at line 48 of file TableRegister.h.

bool ora::TableRegister::m_init
private

Definition at line 44 of file TableRegister.h.

std::map<std::string,std::set<std::string> > ora::TableRegister::m_register
private

Definition at line 46 of file TableRegister.h.

coral::ISchema& ora::TableRegister::m_schema
private

Definition at line 42 of file TableRegister.h.