test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Friends
AlCaRecoTriggerBits Class Reference

#include <AlCaRecoTriggerBits.h>

Public Member Functions

 AlCaRecoTriggerBits ()
 
std::string compose (const std::vector< std::string > &paths) const
 Compose several paths into one string : More...
 
std::vector< std::string > decompose (const std::string &concatPaths) const
 Decompose one value of map from concatenated string. More...
 
 ~AlCaRecoTriggerBits ()
 

Public Attributes

std::map< std::string,
std::string > 
m_alcarecoToTrig
 

Static Public Attributes

static const
std::string::value_type 
delimeter_ = ';'
 Delimeter for composing paths to one string in DB: More...
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 9 of file AlCaRecoTriggerBits.h.

Constructor & Destructor Documentation

AlCaRecoTriggerBits::AlCaRecoTriggerBits ( )

Definition at line 4 of file AlCaRecoTriggerBits.cc.

4 {}
AlCaRecoTriggerBits::~AlCaRecoTriggerBits ( )

Definition at line 5 of file AlCaRecoTriggerBits.cc.

5 {}

Member Function Documentation

std::string AlCaRecoTriggerBits::compose ( const std::vector< std::string > &  paths) const

Compose several paths into one string :

Definition at line 10 of file AlCaRecoTriggerBits.cc.

References delimeter_, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by AlCaRecoTriggerBitsRcdUpdate::addTriggerLists().

11 {
12  std::string mergedPaths;
13  for (std::vector<std::string>::const_iterator iPath = paths.begin();
14  iPath != paths.end(); ++iPath) {
15  if (iPath != paths.begin()) mergedPaths += delimeter_;
16  if (iPath->find(delimeter_) != std::string::npos) {
17  // What to do in CondFormats?
18  // cms::Exception? std::cerr? edm::LogError?
19  }
20  mergedPaths += *iPath;
21  }
22 
23  // Special case: DB cannot store empty strings, see e.g.
24  // https://hypernews.cern.ch/HyperNews/CMS/get/database/674.html ,
25  // so choose delimeter_ for that - it cannot appear in a path anyway.
26  if (mergedPaths.empty()) mergedPaths = delimeter_;
27 
28  return mergedPaths;
29 }
static const std::string::value_type delimeter_
Delimeter for composing paths to one string in DB:
std::vector< std::string > AlCaRecoTriggerBits::decompose ( const std::string &  concatPaths) const

Decompose one value of map from concatenated string.

Definition at line 32 of file AlCaRecoTriggerBits.cc.

References delimeter_, and query::result.

Referenced by AlCaRecoTriggerBitsRcdRead::printMap().

33 {
34  // decompose 's' into its parts that are separated by 'delimeter_'
35  // (similar as in
36  // Alignment/CommonAlignmentAlgorithm/src/AlignmentParameterSelector.cc)
37 
38  std::vector<std::string> result;
39  if (!(s.size() == 1 && s[0] == delimeter_)) {
40  // delimeter_ only indicates an empty list as DB cannot store empty strings
41  std::string::size_type previousPos = 0;
42  while (true) {
43  const std::string::size_type delimiterPos = s.find(delimeter_, previousPos);
44  if (delimiterPos == std::string::npos) {
45  result.push_back(s.substr(previousPos)); // until end
46  break;
47  }
48  result.push_back(s.substr(previousPos, delimiterPos - previousPos));
49  previousPos = delimiterPos + 1; // +1: skip delim
50  }
51  }
52 
53  return result;
54 }
uint16_t size_type
tuple result
Definition: query.py:137
static const std::string::value_type delimeter_
Delimeter for composing paths to one string in DB:
template<class Archive >
void AlCaRecoTriggerBits::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 23 of file AlCaRecoTriggerBits.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 23 of file AlCaRecoTriggerBits.h.

Member Data Documentation

const std::string::value_type AlCaRecoTriggerBits::delimeter_ = ';'
static

Delimeter for composing paths to one string in DB:

Definition at line 19 of file AlCaRecoTriggerBits.h.

Referenced by compose(), and decompose().

std::map<std::string,std::string> AlCaRecoTriggerBits::m_alcarecoToTrig