File Frame.h
-
namespace podio
Typedefs
-
template<typename T>
using EnableIfCollection = typename std::enable_if_t<isCollection<T>> Alias template for enabling overloads only for Collections.
-
template<typename T>
using EnableIfCollectionRValue = typename std::enable_if_t<isCollection<T> && !std::is_lvalue_reference_v<T>> Alias template for enabling overloads only for Collection r-values.
Functions
-
template<typename FrameDataT>
std::optional<podio::CollectionReadBuffers> unpack(FrameDataT *data, const std::string &name)
-
class Frame
- #include <podio/Frame.h>
Frame class that serves as a container of collection and meta data.
Public Functions
-
inline Frame()
Empty Frame constructor.
-
template<typename FrameDataT>
Frame(std::unique_ptr<FrameDataT>) Frame constructor from (almost) arbitrary raw data.
-
template<typename FrameDataT, typename = EnableIfRValue<FrameDataT>>
Frame(FrameDataT&&) Frame constructor from (almost) arbitrary raw data.
This r-value overload is mainly present for enabling the python bindings, where cppyy seems to strip the std::unique_ptr somewhere in the process
-
Frame(const Frame&) = delete
-
Frame(Frame&&) = default
-
~Frame() = default
Frame destructor.
-
template<typename CollT, typename = EnableIfCollection<CollT>>
const CollT &get(const std::string &name) const Get a collection from the Frame.
-
inline const podio::CollectionBase *get(const std::string &name) const
Get a collection from the Frame.
This is the pointer-to-base version for type-erased access (e.g. python interface)
-
template<typename CollT, typename = EnableIfCollectionRValue<CollT>>
const CollT &put(CollT &&coll, const std::string &name) (Destructively) move a collection into the Frame and get a const reference back for further use
-
inline void put(std::unique_ptr<podio::CollectionBase> coll, const std::string &name)
Move a collection into the Frame handing over ownership to the Frame.
-
template<typename T, typename = podio::EnableIfValidGenericDataType<T>>
inline void putParameter(const std::string &key, T value) Add a value to the parameters of the Frame (if the type is supported).
Copy the value into the internal store
-
inline void putParameter(const std::string &key, std::string value)
Add a string value to the parameters of the Frame by copying it.
Dedicated overload for enabling the on-the-fly conversion on the string literals.
-
inline void putParameter(const std::string &key, std::vector<std::string> values)
Add a vector of strings to the parameters of the Frame (via copy).
Dedicated overload for enabling on-the-fly conversions of initializer_list of string literals.
-
template<typename T, typename = std::enable_if_t<detail::isInTuple<T, SupportedGenericDataTypes>>>
inline void putParameter(const std::string &key, std::initializer_list<T> &&values) Add a vector of values into the parameters of the Frame.
Overload for catching on-the-fly conversions of initializer_lists of values.
-
template<typename T, typename = podio::EnableIfValidGenericDataType<T>>
inline podio::GenericDataReturnType<T> getParameter(const std::string &key) const Retrieve parameters via key from the internal store.
Return type will either by a const reference or a value depending on the desired type.
-
inline const podio::GenericParameters &getParameters() const
Get all parameters that are stored in this Frame.
-
template<typename T, typename = podio::EnableIfValidGenericDataType<T>>
inline std::vector<std::string> getParameterKeys() const Get the keys of all stored parameters for a given type.
-
inline std::vector<std::string> getAvailableCollections() const
Get all currently available collections (including potentially unpacked ones from raw data)
-
inline const podio::GenericParameters &getGenericParametersForWrite() const
Get the GenericParameters for writing.
-
inline const podio::CollectionBase *getCollectionForWrite(const std::string &name) const
Get a collection for writing (in a prepared and “ready-to-write” state)
-
inline podio::CollectionIDTable getCollectionIDTableForWrite() const
Private Members
-
std::unique_ptr<FrameConcept> m_self
The internal concept pointer through which all the work is done.
-
struct FrameConcept
Internal abstract interface for the type-erased implementation of the Frame class.
Public Functions
-
virtual ~FrameConcept() = default
-
virtual const podio::CollectionBase *get(const std::string &name) const = 0
-
virtual const podio::CollectionBase *put(std::unique_ptr<podio::CollectionBase> coll, const std::string &name) = 0
-
virtual podio::GenericParameters ¶meters() = 0
-
virtual const podio::GenericParameters ¶meters() const = 0
-
virtual std::vector<std::string> availableCollections() const = 0
-
virtual podio::CollectionIDTable getIDTable() const = 0
-
virtual ~FrameConcept() = default
-
template<typename FrameDataT>
struct FrameModel : public podio::Frame::FrameConcept, public podio::ICollectionProvider The interface implementation of the abstract FrameConcept that is necessary for a type-erased implementation of the Frame class.
Public Functions
-
FrameModel(std::unique_ptr<FrameDataT> data)
-
~FrameModel() = default
-
FrameModel(const FrameModel&) = delete
-
FrameModel &operator=(const FrameModel&) = delete
-
FrameModel(FrameModel&&) = default
-
FrameModel &operator=(FrameModel&&) = default
-
const podio::CollectionBase *get(const std::string &name) const final
Try and get the collection from the internal storage and return a pointer to it if found.
Otherwise return a nullptr
-
const podio::CollectionBase *put(std::unique_ptr<CollectionBase> coll, const std::string &name) final
Try and place the collection into the internal storage and return a pointer to it.
If a collection already exists or insertion fails, return a nullptr
-
inline podio::GenericParameters ¶meters() override
Get a reference to the internally used GenericParameters.
-
inline const podio::GenericParameters ¶meters() const override
Get a const reference to the internally used GenericParameters.
-
bool get(uint32_t collectionID, podio::CollectionBase *&collection) const override
-
inline podio::CollectionIDTable getIDTable() const override
-
std::vector<std::string> availableCollections() const override
Private Types
-
using CollectionMapT = std::unordered_map<std::string, std::unique_ptr<podio::CollectionBase>>
Private Functions
-
podio::CollectionBase *doGet(const std::string &name, bool setReferences = true) const
Private Members
-
mutable CollectionMapT m_collections = {}
The internal map for storing unpacked collections.
-
mutable std::unique_ptr<std::mutex> m_mapMtx = {nullptr}
The mutex for guarding the internal collection map.
-
std::unique_ptr<FrameDataT> m_data = {nullptr}
The raw data read from file.
-
mutable std::unique_ptr<std::mutex> m_dataMtx = {nullptr}
The mutex for guarding the raw data.
-
podio::CollectionIDTable m_idTable = {}
The collection ID table.
-
std::unique_ptr<podio::GenericParameters> m_parameters = {nullptr}
The generic parameter store for this frame.
-
mutable std::set<uint32_t> m_retrievedIDs = {}
The IDs of the collections that we have already read (but not yet put into the map)
-
FrameModel(std::unique_ptr<FrameDataT> data)
-
inline Frame()
-
template<typename T>