TSDuck v3.40-4034
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY > Class Template Reference

Template map of subclasses of EntryBase. More...

#include <tsAbstractTable.h>

Inheritance diagram for ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >:
Collaboration diagram for ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >:

Public Types

using SuperClass = std::map< KEY, ENTRY >
 Explicit reference to the super class.
 

Public Member Functions

 EntryWithDescriptorsMap (const AbstractTable *table, bool auto_ordering=false)
 Basic constructor.
 
 EntryWithDescriptorsMap (const AbstractTable *table, const EntryWithDescriptorsMap &other)
 Basic copy-like constructor.
 
 EntryWithDescriptorsMap (const AbstractTable *table, EntryWithDescriptorsMap &&other)
 Basic move-like constructor.
 
void getOrder (std::vector< KEY > &order) const
 Get the insertion order of entries in the table.
 
size_t nextOrder () const
 Get the next ordering hint to be used in an entry to make sure it is considered the last one.
 
EntryWithDescriptorsMapoperator= (const EntryWithDescriptorsMap &other)
 Assignment operator.
 
EntryWithDescriptorsMapoperator= (EntryWithDescriptorsMap &&other)
 Move assignment operator.
 
ENTRY & operator[] (const KEY &key)
 Access or create an entry.
 
const ENTRY & operator[] (const KEY &key) const
 Access an existing entry in a read-only map.
 
void setOrder (const std::vector< KEY > &order)
 Define the insertion order of entries in the table.
 
void swap (EntryWithDescriptorsMap &other)
 Swap two instances (override of std::list).
 

Detailed Description

template<typename KEY, class ENTRY>
requires std::derived_from<ENTRY, ts::AbstractTable::EntryBase>
class ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >

Template map of subclasses of EntryBase.

Template Parameters
KEYA type which is used as key of the map.
ENTRYA subclass of EntryBase (enforced at compile-time).

Implementation note: Because of a bug in MSVC, the full path of EntryBase must be specified in the "requires" directive.

Constructor & Destructor Documentation

◆ EntryWithDescriptorsMap() [1/3]

template<typename KEY , class ENTRY >
ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::EntryWithDescriptorsMap ( const AbstractTable table,
bool  auto_ordering = false 
)
explicit

Basic constructor.

Parameters
[in]tableParent table. A descriptor list is always attached to a table.
[in]auto_orderingIf true, each time an entry is added, its order_hint, if previously unset (meaning set to NPOS) is set to one higher than the highest order_hint in all entries. This ensures that the order of insertion is preserved, at the expense of a small performance penalty each time an entry is added.

◆ EntryWithDescriptorsMap() [2/3]

template<typename KEY , class ENTRY >
ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::EntryWithDescriptorsMap ( const AbstractTable table,
const EntryWithDescriptorsMap< KEY, ENTRY > &  other 
)

Basic copy-like constructor.

Parameters
[in]tableParent table. A descriptor list is always attached to a table.
[in]otherAnother instance to copy.

◆ EntryWithDescriptorsMap() [3/3]

template<typename KEY , class ENTRY >
ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::EntryWithDescriptorsMap ( const AbstractTable table,
EntryWithDescriptorsMap< KEY, ENTRY > &&  other 
)

Basic move-like constructor.

Parameters
[in]tableParent table. A descriptor list is always attached to a table.
[in,out]otherAnother instance to move.

Member Function Documentation

◆ operator=() [1/2]

template<typename KEY , class ENTRY >
ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY > & ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::operator= ( const EntryWithDescriptorsMap< KEY, ENTRY > &  other)

Assignment operator.

The parent table remains unchanged.

Parameters
[in]otherAnother instance to copy.
Returns
A reference to this object.

◆ operator=() [2/2]

template<typename KEY , class ENTRY >
ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY > & ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::operator= ( EntryWithDescriptorsMap< KEY, ENTRY > &&  other)

Move assignment operator.

The parent table remains unchanged.

Parameters
[in,out]otherAnother instance to move.
Returns
A reference to this object.

◆ swap()

template<typename KEY , class ENTRY >
void ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::swap ( EntryWithDescriptorsMap< KEY, ENTRY > &  other)

Swap two instances (override of std::list).

Parameters
[in,out]otherAnother instance to swap with the current object.

◆ operator[]() [1/2]

template<typename KEY , class ENTRY >
ENTRY & ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::operator[] ( const KEY &  key)

Access or create an entry.

Parameters
[in]keyThe key of the entry to access.
Returns
A reference to the retrieved or created entry.

◆ operator[]() [2/2]

template<typename KEY , class ENTRY >
const ENTRY & ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::operator[] ( const KEY &  key) const

Access an existing entry in a read-only map.

Parameters
[in]keyThe key of the entry to access.
Returns
A constant reference to the retrieved entry.
Exceptions
std::out_of_rangeWhen the entry does not exist.

◆ getOrder()

template<typename KEY , class ENTRY >
void ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::getOrder ( std::vector< KEY > &  order) const

Get the insertion order of entries in the table.

The result is based on the order_hint fields in the EntryBase structures.

Parameters
[out]orderOrder of entries by key in the table.

◆ setOrder()

template<typename KEY , class ENTRY >
void ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::setOrder ( const std::vector< KEY > &  order)

Define the insertion order of entries in the table.

This can be precisely set using the order_hint fields in the EntryBase structures. This method is a helper which sets these fields.

Parameters
[in]orderOrder of entries by key in the table.

◆ nextOrder()

template<typename KEY , class ENTRY >
size_t ts::AbstractTable::EntryWithDescriptorsMap< KEY, ENTRY >::nextOrder ( ) const

Get the next ordering hint to be used in an entry to make sure it is considered the last one.

Returns
The next ordering hint to be used.

The documentation for this class was generated from the following file: