DTKeyedConfigCache

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#ifndef CondTools_DT_DTKeyedConfigCache_h
#define CondTools_DT_DTKeyedConfigCache_h
/** \class DTKeyedConfigCache
 *
 *  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
 *
 */

#include <map>
#include <string>
#include <vector>

#include "CondCore/CondDB/interface/KeyList.h"

class DTKeyedConfig;

//              ---------------------
//              -- Class Interface --
//              ---------------------

class DTKeyedConfigCache {
public:
  DTKeyedConfigCache();
  DTKeyedConfigCache(const DTKeyedConfigCache& x) = delete;
  const DTKeyedConfigCache& operator=(const DTKeyedConfigCache& x) = delete;
  virtual ~DTKeyedConfigCache();

  int get(const cond::persistency::KeyList& keyList, int cfgId, const DTKeyedConfig*& obj);

  void getData(const cond::persistency::KeyList& keyList, int cfgId, std::vector<std::string>& list);

  void purge();

  static const int maxBrickNumber;
  static const int maxStringNumber;
  static const int maxByteNumber;

private:
  typedef std::pair<int, const DTKeyedConfig*> counted_brick;
  std::map<int, counted_brick> brickMap;
  int cachedBrickNumber;
  int cachedStringNumber;
  int cachedByteNumber;
};
#endif