Helpers

class adm::Route

Route along ADM elements within an ADM document.

Describes route along ADM elements within an ADM document, i.e. which references were followed to reach a certain element from a given start point.

This is the same purpose (and basic interface) as adm::Path, but currently the implementation and constraints are different.

Thus, the name adm::Route has been chosen to distinguish between those two.

The main/essential difference is that the adm::Route stores pointers to the ADM elements, to make it easy to access the elements after a adm::Route has been created, while the adm::Path does not, as they might become invalid. Instead the adm::Path stores the (coded) element ids, which are also used to check if adm::Paths are equal or not.

To easily create an adm::Route you may use the adm::RouteTracer.

Routes are ordered first by the hash of their elements, then by the elements themselves.

Public Types

typedef std::size_t hash_type
typedef std::vector<adm::ElementConstVariant>::iterator iterator
typedef std::vector<adm::ElementConstVariant>::const_iterator const_iterator
typedef adm::ElementConstVariant value_type

Public Functions

Route() = default
template<typename Element>
inline void add(std::shared_ptr<Element> element)
inline void add(adm::ElementConstVariant element)
template<typename Element>
std::shared_ptr<const Element> getFirstOf() const
template<typename Element>
std::shared_ptr<const Element> getLastOf() const
template<typename Element>
const_iterator findFirstOf() const
template<typename Element>
const_iterator findLastOf() const
inline const_iterator begin() const
inline const_iterator end() const
inline const adm::ElementConstVariant &front() const
inline const adm::ElementConstVariant &back() const
inline std::size_t size() const
inline hash_type hash() const

Get hash value.

class adm::Path

Path along ADM elements within an ADM document.

Describes route along ADM elements within an ADM document, i.e. which references were followed to reach a certain element from a given start point.

This is the same purpose (and basic interface) as adm::Route, but currently the implementation and constraints are different.

Thus, the name adm::Path has been chosen to distinguish between those two.

The main/essential difference is that the adm::Route stores pointers to the ADM elements, to make it easy to access the elements after a adm::Route has been created, while the adm::Path does not, as they might become invalid. Instead the adm::Path stores the (coded) element ids, which are also used to check if adm::Paths are equal or not.

Public Types

typedef std::size_t hash_type
typedef std::vector<ElementIdVariant>::iterator iterator
typedef std::vector<ElementIdVariant>::const_iterator const_iterator

Public Functions

template<typename AdmId>
inline void add(AdmId id)
template<typename Element>
inline void add(std::shared_ptr<const Element> element)
void add(ElementConstVariant elementVariant)
void add(ElementIdVariant elementIdVariant)
inline hash_type hash() const
inline const_iterator begin() const
inline const_iterator end() const
inline ElementIdVariant front() const
inline ElementIdVariant back() const
inline std::size_t size() const
template<typename AdmElementId>
AdmElementId getFirstOf() const
template<typename AdmElementId>
AdmElementId getLastOf() const
template<typename AdmElementId>
bool hasIdType() const
using adm::RouteTracer = detail::GenericRouteTracer<Route, detail::DefaultFullDepthStrategy>

Creates adm::Routes.

This implementation traces the following route:

  • audioProgramme

  • audioContent

  • audioObject

  • audioPackFormat

  • audioChannelFormat

Complementary AudioObjects are not interpreted as such. Hence for every complementary audioObject an Route will be returned.

Warning

If the ADM structure contains a reference cycle, trace will get stuck in an infinite loop.

template<typename Property, typename ElementPtr>
Property adm::getPropertyOr(ElementPtr element, Property defaultValue)

Return value of a property or a given defaultValue if the property is not available.

This is just a more expressive shorthand equivalent to

element->has<Property>() ? element->get<Property>() : defaultValue;