11 #ifndef EVIO_6_0_EVIODICTIONARYENTRY_H
12 #define EVIO_6_0_EVIODICTIONARYENTRY_H
62 bool numValid =
false;
68 std::string format =
"";
71 std::string description =
"";
79 std::shared_ptr<EvioDictionaryEntry> parentEntry =
nullptr;
85 EvioDictionaryEntry() =
default;
120 EvioDictionaryEntry(uint16_t tag, uint8_t num, uint16_t tagEnd,
bool numValid,
121 DataType
const & type, std::string
const & description, std::string
const & format,
122 std::shared_ptr<EvioDictionaryEntry> parent) {
126 if (tagEnd == tag || tagEnd == 0) {
132 else if (tagEnd < tag) {
139 this->tagEnd = tagEnd;
143 this->numValid = numValid;
144 this->format = format;
145 this->description = description;
150 entryType = EvioDictionaryEntryType::TAG_NUM;
153 entryType = EvioDictionaryEntryType::TAG_ONLY;
157 entryType = EvioDictionaryEntryType::TAG_RANGE;
160 parentEntry = parent;
198 std::string
const & description =
"", std::string
const & format =
"",
199 std::shared_ptr<EvioDictionaryEntry> parent =
nullptr) :
221 std::string
const & description =
"", std::string
const & format =
"",
222 std::shared_ptr<EvioDictionaryEntry> parent =
nullptr) :
235 return tagEnd != 0 && tagArg >= tag && tagArg <= tagEnd;
247 return tagEnd != 0 && entry.tag >= tag && entry.tag <= tagEnd;
253 if (&other ==
this)
return true;
258 bool match = (tag == other.tag);
259 match = match && (numValid == other.numValid);
262 match = match && (num == other.num);
266 match = match && (tagEnd == other.tagEnd);
269 match = match && (entryType == other.entryType);
272 if (parentEntry !=
nullptr && otherParent !=
nullptr) {
273 match = match && (parentEntry->getTag() == otherParent->getTag());
274 match = match && (parentEntry->numValid == otherParent->numValid);
275 if (parentEntry->numValid) {
276 match = match && (parentEntry->getNum() == otherParent->getNum());
278 match = match && (parentEntry->getTagEnd() == otherParent->getTagEnd());
279 if (!match) std::cout <<
" parents don't match" << std::endl;
286 return !(rhs == *
this);
295 std::stringstream ss;
299 ss <<
"(tag=" << tag <<
",num =" << +num <<
")" ;
302 ss <<
"(tag=" << tag <<
")" ;
305 ss <<
"(tag=" << tag <<
"-" << tagEnd <<
")" ;
360 std::shared_ptr<EvioDictionaryEntry>
getParentEntry()
const {
return parentEntry;}
368 std::stringstream ss;
370 ss << std::boolalpha;
372 ss <<
"tag = " << tag <<
", tagEnd = " << tagEnd <<
", num = " << +num <<
", numValid = " << numValid <<
373 ", data type = " << type.toString();
376 ss <<
", entry type = TAG/NUM";
378 ss <<
", entry type = TAG_ONLY";
380 ss <<
", entry type = TAG_RANGE";
384 if (!format.empty()) {
385 ss <<
" format = " << format << std::endl;
388 if (!description.empty()) {
389 ss <<
" description = " << description << std::endl;
392 if (parentEntry !=
nullptr) {
393 ss <<
" parent = " << parentEntry->toString() << std::endl;
404 #endif //EVIO_6_0_EVIODICTIONARYENTRY_H
std::string toString()
Get the string representation of this object.
Definition: EvioDictionaryEntry.h:366
std::string getDescription() const
Get the CompositeData's description.
Definition: EvioDictionaryEntry.h:348
DataType getType() const
Get the data's type.
Definition: EvioDictionaryEntry.h:336
EvioDictionaryEntry(uint16_t tag, uint16_t tagEnd=0, DataType const &type=DataType::UNKNOWN32, std::string const &description="", std::string const &format="", std::shared_ptr< EvioDictionaryEntry > parent=nullptr)
Constructor containing actual implementation.
Definition: EvioDictionaryEntry.h:196
EvioDictionaryEntryType getEntryType() const
Get this entry's type.
Definition: EvioDictionaryEntry.h:354
EvioDictionaryEntry(uint16_t tag, uint8_t num, DataType const &type)
Constructor.
Definition: EvioDictionaryEntry.h:175
EvioDictionaryEntry(uint16_t tag, uint8_t num, uint16_t tagEnd=0, DataType const &type=DataType::UNKNOWN32, std::string const &description="", std::string const &format="", std::shared_ptr< EvioDictionaryEntry > parent=nullptr)
Constructor containing actual implementation.
Definition: EvioDictionaryEntry.h:219
std::shared_ptr< EvioDictionaryEntry > getParentEntry() const
Get the parent container's dictionary entry.
Definition: EvioDictionaryEntry.h:360
bool operator==(const EvioDictionaryEntry &other) const
Definition: EvioDictionaryEntry.h:251
Valid tag and tagEnd, but no num.
Definition: EvioDictionaryEntry.h:46
std::string toString() const
Get a string representation of this object.
Definition: EvioDictionaryEntry.h:294
Valid tag & num, with or without a tagEnd.
Definition: EvioDictionaryEntry.h:42
uint8_t getNum() const
Get the num value.
Definition: EvioDictionaryEntry.h:330
bool inRange(EvioDictionaryEntry &entry) const
Is the given dictionary entry's tag within the specified range (inclusive) of this dictionary entry...
Definition: EvioDictionaryEntry.h:246
Valid tag, but no num or tagEnd.
Definition: EvioDictionaryEntry.h:44
uint16_t getTagEnd() const
Get the tagEnd value (upper end of a tag range).
Definition: EvioDictionaryEntry.h:324
bool inRange(uint16_t tagArg) const
Is the given tag within the specified range (inclusive) of this dictionary entry? ...
Definition: EvioDictionaryEntry.h:234
Numerical values associated with evio data types.
Definition: DataType.h:32
bool operator!=(const EvioDictionaryEntry &rhs) const
Definition: EvioDictionaryEntry.h:285
uint16_t getTag() const
Get the tag value.
Definition: EvioDictionaryEntry.h:317
static const DataType UNKNOWN32
Unknown data type.
Definition: DataType.h:36
This was developed to read the xml dictionary that Maurizio uses for GEMC.
Definition: EvioXMLDictionary.h:55
EvioDictionaryEntryType
Type of dictionary entry.
Definition: EvioDictionaryEntry.h:40
std::string getFormat() const
Get the CompositeData's format.
Definition: EvioDictionaryEntry.h:342
Class to facilitate use of Evio XML dictionary entry data as a key or value in a hash table...
Definition: EvioDictionaryEntry.h:30