TSDuck v3.38-3699
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::CASDate< YEARBASE > Class Template Reference

Template representation of a CAS date. More...

#include <tsCASDate.h>

Inheritance diagram for ts::CASDate< YEARBASE >:
Collaboration diagram for ts::CASDate< YEARBASE >:

Public Member Functions

 CASDate ()=default
 Default constructor.
 
 CASDate (const Time &t)
 Constructor from a Time object.
 
 CASDate (int year, int month, int day)
 Constructor from fields.
 
 CASDate (uint16_t value)
 Constructor from a 16-bit binary value.
 
int day () const
 Get the day number.
 
void invalidate ()
 Make the date invalid.
 
bool isValid () const
 Check if a date is valid.
 
int month () const
 Get the month number.
 
 operator ts::Time () const
 Convert to a Time object.
 
bool operator< (const CASDate &t) const
 Comparison operator.
 
bool operator<= (const CASDate &t) const
 Comparison operator.
 
bool operator== (const CASDate &t) const
 Comparison operator.
 
bool operator> (const CASDate &t) const
 Comparison operator.
 
bool operator>= (const CASDate &t) const
 Comparison operator.
 
virtual UString toString () const override
 Convert to a string object.
 
uint16_t value () const
 Convert to a 16-bit value, for binary insertion.
 
int year () const
 Get the year number.
 

Static Public Member Functions

static CASDate Max ()
 A static function to return the maximum date.
 
static CASDate Min ()
 A static function to return the minimum date.
 

Static Public Attributes

static constexpr uint16_t INVALID_DATE = 0xFFFF
 An invalid 16-bit date value.
 
static constexpr int MAX_YEAR = YEARBASE + 127
 The last representable year.
 
static constexpr int MIN_YEAR = YEARBASE
 The first representable year.
 

Detailed Description

template<int YEARBASE>
class ts::CASDate< YEARBASE >

Template representation of a CAS date.

This general format is used by several CAS vendors.

Template Parameters
YEARBASEThe base year for the dates (CAS dependent).

Constructor & Destructor Documentation

◆ CASDate() [1/4]

template<int YEARBASE>
ts::CASDate< YEARBASE >::CASDate ( )
default

Default constructor.

The date is initially invalid.

◆ CASDate() [2/4]

template<int YEARBASE>
ts::CASDate< YEARBASE >::CASDate ( uint16_t  value)
inline

Constructor from a 16-bit binary value.

Parameters
[in]value16-bit binary representation of the date.

◆ CASDate() [3/4]

template<int YEARBASE>
ts::CASDate< YEARBASE >::CASDate ( int  year,
int  month,
int  day 
)
inline

Constructor from fields.

Parameters
[in]yearYear number.
[in]monthMonth number.
[in]dayDay number.

◆ CASDate() [4/4]

template<int YEARBASE>
ts::CASDate< YEARBASE >::CASDate ( const Time t)

Constructor from a Time object.

Parameters
[in]tA Time object.

Member Function Documentation

◆ Min()

template<int YEARBASE>
static CASDate ts::CASDate< YEARBASE >::Min ( )
inlinestatic

A static function to return the minimum date.

Returns
The minimum date (January 1st, base year).

◆ Max()

template<int YEARBASE>
static CASDate ts::CASDate< YEARBASE >::Max ( )
inlinestatic

A static function to return the maximum date.

Returns
The maximum date (December 31st, last year).

◆ isValid()

template<int YEARBASE>
bool ts::CASDate< YEARBASE >::isValid ( ) const
inline

Check if a date is valid.

Returns
True if the date is valid.

◆ year()

template<int YEARBASE>
int ts::CASDate< YEARBASE >::year ( ) const
inline

Get the year number.

Returns
The year number.

◆ month()

template<int YEARBASE>
int ts::CASDate< YEARBASE >::month ( ) const
inline

Get the month number.

Returns
The month number.

◆ day()

template<int YEARBASE>
int ts::CASDate< YEARBASE >::day ( ) const
inline

Get the day number.

Returns
The day number.

◆ value()

template<int YEARBASE>
uint16_t ts::CASDate< YEARBASE >::value ( ) const
inline

Convert to a 16-bit value, for binary insertion.

Returns
The 16-bit value, for binary insertion.

◆ operator ts::Time()

template<int YEARBASE>
ts::CASDate< YEARBASE >::operator ts::Time ( ) const

Convert to a Time object.

Returns
The Time object or Time::Epoch if invalid.

◆ toString()

template<int YEARBASE>
ts::UString ts::CASDate< YEARBASE >::toString ( ) const
overridevirtual

Convert to a string object.

Returns
This object, converted as a string.

Implements ts::StringifyInterface.

◆ operator==()

template<int YEARBASE>
bool ts::CASDate< YEARBASE >::operator== ( const CASDate< YEARBASE > &  t) const
inline

Comparison operator.

Parameters
[in]tA data to assign.
Returns
True if this object == t.

◆ operator<()

template<int YEARBASE>
bool ts::CASDate< YEARBASE >::operator< ( const CASDate< YEARBASE > &  t) const
inline

Comparison operator.

Parameters
[in]tA data to assign.
Returns
True if this object < t.

◆ operator<=()

template<int YEARBASE>
bool ts::CASDate< YEARBASE >::operator<= ( const CASDate< YEARBASE > &  t) const
inline

Comparison operator.

Parameters
[in]tA data to assign.
Returns
True if this object <= t.

◆ operator>()

template<int YEARBASE>
bool ts::CASDate< YEARBASE >::operator> ( const CASDate< YEARBASE > &  t) const
inline

Comparison operator.

Parameters
[in]tA data to assign.
Returns
True if this object > t.

◆ operator>=()

template<int YEARBASE>
bool ts::CASDate< YEARBASE >::operator>= ( const CASDate< YEARBASE > &  t) const
inline

Comparison operator.

Parameters
[in]tA data to assign.
Returns
True if this object >= t.

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