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

#include <PoolDatabaseSchema.h>

Public Member Functions

void add (int id, const PoolDbCacheData &data)
 
void clear ()
 
PoolDbCacheDatafind (int id)
 
int idByName (const std::string &name)
 
const std::string & nameById (int id)
 
 PoolDbCache ()
 
void remove (int id)
 
std::map< std::string,
PoolDbCacheData * > & 
sequences ()
 
 ~PoolDbCache ()
 

Private Attributes

PoolDbCacheData m_databaseData
 
std::map< int, PoolDbCacheDatam_idMap
 
PoolDbCacheData m_mappingData
 
std::map< std::string,
PoolDbCacheData * > 
m_sequences
 

Detailed Description

Definition at line 29 of file PoolDatabaseSchema.h.

Constructor & Destructor Documentation

ora::PoolDbCache::PoolDbCache ( )

Definition at line 340 of file PoolDatabaseSchema.cc.

References m_databaseData, m_mappingData, and ora::PoolDbCacheData::m_nobjWr.

340  :
341  m_databaseData(),
342  m_mappingData(),
343  m_idMap(),
344  m_sequences(){
347 }
PoolDbCacheData m_mappingData
PoolDbCacheData m_databaseData
std::map< std::string, PoolDbCacheData * > m_sequences
std::map< int, PoolDbCacheData > m_idMap
ora::PoolDbCache::~PoolDbCache ( )

Definition at line 349 of file PoolDatabaseSchema.cc.

349  {
350 }

Member Function Documentation

void ora::PoolDbCache::add ( int  id,
const PoolDbCacheData data 
)

Definition at line 352 of file PoolDatabaseSchema.cc.

References ora::PoolDbCacheData::m_name, ora::MappingRules::sequenceNameForContainer(), ora::MappingRules::sequenceNameForContainerId(), and ora::throwException().

352  {
353  std::map<int,PoolDbCacheData >::iterator iData = m_idMap.insert( std::make_pair( id, data )).first;
354  std::map<std::string,PoolDbCacheData*>::iterator iS = m_sequences.find( MappingRules::sequenceNameForContainerId() );
355  if( iS == m_sequences.end() ){
356  throwException( "ContainerId Sequence is empty","PoolDbCache::add");
357  }
358  if( id > (int)iS->second->m_nobjWr ){
359  iS->second->m_nobjWr = id;
360  }
361  m_sequences.insert( std::make_pair( MappingRules::sequenceNameForContainer( data.m_name ),&iData->second ) );
362 }
std::map< std::string, PoolDbCacheData * > m_sequences
std::map< int, PoolDbCacheData > m_idMap
static std::string sequenceNameForContainer(const std::string &containerName)
Definition: MappingRules.cc:14
static std::string sequenceNameForContainerId()
sequence names
Definition: MappingRules.cc:9
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
void ora::PoolDbCache::clear ( void  )

Definition at line 399 of file PoolDatabaseSchema.cc.

References ora::MappingRules::sequenceNameForContainerId(), and ora::MappingRules::sequenceNameForMapping().

Referenced by python.Vispa.Views.WidgetView.WidgetView::closeEvent(), python.Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), python.Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), python.Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), python.Vispa.Views.WidgetView.WidgetView::setDataObjects(), python.Vispa.Views.TreeView.TreeView::updateContent(), python.Vispa.Views.TableView.TableView::updateContent(), python.Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and python.Vispa.Views.PropertyView.PropertyView::updateContent().

399  {
400  m_sequences.clear();
401  m_idMap.clear();
403  m_sequences.insert(std::make_pair( MappingRules::sequenceNameForMapping(), &m_mappingData ) );
404 }
PoolDbCacheData m_mappingData
PoolDbCacheData m_databaseData
std::map< std::string, PoolDbCacheData * > m_sequences
std::map< int, PoolDbCacheData > m_idMap
static std::string sequenceNameForMapping()
Definition: MappingRules.cc:28
static std::string sequenceNameForContainerId()
sequence names
Definition: MappingRules.cc:9
ora::PoolDbCacheData & ora::PoolDbCache::find ( int  id)

Definition at line 381 of file PoolDatabaseSchema.cc.

References ora::throwException().

381  {
382  std::map<int,PoolDbCacheData >::iterator iC = m_idMap.find( id );
383  if( iC == m_idMap.end() ){
384  throwException("Container has not been found in the cache.","PoolDbCache::find");
385  }
386  return iC->second;
387 }
std::map< int, PoolDbCacheData > m_idMap
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:10
int ora::PoolDbCache::idByName ( const std::string &  name)

Definition at line 369 of file PoolDatabaseSchema.cc.

References runTheMatrix::ret.

369  {
370  int ret = -1;
371  for(std::map<int,PoolDbCacheData >::const_iterator iData = m_idMap.begin();
372  iData != m_idMap.end(); iData++ ){
373  if( iData->second.m_name == name ){
374  ret = iData->first;
375  break;
376  }
377  }
378  return ret;
379 }
std::map< int, PoolDbCacheData > m_idMap
const std::string & ora::PoolDbCache::nameById ( int  id)

Definition at line 364 of file PoolDatabaseSchema.cc.

References runTheMatrix::data, spr::find(), and ora::PoolDbCacheData::m_name.

364  {
365  PoolDbCacheData& data = find( id );
366  return data.m_name;
367 }
PoolDbCacheData & find(int id)
void ora::PoolDbCache::remove ( int  id)

Definition at line 389 of file PoolDatabaseSchema.cc.

References spr::find(), mergeVDriftHistosByStation::name, and ora::MappingRules::sequenceNameForContainer().

389  {
390  std::string name = find( id ).m_name;
392  m_idMap.erase( id );
393 }
std::map< std::string, PoolDbCacheData * > m_sequences
std::map< int, PoolDbCacheData > m_idMap
PoolDbCacheData & find(int id)
static std::string sequenceNameForContainer(const std::string &containerName)
Definition: MappingRules.cc:14
std::map< std::string, ora::PoolDbCacheData * > & ora::PoolDbCache::sequences ( )

Definition at line 395 of file PoolDatabaseSchema.cc.

395  {
396  return m_sequences;
397 }
std::map< std::string, PoolDbCacheData * > m_sequences

Member Data Documentation

PoolDbCacheData ora::PoolDbCache::m_databaseData
private

Definition at line 42 of file PoolDatabaseSchema.h.

Referenced by PoolDbCache().

std::map<int,PoolDbCacheData > ora::PoolDbCache::m_idMap
private

Definition at line 44 of file PoolDatabaseSchema.h.

PoolDbCacheData ora::PoolDbCache::m_mappingData
private

Definition at line 43 of file PoolDatabaseSchema.h.

Referenced by PoolDbCache().

std::map<std::string,PoolDbCacheData* > ora::PoolDbCache::m_sequences
private

Definition at line 45 of file PoolDatabaseSchema.h.