Class podio::LinkCollection

template<typename FromT, typename ToT>
class LinkCollection : public podio::CollectionBase

Public Types

using from_type = FromT
using to_type = ToT
using value_type = Link<FromT, ToT>
using mutable_type = MutableLink<FromT, ToT>
using const_iterator = LinkCollectionIterator<FromT, ToT>
using iterator = LinkMutableCollectionIterator<FromT, ToT>
using difference_type = ptrdiff_t
using size_type = size_t
using const_reverse_iterator = std::reverse_iterator<const_iterator>
using reverse_iterator = std::reverse_iterator<iterator>

Public Functions

LinkCollection() = default
inline LinkCollection(CollectionDataT &&data, bool isSubsetColl)
LinkCollection(const LinkCollection&) = delete
LinkCollection &operator=(const LinkCollection&) = delete
LinkCollection(LinkCollection&&) = default
LinkCollection &operator=(LinkCollection&&) = default
inline ~LinkCollection() override
inline mutable_type create()

Append a new link to the collection and return this object.

template<typename FromU, typename ToU>
inline mutable_type create(FromU &&from, ToU &&to, float weight = 1.0f)

Append a new link to the collection, linking the two passed objects, and return this object.

If FromT and ToT are different types, the two objects may be passed in any order and the direction of the link is deduced at compile time. If both orders are possible (e.g. because interface types are involved) the canonical order, i.e. from first, to second, takes precedence. If FromT and ToT are the same type, the canonical order is the only possible one.

Template Parameters:
  • FromU – the type of the first object (inferred!)

  • ToU – the type of the second object (inferred!)

Parameters:
  • from – the object to link (the from object in canonical order)

  • to – the object to link (the to object in canonical order)

  • weight – the weight of the link (defaults to 1)

Throws:

std::logic_error – if this is a subset collection

Returns:

the newly created (mutable) link

inline value_type operator[](std::size_t index) const

Returns the immutable object of given index.

inline mutable_type operator[](std::size_t index)

Returns the mutable object of given index.

inline value_type at(std::size_t index) const

Returns the immutable object of given index.

inline mutable_type at(std::size_t index)

Returns the mutable object of given index.

inline void push_back(mutable_type object)
inline void push_back(value_type object)
inline virtual size_t size() const override

Number of elements in the collection.

inline virtual std::size_t max_size() const override

maximal number of elements in the collection

inline virtual bool empty() const override

Is the collection empty.

inline virtual void clear() override

clear the collection and all internal states

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

print this collection to the passed stream

inline const_iterator begin() const
inline const_iterator cbegin() const
inline const_iterator end() const
inline const_iterator cend() const
inline iterator begin()
inline iterator end()
inline reverse_iterator rbegin()
inline const_reverse_iterator rbegin() const
inline const_reverse_iterator crbegin() const
inline reverse_iterator rend()
inline const_reverse_iterator rend() const
inline const_reverse_iterator crend() const
inline virtual bool hasID() const override

check if the collection has a valid ID

inline virtual bool isValid() const override
inline virtual podio::CollectionWriteBuffers getBuffers() override

Get the collection buffers for this collection.

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 bool isSubsetCollection() const override

check if this collection is a subset collection

inline virtual void setSubsetCollection(bool setSubset = true) override

declare this collection to be a subset collection

inline virtual void setID(uint32_t id) override

set collection ID

inline virtual uint32_t getID() const override

get collection ID

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 *collectionProvider) override

initialize references after read

inline virtual SchemaVersionT getSchemaVersion() const override

schema version of the collection

inline virtual size_t getDatamodelRegistryIndex() const override

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

Public Static Functions

template<detail::RangeConvertibleTo<value_type> R>
static inline LinkCollection from(R &&range)

Construct a LinkCollection from a range of mutable or immutable links.

If the range is over mutable Link handles, the collection will (try) to take ownership of the handles. If the range is over immutable Link handles the collection will be a subset collection and not take ownership of the handles.

Template Parameters:

R – A range type (at least std::input_range) that contains for which the range_value_t is convertible to an immutable link.

Parameters:

range – The range from which the collection should be constructed

Throws:

std::invalid_argument – if a range of immutable handles that are not yet owned by a collection

Returns:

A LinkCollection populated with the values from the range

static inline void __cppyy_pythonize__(PyObject *klass, const std::string &name)

Cppyy protocol to setup the pythonizations for this class. Not to be called directly.

Public Static Attributes

static std::string_view typeName = podio::utils::static_concatenate_v<podio::detail::link_coll_name_prefix, FromT::typeName, podio::detail::link_name_infix, ToT::typeName, podio::detail::link_name_suffix>
static std::string_view valueTypeName = value_type::typeName
static std::string_view dataTypeName = "podio::LinkData"
static SchemaVersionT schemaVersion = 1