1#ifndef PODIO_EVENTSTORE_H
2#define PODIO_EVENTSTORE_H
34typedef std::map<int, GenericParameters>
RunMDMap;
35typedef std::map<int, GenericParameters>
ColMDMap;
44 typedef std::pair<std::string, CollectionBase*>
CollPair;
52 T& create(
const std::string& name);
59 bool get(
const std::string& name,
const T*& collection);
63 return (m_cachedCollections.size() > (
unsigned)
id ? m_cachedCollections[
id] :
nullptr);
72 const T& get(
const std::string& name);
75 void clearCollections();
84 void setReader(
IReader* reader);
90 virtual bool isValid() const final;
113 bool doGet(
const std::string& name,
CollectionBase*& collection,
bool setReferences =
true)
const;
115 bool collectionRegistered(
const std::string& name)
const;
116 void setCollectionIDTable(std::shared_ptr<CollectionIDTable> table) {
117 m_table = std::move(table);
121 mutable std::set<int> m_retrievedIDs{};
122 mutable CollContainer m_collections{};
123 mutable std::vector<CollectionBase*> m_cachedCollections{};
124 IReader* m_reader{
nullptr};
125 std::shared_ptr<CollectionIDTable> m_table;
127 GenericParameters m_evtMD{};
134 static_assert(std::is_base_of<podio::CollectionBase, T>::value,
135 "DataStore only accepts types inheriting from CollectionBase");
148 collection =
static_cast<T*
>(tmp);
149 if (collection !=
nullptr) {
158 auto success = this->
get(name, tmp);
160 throw std::runtime_error(
"No collection \'" + name +
"\' is present in the EventStore");
void registerCollection(const std::string &name, podio::CollectionBase *coll)
register an existing collection
bool get(const std::string &name, const T *&collection)
access a collection by name. returns true if successful
CollectionBase * getFast(int id) const
fast access to cached collections
EventStore(const EventStore &)=delete
Make non-copyable.
ColMDMap * getColMetaDataMap()
std::pair< std::string, CollectionBase * > CollPair
Collection entry. Each collection is identified by a name.
EventStore & operator=(const EventStore &)=delete
std::vector< CollPair > CollContainer
T & create(const std::string &name)
create a new collection
CollectionIDTable * getCollectionIDTable() const
GenericParameters * eventMetaDataPtr()
std::map< int, GenericParameters > ColMDMap
std::map< int, GenericParameters > RunMDMap