Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /jana2/src/libraries/JANA/JFactorySet.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 #pragma once
0006 
0007 #include <string>
0008 #include <typeindex>
0009 #include <map>
0010 
0011 #include <JANA/Components/JComponentSummary.h>
0012 #include <JANA/Components/JDatabundle.h>
0013 #include <JANA/Utils/JEventLevel.h>
0014 
0015 class JFactory;
0016 
0017 class JFactorySet {
0018 
0019 private:
0020     JEventLevel mLevel = JEventLevel::PhysicsEvent;
0021     std::vector<JFactory*> mFactories;
0022     std::vector<JDatabundle*> mDatabundles;
0023 
0024     std::map<std::string, JDatabundle*> mDatabundleFromUniqueName;
0025     std::map<std::pair<std::type_index, std::string>, JDatabundle*> mDatabundleFromTypeIndexAndEitherName;
0026     std::map<std::pair<std::string, std::string>, JDatabundle*> mDatabundleFromTypeNameAndEitherName;
0027 
0028     std::map<std::type_index, std::vector<JDatabundle*>> mDatabundlesFromTypeIndex;
0029     std::map<std::string, std::vector<JDatabundle*>> mDatabundlesFromTypeName;
0030 
0031 public:
0032     JFactorySet();
0033     virtual ~JFactorySet();
0034 
0035     void Add(JFactory* factory);
0036     void Add(JDatabundle* databundle);
0037     void Print() const;
0038     void Clear();
0039     void Finish();
0040 
0041     JEventLevel GetLevel() const { return mLevel; }
0042     void SetLevel(JEventLevel level) { mLevel = level; }
0043 
0044     const std::vector<JFactory*>& GetAllFactories() const { return mFactories; }
0045     const std::vector<JDatabundle*>& GetAllDatabundles() const { return mDatabundles; }
0046 
0047     JDatabundle* GetDatabundle(const std::string& unique_name) const;
0048     JDatabundle* GetDatabundle(const std::string& object_type_name, const std::string& short_or_unique_name) const;
0049     JDatabundle* GetDatabundle(std::type_index object_type_index, const std::string& short_or_unique_name) const;
0050 
0051     const std::vector<JDatabundle*>& GetDatabundles(std::type_index index) const;
0052     const std::vector<JDatabundle*>& GetDatabundles(const std::string& object_type_name) const;
0053 
0054 };
0055 
0056 
0057