Description: Class to hold configuration identifier for chambers
This class was originally defined in CondCore/DTPlugins/interface/DTConfigPluginHandler.h It was moved, renamed, and modified to not be a singleton for thread safety, but otherwise little was changed.
- Author
- Paolo Ronchese INFN Padova
Definition at line 28 of file DTKeyedConfigCache.h.
Definition at line 53 of file DTKeyedConfigCache.cc.
References brickMap, cachedBrickNumber, cachedByteNumber, cachedStringNumber, DTKeyedConfig::dataBegin(), DTKeyedConfig::dataEnd(), alignCSCRings::e, mps_splice::entry, cppFunctionSkipper::exception, cond::persistency::KeyList::get(), edm::eventsetup::EventSetupRecord::get(), DTKeyedConfig::getId(), cond::persistency::KeyList::load(), maxBrickNumber, maxByteNumber, maxStringNumber, edm::ESHandle< class >::product(), and findQualityFiles::size.
Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), util.rrapi.RRApi::tables(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().
56 bool cacheFound =
false;
57 int cacheAge = 999999999;
58 std::map<int,counted_brick>::iterator cache_iter =
brickMap.begin();
59 std::map<int,counted_brick>::iterator cache_icfg =
brickMap.find( cfgId );
60 std::map<int,counted_brick>::iterator cache_iend =
brickMap.end();
61 if ( cache_icfg != cache_iend ) {
62 std::pair<const int,counted_brick>&
entry = *cache_icfg;
64 cacheAge = cBrick.first;
69 std::map<int,const DTKeyedConfig*> ageMap;
71 if ( !cacheAge )
return 0;
72 while ( cache_iter != cache_iend ) {
73 std::pair<const int,counted_brick>&
entry = *cache_iter++;
75 int& brickAge = cBrick.first;
76 if ( brickAge < cacheAge ) brickAge++;
77 if ( entry.first == cfgId ) brickAge = 0;
82 while ( cache_iter != cache_iend ) {
83 std::pair<const int,counted_brick>& entry = *cache_iter++;
85 ageMap.insert( std::pair<int,const DTKeyedConfig*>(
86 ++cBrick.first, entry.second.second ) );
100 if ( keyList == 0 )
return 999;
102 std::vector<unsigned long long> checkedKeys;
103 boost::shared_ptr<DTKeyedConfig> kBrick;
104 checkedKeys.push_back( cfgId );
105 bool brickFound =
false;
107 keyList->
load( checkedKeys );
109 if ( kBrick.get() ) brickFound = ( kBrick->getId() == cfgId );
115 brickMap.insert( std::pair<int,counted_brick>( cfgId, cBrick ) );
122 std::map<int,const DTKeyedConfig*>::reverse_iterator iter = ageMap.rbegin();
127 int oldestId = oldestBrick->
getId();
std::map< int, counted_brick > brickMap
boost::shared_ptr< T > get(size_t n) const
data_iterator dataBegin() const
void get(HolderT &iHolder) const
static const int maxByteNumber
T const * product() const
std::vector< std::string >::const_iterator data_iterator
static const int maxBrickNumber
void load(const std::vector< unsigned long long > &keys)
std::pair< int, const DTKeyedConfig * > counted_brick
static const int maxStringNumber
tuple size
Write out results.
data_iterator dataEnd() const