File indexing completed on 2024-11-15 09:50:08
0001 #ifndef PODIO_COLLECTIONBASE_H
0002 #define PODIO_COLLECTIONBASE_H
0003
0004 #include "podio/CollectionBuffers.h"
0005 #include "podio/ObjectID.h"
0006 #include "podio/SchemaEvolution.h"
0007
0008 #include <iostream>
0009 #include <string_view>
0010 #include <utility>
0011 #include <vector>
0012
0013 namespace podio {
0014
0015 class ICollectionProvider;
0016
0017 struct RelationNames;
0018
0019 class CollectionBase {
0020 protected:
0021
0022 CollectionBase() = default;
0023
0024 CollectionBase(CollectionBase&&) = default;
0025
0026 CollectionBase& operator=(CollectionBase&&) = default;
0027
0028 public:
0029
0030 CollectionBase(const CollectionBase&) = delete;
0031
0032 CollectionBase& operator=(const CollectionBase&) = delete;
0033
0034
0035 virtual void prepareForWrite() const = 0;
0036
0037
0038 virtual void prepareAfterRead() = 0;
0039
0040
0041 virtual bool setReferences(const ICollectionProvider* collectionProvider) = 0;
0042
0043
0044 virtual void setID(uint32_t id) = 0;
0045
0046
0047 virtual uint32_t getID() const = 0;
0048
0049
0050 virtual podio::CollectionWriteBuffers getBuffers() = 0;
0051
0052
0053 virtual bool isValid() const = 0;
0054
0055
0056 virtual size_t size() const = 0;
0057
0058
0059 virtual bool empty() const = 0;
0060
0061
0062 virtual const std::string_view getTypeName() const = 0;
0063
0064 virtual const std::string_view getValueTypeName() const = 0;
0065
0066 virtual const std::string_view getDataTypeName() const = 0;
0067
0068 virtual SchemaVersionT getSchemaVersion() const = 0;
0069
0070
0071 virtual ~CollectionBase() = default;
0072
0073
0074 virtual void clear() = 0;
0075
0076
0077 virtual bool isSubsetCollection() const = 0;
0078
0079
0080 virtual void setSubsetCollection(bool setSubset = true) = 0;
0081
0082
0083 virtual void print(std::ostream& os = std::cout, bool flush = true) const = 0;
0084
0085
0086 virtual size_t getDatamodelRegistryIndex() const = 0;
0087 };
0088
0089 }
0090
0091 #endif