CMS 3D CMS Logo

Public Member Functions | Private Attributes

ora::PoolDbCache Class Reference

#include <PoolDatabaseSchema.h>

List of all members.

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.

                           :
  m_databaseData(),
  m_mappingData(),
  m_idMap(),
  m_sequences(){
  m_databaseData.m_nobjWr = 1;
  m_mappingData.m_nobjWr = 1;
}
ora::PoolDbCache::~PoolDbCache ( )

Definition at line 349 of file PoolDatabaseSchema.cc.

                            {
}

Member Function Documentation

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

Definition at line 352 of file PoolDatabaseSchema.cc.

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

                                                             {
  std::map<int,PoolDbCacheData >::iterator iData = m_idMap.insert( std::make_pair( id, data )).first;
  std::map<std::string,PoolDbCacheData*>::iterator iS = m_sequences.find( MappingRules::sequenceNameForContainerId() );
  if( iS == m_sequences.end() ){
    throwException( "ContainerId Sequence is empty","PoolDbCache::add");
  }
  if( id > (int)iS->second->m_nobjWr ){
    iS->second->m_nobjWr = id;
  }
  m_sequences.insert( std::make_pair( MappingRules::sequenceNameForContainer( data.m_name ),&iData->second ) );
}
void ora::PoolDbCache::clear ( void  )
ora::PoolDbCacheData & ora::PoolDbCache::find ( int  id)

Definition at line 381 of file PoolDatabaseSchema.cc.

References ora::throwException().

                                                {
  std::map<int,PoolDbCacheData >::iterator iC = m_idMap.find( id );
  if( iC == m_idMap.end() ){
    throwException("Container has not been found in the cache.","PoolDbCache::find");    
  }
  return iC->second;
}
int ora::PoolDbCache::idByName ( const std::string &  name)

Definition at line 369 of file PoolDatabaseSchema.cc.

References runTheMatrix::ret.

                                                    {
  int ret = -1;
  for(std::map<int,PoolDbCacheData >::const_iterator iData = m_idMap.begin();
      iData != m_idMap.end(); iData++ ){
    if( iData->second.m_name == name ){
      ret = iData->first;
      break;
    }
  }
  return ret;
}
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.

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

Definition at line 389 of file PoolDatabaseSchema.cc.

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

                                   {
  std::string name = find( id ).m_name;
  m_sequences.erase( MappingRules::sequenceNameForContainer( name ) );
  m_idMap.erase( id );
}
std::map< std::string, ora::PoolDbCacheData * > & ora::PoolDbCache::sequences ( )

Definition at line 395 of file PoolDatabaseSchema.cc.

                                                                {
  return m_sequences;
}

Member Data Documentation

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.

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.