File UserDataCollection.h

Defines

PODIO_ADD_USER_TYPE(type)
namespace podio

Typedefs

using SupportedUserDataTypes = std::tuple<float, double, int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t, uint64_t>

tuple of basic types supported in user vector

template<typename T>
using EnableIfSupportedUserType = std::enable_if_t<detail::isInTuple<T, SupportedUserDataTypes>>

Alias template to be used to enable template specializations only for the types listed in the SupportedUserDataTypes list.

Functions

template<typename BasicType, typename = EnableIfSupportedUserType<BasicType>>
constexpr const char *userDataTypeName()

helper template to provide readable type names for basic types with macro PODIO_ADD_USER_TYPE(type)

template<typename BasicType, typename = EnableIfSupportedUserType<BasicType>>
constexpr const char *userDataCollTypeName()

Helper template to provide the fully qualified name of a UserDataCollection.

Implementations are populated by the PODIO_ADD_USER_TYPE macro.

template<typename BasicType, typename = EnableIfSupportedUserType<BasicType>>
std::ostream &operator<<(std::ostream &o, const podio::UserDataCollection<BasicType> &coll)
template<typename BasicType, typename = EnableIfSupportedUserType<BasicType>>
class UserDataCollection : public podio::CollectionBase
#include <podio/UserDataCollection.h>

Collection of basic types for additional user data not defined in the EDM.

The data is stored in an std::vector<basic_type>. Supported are all basic types supported in PODIO, i.e. float, double and 8-64 bit fixed size signed and unsigned integers -

See also

SupportedUserDataTypes.

Author

F.Gaede, DESY

Date

Sep 2021

Public Functions

UserDataCollection() = default
inline UserDataCollection(std::vector<BasicType> &&vec)

Constructor from an existing vector (which will be moved from!)

UserDataCollection(const UserDataCollection&) = delete
UserDataCollection &operator=(const UserDataCollection&) = delete
UserDataCollection(UserDataCollection&&) = default
UserDataCollection &operator=(UserDataCollection&&) = default
~UserDataCollection() = default
inline virtual void prepareForWrite() const override

prepare buffers for serialization

inline virtual void prepareAfterRead() override

re-create collection from buffers after read

inline virtual bool setReferences(const ICollectionProvider*) override

initialize references after read

inline virtual void setID(uint32_t id) override

set collection ID

inline virtual uint32_t getID() const override

get collection ID

inline virtual podio::CollectionWriteBuffers getBuffers() override

Get the collection buffers for this collection.

inline virtual bool isValid() const override

check for validity of the container after read

inline virtual size_t size() const override

number of elements in the collection

inline virtual bool empty() const override

Is the collection empty.

inline virtual const std::string_view getTypeName() const override

fully qualified type name

inline virtual const std::string_view getValueTypeName() const override

fully qualified type name of elements - with namespace

inline virtual const std::string_view getDataTypeName() const override

fully qualified type name of stored POD elements - with namespace

inline virtual void clear() override

clear the collection and all internal states

inline virtual bool isSubsetCollection() const override

check if this collection is a subset collection - no subset possible

inline virtual void setSubsetCollection(bool) override

declare this collection to be a subset collection - no effect

inline virtual SchemaVersionT getSchemaVersion() const final

The schema version is fixed manually.

inline virtual void print(std::ostream &os = std::cout, bool flush = true) const override

Print this collection to the passed stream.

inline virtual size_t getDatamodelRegistryIndex() const override

Get the index in the DatatypeRegistry of the EDM this collection belongs to.

inline std::vector<BasicType>::iterator begin()
inline std::vector<BasicType>::iterator end()
inline std::vector<BasicType>::const_iterator begin() const
inline std::vector<BasicType>::const_iterator end() const
inline std::vector<BasicType>::reference operator[](size_t idx)
inline std::vector<BasicType>::const_reference operator[](size_t idx) const
inline void resize(size_t count)
inline void push_back(const BasicType &value)
inline std::vector<BasicType> &vec()

access to the actual data vector

inline const std::vector<BasicType> &vec() const

const access to the actual data vector

Public Static Attributes

static constexpr SchemaVersionT schemaVersion = 1

The schema version of UserDataCollections.

static constexpr auto typeName = userDataCollTypeName<BasicType>()
static constexpr auto valueTypeName = userDataTypeName<BasicType>()
static constexpr auto dataTypeName = userDataTypeName<BasicType>()

Private Members

std::vector<BasicType> _vec = {}
std::vector<BasicType> *_vecPtr = {nullptr}
uint32_t m_collectionID = {0}
CollRefCollection m_refCollections = {}
VectorMembersInfo m_vecmem_info = {}