Pixie16 Analysis Software Suite
Analysis code for processing of .ldf files
Identifier.hpp
Go to the documentation of this file.
1 
4 #ifndef __CHANIDENTIFIER_HPP
5 #define __CHANIDENTIFIER_HPP
6 
7 #include <map>
8 #include <sstream>
9 #include <string>
10 
23 class Identifier {
24 public:
37  Identifier(const std::string &type, const std::string &subType,
38  const int &loc);
39 
40  typedef int TagValue;
41 
44  void SetDammID(int a) {dammID = a;};
47  void SetType(const std::string &a) {type = a;};
50  void SetSubtype(const std::string &a) {subtype = a;};
53  void SetLocation(int a) {location = a;};
54 
55  int GetDammID() const {return dammID;}
56  const std::string& GetType() const {return type;}
57  const std::string& GetSubtype() const {return subtype;}
58  int GetLocation() const {return location;}
63  void AddTag(const std::string &s, TagValue n) {tag[s] = n;}
67  bool HasTag(const std::string &s) const {
68  if(tag.count(s) > 0)
69  return(true);
70  return(false);};
73  TagValue GetTag(const std::string &s) const;
74 
80  void Zero();
82  static void PrintHeaders(void);
84  void Print(void) const;
85 
89  bool operator==(const Identifier &x) const {
90  return (type == x.type &&
91  subtype == x.subtype &&
92  location == x.location);
93  }
94 
98  bool operator!=(const Identifier &x) const {
99  return !operator==(x);
100  }
101 
105  bool operator<(const Identifier &x) const {
106  if (type.compare(x.type) > 0)
107  return false;
108  else if (type.compare(x.type) < 0)
109  return true;
110  else {
111  if (subtype.compare(x.subtype) > 0)
112  return false;
113  else if (subtype.compare(x.subtype))
114  return true;
115  else {
116  return (location < x.location);
117  }
118  }
119  }
120 
122  std::string GetPlaceName() const {
123  std::stringstream ss;
124  ss << GetType() << "_" << GetSubtype() << "_" << GetLocation();
125  return ss.str();
126  }
127 private:
128  std::string type;
129  std::string subtype;
130  int dammID;
131  int location;
133  std::map<std::string, TagValue> tag;
134 };
135 #endif
~Identifier()
Definition: Identifier.hpp:32
std::string type
Definition: Identifier.hpp:128
int GetLocation() const
Definition: Identifier.hpp:58
std::string subtype
Definition: Identifier.hpp:129
bool HasTag(const std::string &s) const
Definition: Identifier.hpp:67
int dammID
Definition: Identifier.hpp:130
int TagValue
Type definition for the tag vaule.
Definition: Identifier.hpp:40
std::string GetPlaceName() const
Definition: Identifier.hpp:122
TagValue GetTag(const std::string &s) const
void SetSubtype(const std::string &a)
Definition: Identifier.hpp:50
static void PrintHeaders(void)
int GetDammID() const
Definition: Identifier.hpp:55
void Zero()
void Print(void) const
bool operator<(const Identifier &x) const
Definition: Identifier.hpp:105
void SetDammID(int a)
Definition: Identifier.hpp:44
const std::string & GetType() const
Definition: Identifier.hpp:56
Identifier()
Definition: Identifier.hpp:30
int location
Definition: Identifier.hpp:131
bool operator!=(const Identifier &x) const
Definition: Identifier.hpp:98
void SetLocation(int a)
Definition: Identifier.hpp:53
void AddTag(const std::string &s, TagValue n)
Definition: Identifier.hpp:63
const std::string & GetSubtype() const
Definition: Identifier.hpp:57
std::map< std::string, TagValue > tag
Definition: Identifier.hpp:133
Channel identification.
Definition: Identifier.hpp:23
void SetType(const std::string &a)
Definition: Identifier.hpp:47
bool operator==(const Identifier &x) const
Definition: Identifier.hpp:89