11 #ifndef EVIO_6_0_STRUCTUREFINDER_H
12 #define EVIO_6_0_STRUCTUREFINDER_H
50 std::shared_ptr<IEvioFilter> filter,
51 std::vector<std::shared_ptr<BaseStructure>> & vec) {
52 if (structure ==
nullptr) {
53 std::cout <<
"getMatchingStructures: returning null list" << std::endl;
57 return structure->getMatchingStructures(filter, vec);
69 uint16_t tag, uint8_t num,
70 std::vector<std::shared_ptr<BaseStructure>> & vec) {
73 uint16_t tag; uint8_t num;
75 myFilter(uint16_t tag, uint8_t num) : tag(tag), num(num) {}
76 bool accept(
StructureType const & type, std::shared_ptr<BaseStructure> struc)
override {
78 (tag == struc->getHeader()->getTag()) &&
79 (num == struc->getHeader()->getNumber()));
83 auto filter = std::make_shared<myFilter>(tag, num);
94 std::vector<std::shared_ptr<BaseStructure>> & vec) {
99 myFilter(uint16_t tag) : tag(tag) {}
100 bool accept(
StructureType const & structureType, std::shared_ptr<BaseStructure> struc)
override {
101 return (tag == struc->getHeader()->getTag());
105 auto filter = std::make_shared<myFilter>(tag);
117 std::vector<std::shared_ptr<BaseStructure>> & vec) {
122 myFilter(uint16_t tag) : tag(tag) {}
123 bool accept(
StructureType const & type, std::shared_ptr<BaseStructure> struc)
override {
125 (tag == struc->getHeader()->getTag()));
129 auto filter = std::make_shared<myFilter>(tag);
146 std::vector<std::shared_ptr<BaseStructure>> & vec) {
154 name(name), dict(dict) {}
157 std::shared_ptr<BaseStructure> struc)
override {
159 return (name == dict.
getName(struc));
163 auto filter = std::make_shared<myFilter>(name, dictionary);
178 std::string parentName,
180 std::vector<std::shared_ptr<BaseStructure>> & vec) {
188 name(name), dict(dict) {}
191 std::shared_ptr<BaseStructure> struc)
override {
193 auto parent = struc->getParent();
194 if (parent ==
nullptr) {
199 return (name == dict.
getName(parent));
203 auto filter = std::make_shared<myFilter>(parentName, dictionary);
218 std::string childName,
220 std::vector<std::shared_ptr<BaseStructure>> & vec) {
228 name(name), dict(dict) {}
231 std::shared_ptr<BaseStructure> struc)
override {
233 auto children = struc->getChildren();
234 if (children.empty()) {
238 for (
auto child : children) {
239 if (name == dict.
getName(child)) {
249 auto filter = std::make_shared<myFilter>(childName, dictionary);
258 #endif //EVIO_6_0_STRUCTUREFINDER_H
This is a set of convenient static methods used to find lists of structures within an event...
Definition: StructureFinder.h:39
static void getMatchingStructures(std::shared_ptr< BaseStructure > structure, std::string name, EvioXMLDictionary &dictionary, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all structures in an event that match the given dictionary name.
Definition: StructureFinder.h:143
static const StructureType STRUCT_BANK
Bank.
Definition: StructureType.h:41
static void getMatchingBanks(std::shared_ptr< BaseStructure > structure, uint16_t tag, uint8_t num, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all the banks in an event that match a provided tag and number in their header.
Definition: StructureFinder.h:68
static void getMatchingNonBanks(std::shared_ptr< BaseStructure > structure, uint16_t tag, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all the non-banks (i.e., Segments and TagSegments) in an event that match a provided tag in t...
Definition: StructureFinder.h:116
std::string getName(std::shared_ptr< BaseStructure > &structure)
Returns the name of a given evio structure.
Definition: EvioXMLDictionary.cpp:849
This interface allows applications to create filters so that they only receive certain structures whe...
Definition: IEvioFilter.h:40
static void getMatchingChild(std::shared_ptr< BaseStructure > structure, std::string childName, EvioXMLDictionary &dictionary, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all structures in an event who has a child with the given dictionary name.
Definition: StructureFinder.h:217
static void getMatchingStructures(std::shared_ptr< BaseStructure > structure, std::shared_ptr< IEvioFilter > filter, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all the structures in an event that pass a filter.
Definition: StructureFinder.h:49
Numerical values associated with evio structure types.
Definition: StructureType.h:34
This was developed to read the xml dictionary that Maurizio uses for GEMC.
Definition: EvioXMLDictionary.h:55
static void getMatchingParent(std::shared_ptr< BaseStructure > structure, std::string parentName, EvioXMLDictionary &dictionary, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all structures in an event whose parent has the given dictionary name.
Definition: StructureFinder.h:177
static void getMatchingStructures(std::shared_ptr< BaseStructure > structure, uint16_t tag, std::vector< std::shared_ptr< BaseStructure >> &vec)
Collect all the structures in an event that match a provided tag in their header. ...
Definition: StructureFinder.h:93