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

#include <AthenaAttributeType.h>

Collaboration diagram for AthenaAttributeType:

Public Member Functions

 AthenaAttributeType ()
 
 AthenaAttributeType (std::string t, std::string u, std::string g)
 
std::string info () const
 
std::string extraInfo () const
 
void setType (const std::string &info)
 
void setUnit (const std::string &info)
 
void setGroup (const std::string &info)
 
void fromString (const std::string &info)
 
std::string typeName () const
 
std::string unit () const
 
std::string group () const
 
std::set< std::string > getKeys ()
 
bool operator== (const AthenaAttributeType &rhs) const
 
bool operator!= (const AthenaAttributeType &rhs) const
 

Private Member Functions

bool setInfoForKey (const std::string &key, const std::string &info)
 

Private Attributes

std::map< std::string, std::string > m_keyedInfo
 
std::set< std::string > m_keys
 

Detailed Description

Definition at line 30 of file AthenaAttributeType.h.

Constructor & Destructor Documentation

◆ AthenaAttributeType() [1/2]

AthenaAttributeType::AthenaAttributeType ( )
inline

Definition at line 34 of file AthenaAttributeType.h.

34 {;}

◆ AthenaAttributeType() [2/2]

AthenaAttributeType::AthenaAttributeType ( std::string  t,
std::string  u = "UNKNOWN",
std::string  g = "UNKNOWN" 
)
inline

Definition at line 70 of file AthenaAttributeType.h.

73 {
74  m_keyedInfo.clear();
75  m_keys.clear();
76  m_keys.insert("TYPE");
77  m_keys.insert("UNIT");
78  m_keys.insert("GRP");
79  m_keyedInfo.emplace("TYPE",t);
80  m_keyedInfo.emplace("UNIT",u);
81  m_keyedInfo.emplace("GRP",g);
82 }

Member Function Documentation

◆ extraInfo()

std::string AthenaAttributeType::extraInfo ( ) const
inline

Definition at line 151 of file AthenaAttributeType.h.

152 {
153  std::ostringstream os;
154  os << "UNIT="<<unit()<<";"<<"GRP="<<group()<<";";
155  return os.str();
156 }

◆ fromString()

void AthenaAttributeType::fromString ( const std::string &  info)
inline

Definition at line 96 of file AthenaAttributeType.h.

97 {
98  m_keyedInfo.clear();
99  m_keys.clear();
100 
101  // search for type first
102  std::set<std::string> keys;
103  keys.insert("TYPE");
104  keys.insert("UNIT");
105  keys.insert("GRP");
106  std::string::size_type flagpos, endpos;
107  for (std::set<std::string>::iterator it = keys.begin(); it!=keys.end(); ++it) {
108  flagpos = i.find(*it);
109  if (flagpos != std::string::npos) {
110  endpos = i.find(';',flagpos);
111  if (endpos != std::string::npos) {
112  this->setInfoForKey(*it,i.substr(flagpos,endpos));
113  }
114  }
115  }
116 }

◆ getKeys()

std::set<std::string> AthenaAttributeType::getKeys ( )
inline

Definition at line 56 of file AthenaAttributeType.h.

56 {return m_keys;}

◆ group()

std::string AthenaAttributeType::group ( ) const
inline

Definition at line 135 of file AthenaAttributeType.h.

136 {
137  std::map<std::string,std::string>::const_iterator temp = m_keyedInfo.find("GRP");
138  if (temp!=m_keyedInfo.end()) return temp->second;
139  else return std::string("NOTFOUND");
140 }

◆ info()

std::string AthenaAttributeType::info ( ) const
inline

Definition at line 143 of file AthenaAttributeType.h.

144 {
145  std::ostringstream os;
146  os << "TYPE="<<typeName()<<";"<<"UNIT="<<unit()<<";"<<"GRP="<<group()<<";";
147  return os.str();
148 }

◆ operator!=()

Definition at line 167 of file AthenaAttributeType.h.

168 {
169  return !(*this==rhs);
170 }

◆ operator==()

bool AthenaAttributeType::operator== ( const AthenaAttributeType rhs) const
inline

Definition at line 159 of file AthenaAttributeType.h.

160 {
161  return (this->typeName()==rhs.typeName()) &&
162  (this->unit()==rhs.unit()) &&
163  (this->group()==rhs.group());
164 }

◆ setGroup()

void AthenaAttributeType::setGroup ( const std::string &  info)
inline

Definition at line 47 of file AthenaAttributeType.h.

47 {setInfoForKey("GRP",info);}

◆ setInfoForKey()

bool AthenaAttributeType::setInfoForKey ( const std::string &  key,
const std::string &  info 
)
inlineprivate

Definition at line 85 of file AthenaAttributeType.h.

87 {
88  if ( m_keys.find(key) != m_keys.end() ) {
89  m_keyedInfo[key] = info;
90  return true;
91  }
92  else return false;
93 }

◆ setType()

void AthenaAttributeType::setType ( const std::string &  info)
inline

Definition at line 45 of file AthenaAttributeType.h.

45 {setInfoForKey("TYPE",info);}

◆ setUnit()

void AthenaAttributeType::setUnit ( const std::string &  info)
inline

Definition at line 46 of file AthenaAttributeType.h.

46 {setInfoForKey("UNIT",info);}

◆ typeName()

std::string AthenaAttributeType::typeName ( ) const
inline

Definition at line 119 of file AthenaAttributeType.h.

120 {
121  std::map<std::string,std::string>::const_iterator temp = m_keyedInfo.find("TYPE");
122  if (temp!=m_keyedInfo.end()) return temp->second;
123  else return std::string("NOTFOUND");
124 }

◆ unit()

std::string AthenaAttributeType::unit ( ) const
inline

Definition at line 127 of file AthenaAttributeType.h.

128 {
129  std::map<std::string,std::string>::const_iterator temp = m_keyedInfo.find("UNIT");
130  if (temp!=m_keyedInfo.end()) return temp->second;
131  else return std::string("NOTFOUND");
132 }

Member Data Documentation

◆ m_keyedInfo

std::map<std::string,std::string> AthenaAttributeType::m_keyedInfo
private

Definition at line 65 of file AthenaAttributeType.h.

◆ m_keys

std::set<std::string> AthenaAttributeType::m_keys
private

Definition at line 66 of file AthenaAttributeType.h.


The documentation for this class was generated from the following file:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AthenaAttributeType::m_keys
std::set< std::string > m_keys
Definition: AthenaAttributeType.h:66
skel.it
it
Definition: skel.GENtoEVGEN.py:423
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthenaAttributeType::group
std::string group() const
Definition: AthenaAttributeType.h:135
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:83
AthenaAttributeType::info
std::string info() const
Definition: AthenaAttributeType.h:143
AthenaAttributeType::typeName
std::string typeName() const
Definition: AthenaAttributeType.h:119
lumiFormat.i
int i
Definition: lumiFormat.py:92
AthenaAttributeType::unit
std::string unit() const
Definition: AthenaAttributeType.h:127
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
AthenaAttributeType::m_keyedInfo
std::map< std::string, std::string > m_keyedInfo
Definition: AthenaAttributeType.h:65
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
AthenaAttributeType::setInfoForKey
bool setInfoForKey(const std::string &key, const std::string &info)
Definition: AthenaAttributeType.h:85