TSDuck Version 3.20-1669 (TSDuck - The MPEG Transport Stream Toolkit)
ts::RRT Class Reference

Representation of an ATSC Rating Region Table (RRT). More...

Inheritance diagram for ts::RRT:
Collaboration diagram for ts::RRT:

Classes

class  Dimension
 Description of a dimension. More...
 
class  RatingValue
 Description of a rating value in a dimension. More...
 

Public Types

typedef std::list< DimensionDimensionList
 Description of a rating value in a dimension. More...
 
typedef std::list< RatingValueRatingValueList
 List of rating values.
 

Public Member Functions

 RRT (uint8_t version=0, uint8_t region=0)
 Default constructor. More...
 
 RRT (const RRT &other)
 Copy constructor. More...
 
 RRT (DuckContext &duck, const BinaryTable &table)
 Constructor from a binary table. More...
 
void clear ()
 Clear the content of the table.
 
virtual Standards definingStandards () const override
 Get the list of standards which define this object. More...
 
void deserialize (DuckContext &duck, const BinaryTable &bin)
 This method deserializes a binary table. More...
 
virtual void fromXML (DuckContext &, const xml::Element *) override
 This abstract converts an XML structure to a table or descriptor. More...
 
void invalidate ()
 Invalidate this object. More...
 
bool isValid () const
 Check if this object is valid. More...
 
RRToperator= (const RRT &other)=default
 Assignment operator. More...
 
void serialize (DuckContext &duck, BinaryTable &bin) const
 This method serializes a table. More...
 
TID tableId () const
 Get the table_id. More...
 
virtual xml::ElementtoXML (DuckContext &duck, xml::Element *parent) const
 This method converts this object to XML. More...
 
UString xmlName () const
 Get the XMl node name representing this table or descriptor. More...
 

Static Public Member Functions

static UString DeserializeLanguageCode (const uint8_t *data)
 This static method deserializes a 3-byte language or country code. More...
 
static void DisplaySection (ts::TablesDisplay &display, const ts::Section &section, int indent)
 A static method to display a section. More...
 
static bool SerializeFixedLength (DuckContext &duck, ByteBlock &bb, const UString &str, const size_t size)
 This static method serializes a DVB string with a required fixed size. More...
 
static bool SerializeLanguageCode (ByteBlock &bb, const UString &str, bool allow_empty=false)
 This static method serializes a 3-byte language or country code. More...
 

Public Attributes

DescriptorList descs
 Program-level descriptor list.
 
DimensionList dimensions
 List of dimensions.
 
bool is_current
 True if table is current, false if table is next.
 
uint8_t protocol_version
 ATSC protocol version.
 
uint8_t rating_region
 Rating region id.
 
ATSCMultipleString rating_region_name
 Rating region name.
 
uint8_t version
 Table version number.
 

Static Public Attributes

static const UChar *const XML_GENERIC_DESCRIPTOR
 XML tag name for generic descriptors.
 
static const UChar *const XML_GENERIC_LONG_TABLE
 XML tag name for generic tables with long sections.
 
static const UChar *const XML_GENERIC_SHORT_TABLE
 XML tag name for generic short sections.
 

Protected Member Functions

virtual void buildXML (DuckContext &, xml::Element *) const override
 Helper method to convert this object to XML. More...
 
bool checkXMLName (const xml::Element *element, const UChar *legacy_name=nullptr) const
 Check that an XML element has the right name for this table. More...
 
bool deserializeBool (bool &value, const uint8_t *&data, size_t &size, size_t bit=0)
 Deserialize a one-bit boolean inside one byte. More...
 
virtual void deserializeContent (DuckContext &, const BinaryTable &) override
 This abstract method deserializes the content of a binary table. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool deserializeInt (INT &value, const uint8_t *&data, size_t &size)
 Deserialize an integer. More...
 
bool deserializeLanguageCode (UString &lang, const uint8_t *&data, size_t &size)
 Deserialize a 3-byte language or country code. More...
 
virtual bool isValidTableId (TID tid) const
 This method checks if a table id is valid for this object. More...
 
virtual void serializeContent (DuckContext &, BinaryTable &) const override
 This abstract method serializes the content of a table. More...
 

Protected Attributes

bool _is_valid
 It is the responsibility of the subclasses to set the valid flag.
 
TID _table_id
 The table id can be modified by subclasses only.
 
const UChar *const _xml_name
 XML table or descriptor name.
 

Detailed Description

Representation of an ATSC Rating Region Table (RRT).

