ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
TagMetadataKey Class Reference

#include <TagMetadataKey.h>

Collaboration diagram for TagMetadataKey:

Public Member Functions

 TagMetadataKey ()
 
 TagMetadataKey (std::string key, std::string qual="", bool versioned=false)
 
void setEncoded (bool flag)
 
void setKey (std::string key)
 
void setQual (std::string qual)
 
void setIOV (std::string iov)
 
void setVersion (std::string ver)
 
bool isVersioned ()
 
bool encoded () const
 
std::string key () const
 
std::string qual () const
 
std::string iov () const
 
std::string ver () const
 
bool fromString (std::string comp)
 
std::string toString () const
 

Static Public Member Functions

static std::string sep ()
 
static std::string keymark ()
 
static std::string qualmark ()
 
static std::string iovmark ()
 
static std::string vermark ()
 

Private Member Functions

std::string getpayload (const std::string key, const std::string comp)
 

Private Attributes

std::string m_key
 
std::string m_qual
 
std::string m_iov
 
std::string m_ver
 
bool m_verstat
 
bool m_encoded
 

Detailed Description

Definition at line 25 of file TagMetadataKey.h.

Constructor & Destructor Documentation

◆ TagMetadataKey() [1/2]

TagMetadataKey::TagMetadataKey ( )
inline

Definition at line 67 of file TagMetadataKey.h.

67  : m_verstat(false), m_encoded(true)
68 {}

◆ TagMetadataKey() [2/2]

TagMetadataKey::TagMetadataKey ( std::string  key,
std::string  qual = "",
bool  versioned = false 
)
inline

Definition at line 71 of file TagMetadataKey.h.

71  :
72  m_key(key), m_qual(qual), m_verstat(versioned), m_encoded(true)
73 {if (m_verstat) m_ver="0";}

Member Function Documentation

◆ encoded()

bool TagMetadataKey::encoded ( ) const
inline

Definition at line 91 of file TagMetadataKey.h.

91 {return m_encoded;}

◆ fromString()

bool TagMetadataKey::fromString ( std::string  comp)
inline

Definition at line 106 of file TagMetadataKey.h.

107 {
108  bool ready = false;
109  char sp = sep()[0];
110  int nseps = std::count(comp.begin(),comp.end(),sp);
111  // All marks should be denoted with an @
112  int nmarks = std::count(comp.begin(),comp.end(),'@');
113  //std::cout << "seps =" << nseps <<" marks=" << nmarks << std::endl;
114  if (nmarks > 0 && nseps == nmarks) {
115  // first check for key. if no key then ready is false
116  std::string payload = getpayload(keymark(),comp);
117  if (payload != "BAD") {
118  m_encoded=true;
119  m_key = payload;
120  // check for qualifier
122  if (payload != "BAD") m_qual = payload;
123  else m_qual.clear();
124  // check for iov
126  if (payload != "BAD") m_iov = payload;
127  else m_iov.clear();
128  // check for version
130  if (payload != "BAD") m_ver = payload;
131  else m_ver.clear();
132  ready = true;
133  }
134  }
135  else {
136  m_key = comp;
137  m_encoded = false;
138  std::cerr << "WARNING: No markers found in "
139  << comp << ". Treating as unencoded single key." << std::endl;
140  }
141  return ready;
142 }

◆ getpayload()

std::string TagMetadataKey::getpayload ( const std::string  key,
const std::string  comp 
)
inlineprivate

Definition at line 161 of file TagMetadataKey.h.

162 {
163  std::string bad("BAD");
164  std::string payload;
165  // Look for named key being considered
166  std::string::size_type start = comp.find(key);
167  if (start != std::string::npos) {
168  // if key exists, then look for endmarker, need at least one after the @
169  // starting at key name position
170  std::string::size_type payend = comp.find(sep(),start);
171  std::string::size_type paystart = comp.find('@',start);
172  if (paystart<payend) {
173  // grab substring between @ and sep()
174  payload = comp.substr(start+keymark().size(),payend-start-keymark().size());
175  }
176  else {
177  std::cerr << "WARNING: missing sep() for key" << std::endl;
178  return bad;
179  }
180  }
181  return payload;
182 }

◆ iov()

std::string TagMetadataKey::iov ( ) const
inline

Definition at line 100 of file TagMetadataKey.h.

100 {return m_iov;}

◆ iovmark()

static std::string TagMetadataKey::iovmark ( )
inlinestatic

Definition at line 32 of file TagMetadataKey.h.

32 {return "IOV@";}

◆ isVersioned()

bool TagMetadataKey::isVersioned ( )
inline

Definition at line 44 of file TagMetadataKey.h.

44 {return m_verstat;}

◆ key()

std::string TagMetadataKey::key ( ) const
inline

Definition at line 94 of file TagMetadataKey.h.

94 {return m_key;}

◆ keymark()

static std::string TagMetadataKey::keymark ( )
inlinestatic

Definition at line 30 of file TagMetadataKey.h.

30 {return "Key@";}

◆ qual()

std::string TagMetadataKey::qual ( ) const
inline

Definition at line 97 of file TagMetadataKey.h.

97 {return m_qual;}

◆ qualmark()

static std::string TagMetadataKey::qualmark ( )
inlinestatic

Definition at line 31 of file TagMetadataKey.h.

31 {return "Qual@";}

◆ sep()

static std::string TagMetadataKey::sep ( )
inlinestatic

Definition at line 29 of file TagMetadataKey.h.

29 {return ";";}

◆ setEncoded()

void TagMetadataKey::setEncoded ( bool  flag)
inline

Definition at line 76 of file TagMetadataKey.h.

76 {m_encoded=flag;}

◆ setIOV()

void TagMetadataKey::setIOV ( std::string  iov)
inline

Definition at line 85 of file TagMetadataKey.h.

85 {m_iov=iov;}

◆ setKey()

void TagMetadataKey::setKey ( std::string  key)
inline

Definition at line 79 of file TagMetadataKey.h.

79 {m_key=key;}

◆ setQual()

void TagMetadataKey::setQual ( std::string  qual)
inline

Definition at line 82 of file TagMetadataKey.h.

82 {m_qual=qual;}

◆ setVersion()

void TagMetadataKey::setVersion ( std::string  ver)
inline

Definition at line 88 of file TagMetadataKey.h.

88 {m_ver = ver;}

◆ toString()

std::string TagMetadataKey::toString ( ) const
inline

Definition at line 145 of file TagMetadataKey.h.

146 {
147  std::stringstream out;
148  if (m_encoded) {
149  out << keymark() << m_key << sep();
150  if (m_qual.size()>0) out << qualmark() << m_qual << sep();
151  if (m_iov.size()>0) out << iovmark() << m_iov << sep();
152  if (m_verstat && m_ver.size()>0) {
153  out << vermark() << m_ver << sep();
154  }
155  }
156  else out << m_key;
157  return out.str();
158 }

◆ ver()

std::string TagMetadataKey::ver ( ) const
inline

Definition at line 103 of file TagMetadataKey.h.

103 {return m_ver;}

◆ vermark()

static std::string TagMetadataKey::vermark ( )
inlinestatic

Definition at line 33 of file TagMetadataKey.h.

33 {return "Ver@";}

Member Data Documentation

◆ m_encoded

bool TagMetadataKey::m_encoded
private

Definition at line 63 of file TagMetadataKey.h.

◆ m_iov

std::string TagMetadataKey::m_iov
private

Definition at line 60 of file TagMetadataKey.h.

◆ m_key

std::string TagMetadataKey::m_key
private

Definition at line 58 of file TagMetadataKey.h.

◆ m_qual

std::string TagMetadataKey::m_qual
private

Definition at line 59 of file TagMetadataKey.h.

◆ m_ver

std::string TagMetadataKey::m_ver
private

Definition at line 61 of file TagMetadataKey.h.

◆ m_verstat

bool TagMetadataKey::m_verstat
private

Definition at line 62 of file TagMetadataKey.h.


The documentation for this class was generated from the following file:
bad
@ bad
Definition: SUSYToolsTester.cxx:95
plotting.yearwise_luminosity_vs_mu.comp
comp
Definition: yearwise_luminosity_vs_mu.py:24
TagMetadataKey::iovmark
static std::string iovmark()
Definition: TagMetadataKey.h:32
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TagMetadataKey::qual
std::string qual() const
Definition: TagMetadataKey.h:97
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TagMetadataKey::m_ver
std::string m_ver
Definition: TagMetadataKey.h:61
TagMetadataKey::m_key
std::string m_key
Definition: TagMetadataKey.h:58
TagMetadataKey::m_encoded
bool m_encoded
Definition: TagMetadataKey.h:63
master.flag
bool flag
Definition: master.py:29
TagMetadataKey::vermark
static std::string vermark()
Definition: TagMetadataKey.h:33
TagMetadataKey::m_iov
std::string m_iov
Definition: TagMetadataKey.h:60
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
TagMetadataKey::key
std::string key() const
Definition: TagMetadataKey.h:94
TagMetadataKey::sep
static std::string sep()
Definition: TagMetadataKey.h:29
TagMetadataKey::qualmark
static std::string qualmark()
Definition: TagMetadataKey.h:31
TagMetadataKey::iov
std::string iov() const
Definition: TagMetadataKey.h:100
TagMetadataKey::m_qual
std::string m_qual
Definition: TagMetadataKey.h:59
TagMetadataKey::getpayload
std::string getpayload(const std::string key, const std::string comp)
Definition: TagMetadataKey.h:161
TagMetadataKey::m_verstat
bool m_verstat
Definition: TagMetadataKey.h:62
TagMetadataKey::ver
std::string ver() const
Definition: TagMetadataKey.h:103
TagMetadataKey::keymark
static std::string keymark()
Definition: TagMetadataKey.h:30