PODIO v00-16-03
An Event-Data-Model Toolkit for High Energy Physics Experiments
Loading...
Searching...
No Matches
CollectionBase.h
Go to the documentation of this file.
1#ifndef PODIO_COLLECTIONBASE_H
2#define PODIO_COLLECTIONBASE_H
3
5#include "podio/ObjectID.h"
6
7#include <iostream>
8#include <string>
9#include <utility>
10#include <vector>
11
12namespace podio {
13// forward declarations
14class ICollectionProvider;
15
17protected:
18 /// default constructor
19 CollectionBase() = default;
20 /// Move constructor
22 /// Move assignment
24
25public:
26 /// No copy c'tor because collections are move-only
28 /// No copy assignment because collections are move-only
30
31 /// prepare buffers for serialization
32 virtual void prepareForWrite() const = 0;
33
34 /// re-create collection from buffers after read
35 virtual void prepareAfterRead() = 0;
36
37 /// initialize references after read
38 virtual bool setReferences(const ICollectionProvider* collectionProvider) = 0;
39
40 /// set collection ID
41 virtual void setID(unsigned id) = 0;
42
43 /// get collection ID
44 virtual unsigned getID() const = 0;
45
46 /// Get the collection buffers for this collection
48
49 /// Create (empty) collection buffers from which a collection can be constructed
51
52 /// check for validity of the container after read
53 virtual bool isValid() const = 0;
54
55 /// number of elements in the collection
56 virtual size_t size() const = 0;
57
58 /// fully qualified type name
59 virtual std::string getTypeName() const = 0;
60 /// fully qualified type name of elements - with namespace
61 virtual std::string getValueTypeName() const = 0;
62 /// fully qualified type name of stored POD elements - with namespace
63 virtual std::string getDataTypeName() const = 0;
64
65 /// destructor
66 virtual ~CollectionBase() = default;
67
68 /// clear the collection and all internal states
69 virtual void clear() = 0;
70
71 /// check if this collection is a subset collection
72 virtual bool isSubsetCollection() const = 0;
73
74 /// declare this collection to be a subset collection
75 virtual void setSubsetCollection(bool setSubset = true) = 0;
76
77 /// print this collection to the passed stream
78 virtual void print(std::ostream& os = std::cout, bool flush = true) const = 0;
79
80 /// Get the index in the DatatypeRegistry of the EDM this collection belongs to
81 virtual size_t getDatamodelRegistryIndex() const = 0;
82};
83
84} // namespace podio
85
86#endif
CollectionBase()=default
default constructor
virtual void clear()=0
clear the collection and all internal states
virtual void setID(unsigned id)=0
set collection ID
virtual size_t size() const =0
number of elements in the collection
CollectionBase(CollectionBase &&)=default
Move constructor.
virtual std::string getTypeName() const =0
fully qualified type name
virtual std::string getValueTypeName() const =0
fully qualified type name of elements - with namespace
virtual void prepareAfterRead()=0
re-create collection from buffers after read
virtual size_t getDatamodelRegistryIndex() const =0
Get the index in the DatatypeRegistry of the EDM this collection belongs to.
virtual void prepareForWrite() const =0
prepare buffers for serialization
CollectionBase(const CollectionBase &)=delete
No copy c'tor because collections are move-only.
virtual bool isSubsetCollection() const =0
check if this collection is a subset collection
virtual unsigned getID() const =0
get collection ID
virtual bool setReferences(const ICollectionProvider *collectionProvider)=0
initialize references after read
virtual podio::CollectionWriteBuffers getBuffers()=0
Get the collection buffers for this collection.
CollectionBase & operator=(CollectionBase &&)=default
Move assignment.
virtual std::string getDataTypeName() const =0
fully qualified type name of stored POD elements - with namespace
virtual void setSubsetCollection(bool setSubset=true)=0
declare this collection to be a subset collection
virtual ~CollectionBase()=default
destructor
virtual bool isValid() const =0
check for validity of the container after read
virtual void print(std::ostream &os=std::cout, bool flush=true) const =0
print this collection to the passed stream
virtual podio::CollectionReadBuffers createBuffers()=0
Create (empty) collection buffers from which a collection can be constructed.
CollectionBase & operator=(const CollectionBase &)=delete
No copy assignment because collections are move-only.