See also
ATSC A/65, section 6.4.

Member Typedef Documentation

◆ DimensionList

typedef std::list<Dimension> ts::RRT::DimensionList

Description of a rating value in a dimension.

List of dimensions.

Constructor & Destructor Documentation

◆ RRT() [1/3]

ts::RRT::RRT ( uint8_t  version = 0,
uint8_t  region = 0 
)

Default constructor.

Parameters
[in]versionTable version number.
[in]regionRating region id.

◆ RRT() [2/3]

ts::RRT::RRT ( const RRT other)

Copy constructor.

Parameters
[in]otherOther instance to copy.

◆ RRT() [3/3]

ts::RRT::RRT ( DuckContext duck,
const BinaryTable table 
)

Constructor from a binary table.

Parameters
[in,out]duckTSDuck execution context.
[in]tableBinary table to deserialize.

Member Function Documentation

◆ operator=()

RRT& ts::RRT::operator= ( const RRT other)
default

Assignment operator.

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

◆ fromXML()

virtual void ts::RRT::fromXML ( DuckContext duck,
const xml::Element element 
)
overridevirtual

This abstract converts an XML structure to a table or descriptor.

In case of success, this object is replaced with the interpreted content of the XML structure. In case of error, this object is invalidated.

Parameters
[in,out]duckTSDuck execution context.
[in]elementXML element to convert.

Implements ts::AbstractSignalization.

◆ DisplaySection()

static void ts::RRT::DisplaySection ( ts::TablesDisplay display,
const ts::Section section,
int  indent 
)
static

A static method to display a section.

Parameters
[in,out]displayDisplay engine.
[in]sectionThe section to display.
[in]indentIndentation width.

◆ serializeContent()

virtual void ts::RRT::serializeContent ( DuckContext duck,
BinaryTable bin 
) const
overrideprotectedvirtual

This abstract method serializes the content of a table.

This method is invoked by serialize() when the table is valid.

Parameters
[in,out]duckTSDuck execution context.
[out]binA binary table object. Its content is replaced with a binary representation of this object.

Implements ts::AbstractTable.

◆ deserializeContent()

virtual void ts::RRT::deserializeContent ( DuckContext duck,
const BinaryTable bin 
)
overrideprotectedvirtual

This abstract method deserializes the content of a binary table.

In case of success, this object is replaced with the interpreted content of bin. In case of error, this object is invalidated.

Parameters
[in,out]duckTSDuck execution context.
[in]binA binary table to interpret according to the table subclass.

Implements ts::AbstractTable.

◆ buildXML()

virtual void ts::RRT::buildXML ( DuckContext duck,
xml::Element root 
) const
overrideprotectedvirtual

Helper method to convert this object to XML.

When this object is valid, the default implementation of toXML() creates a root node with the default XML name and then invoke buildXML() to populate the XML node.

The default implementation is to do nothing. Subclasses which override toXML() do not need to implement buildXML() since it won't be invoked.

Parameters
[in,out]rootThe root node for the new XML tree.
[in,out]duckTSDuck execution context.

Reimplemented from ts::AbstractSignalization.

◆ tableId()

TID ts::AbstractTable::tableId ( ) const
inlineinherited

Get the table_id.

Returns
The table_id.

◆ serialize()

void ts::AbstractTable::serialize ( DuckContext duck,
BinaryTable bin 
) const
inherited

This method serializes a table.

Parameters
[in,out]duckTSDuck execution context.
[out]binA binary table object. Its content is replaced with a binary representation of this object.

◆ deserialize()

void ts::AbstractTable::deserialize ( DuckContext duck,
const BinaryTable bin 
)
inherited

This method deserializes a binary table.

In case of success, this object is replaced with the interpreted content of bin. In case of error, this object is invalidated.

Parameters
[in,out]duckTSDuck execution context.
[in]binA binary table to interpret according to the table subclass.

◆ isValidTableId()

virtual bool ts::AbstractTable::isValidTableId ( TID  tid) const
protectedvirtualinherited

This method checks if a table id is valid for this object.

Parameters
[in]tidA table id to check.
Returns
True if tid is a valid table id for this object, false otherwise. The default implementation checks that tid is identical to the table id of this object.

Reimplemented in ts::SDT, ts::EIT, and ts::NIT.

◆ isValid()

bool ts::AbstractSignalization::isValid ( ) const
inlineinherited

Check if this object is valid.

Returns
True if this object is valid.

◆ invalidate()

void ts::AbstractSignalization::invalidate ( )
inlineinherited

