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 52 of file DTKeyedConfigCache.cc.
References brickMap, cachedBrickNumber, cachedByteNumber, cachedStringNumber, DTKeyedConfig::dataBegin(), DTKeyedConfig::dataEnd(), MillePedeFileConverter_cfg::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< T >::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().
55 bool cacheFound =
false;
56 int cacheAge = 999999999;
57 std::map<int,counted_brick>::iterator cache_iter =
brickMap.begin();
58 std::map<int,counted_brick>::iterator cache_icfg =
brickMap.find( cfgId );
59 std::map<int,counted_brick>::iterator cache_iend =
brickMap.end();
60 if ( cache_icfg != cache_iend ) {
61 std::pair<const int,counted_brick>&
entry = *cache_icfg;
63 cacheAge = cBrick.first;
68 std::map<int,const DTKeyedConfig*> ageMap;
70 if ( !cacheAge )
return 0;
71 while ( cache_iter != cache_iend ) {
72 std::pair<const int,counted_brick>&
entry = *cache_iter++;
74 int& brickAge = cBrick.first;
75 if ( brickAge < cacheAge ) brickAge++;
76 if ( entry.first == cfgId ) brickAge = 0;
81 while ( cache_iter != cache_iend ) {
82 std::pair<const int,counted_brick>& entry = *cache_iter++;
84 ageMap.insert( std::pair<int,const DTKeyedConfig*>(
85 ++cBrick.first, entry.second.second ) );
99 if ( keyList == 0 )
return 999;
101 std::vector<unsigned long long> checkedKeys;
102 std::shared_ptr<DTKeyedConfig> kBrick;
103 checkedKeys.push_back( cfgId );
104 bool brickFound =
false;
106 keyList->
load( checkedKeys );
108 if ( kBrick.get() ) brickFound = ( kBrick->getId() == cfgId );
114 brickMap.insert( std::pair<int,counted_brick>( cfgId, cBrick ) );
121 std::map<int,const DTKeyedConfig*>::reverse_iterator iter = ageMap.rbegin();
126 int oldestId = oldestBrick->
getId();
std::map< int, counted_brick > brickMap
data_iterator dataBegin() const
void get(HolderT &iHolder) const
static const int maxByteNumber
std::shared_ptr< T > get(size_t n) 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
T const * product() const
data_iterator dataEnd() const