Invalidate this object.

This object must be rebuilt.

◆ xmlName()

UString ts::AbstractSignalization::xmlName ( ) const
inherited

Get the XMl node name representing this table or descriptor.

Returns
The XML node name.

◆ toXML()

virtual xml::Element* ts::AbstractSignalization::toXML ( DuckContext duck,
xml::Element parent 
) const
virtualinherited

This method converts this object to XML.

When this object is valid, the default implementation of toXML() creates a root node with the default XML name and then invoke buildXML() to populate the XML node.

Subclasses have the choice to either implement buildXML() or toXML(). If the object is serialized as one single XML node, it is simpler to implement buildXML().

Parameters
[in,out]duckTSDuck execution context.
[in,out]parentThe parent node for the new XML tree.
Returns
The new XML element.

Reimplemented in ts::SSULinkageDescriptor, and ts::SSUDataBroadcastIdDescriptor.

◆ definingStandards()

virtual Standards ts::AbstractSignalization::definingStandards ( ) const
overridevirtualinherited

Get the list of standards which define this object.

Returns
A bit mask of standards.

Implements ts::AbstractDefinedByStandards.

◆ SerializeFixedLength()

static bool ts::AbstractSignalization::SerializeFixedLength ( DuckContext duck,
ByteBlock bb,
const UString str,
const size_t  size 
)
staticinherited

This static method serializes a DVB string with a required fixed size.

Parameters
[in,out]duckTSDuck execution context.
[in,out]bbA byte-block where str will be appended if its size is correct.
[in]strString to serialize.
[in]sizeRequired size in bytes of the serialized string.
Returns
True if the size has the required length and has been serialized.

◆ SerializeLanguageCode()

static bool ts::AbstractSignalization::SerializeLanguageCode ( ByteBlock bb,
const UString str,
bool  allow_empty = false 
)
staticinherited

This static method serializes a 3-byte language or country code.

Parameters
[in,out]bbA byte-block where str will be appended if its size is correct.
[in]strString to serialize.
[in]allow_emptyIf true, an empty string is allowed and serialized as zeroes.
Returns
True if the size has the required length and has been serialized.

◆ DeserializeLanguageCode()

static UString ts::AbstractSignalization::DeserializeLanguageCode ( const uint8_t *  data)
staticinherited

This static method deserializes a 3-byte language or country code.

Parameters
[in]dataAddress of a 3-byte memory area.
Returns
Deserialized string.

◆ checkXMLName()

bool ts::AbstractSignalization::checkXMLName ( const xml::Element element,
const UChar legacy_name = nullptr 
) const
protectedinherited

Check that an XML element has the right name for this table.

Parameters
[in]elementXML element to check.
[in]legacy_nameIf not null, specifies an alternate legacy name.
Returns
True on success, false on error.

◆ deserializeLanguageCode()

bool ts::AbstractSignalization::deserializeLanguageCode ( UString lang,
const uint8_t *&  data,
size_t &  size 
)
protectedinherited

Deserialize a 3-byte language or country code.

Parameters
[out]langDeserialized language code.
[in,out]dataAddress of memory area. Adjusted to point after the deserialized data.
[in,out]sizeRemaining size in bytes of memory area. Adjusted remove the deserialized data.
Returns
True on success, false on error. On error, the object is invalidated.

◆ deserializeInt()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool ts::AbstractSignalization::deserializeInt ( INT value,
const uint8_t *&  data,
size_t &  size 
)
protectedinherited

Deserialize an integer.

Template Parameters
INTSome integer type.
Parameters
[out]valueDeserialized integer value.
[in,out]dataAddress of memory area. Adjusted to point after the deserialized data.
[in,out]sizeRemaining size in bytes of memory area. Adjusted remove the deserialized data.
Returns
True on success, false on error. On error, the object is invalidated.

◆ deserializeBool()

bool ts::AbstractSignalization::deserializeBool ( bool &  value,
const uint8_t *&  data,
size_t &  size,
size_t  bit = 0 
)
protectedinherited

Deserialize a one-bit boolean inside one byte.

Parameters
[out]valueDeserialized bool value.
[in,out]dataAddress of memory area. Adjusted to point after the deserialized data (one byte).
[in,out]sizeRemaining size in bytes of memory area. Adjusted remove the deserialized data.
[in]bitBit number of the boolean in the deserialized byte, from 0 (LSB) to 7 (MSB).
Returns
True on success, false on error. On error, the object is invalidated.

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