ANNA Suite  2020b
Multipurpose development suite for Telco applications
Classes | Public Member Functions | List of all members
anna::diameter::codec::basetypes::Time Class Reference

#include <Time.hpp>

Inheritance diagram for anna::diameter::codec::basetypes::Time:
Inheritance graph
[legend]
Collaboration diagram for anna::diameter::codec::basetypes::Time:
Collaboration graph
[legend]

Classes

struct  Timestamp
 

Public Member Functions

virtual ~Time ()
 
U32 getTimestamp (Timestamp::_v timestampType=Timestamp::NTP) const
 
void setTimestamp (const U32 &timestamp, Timestamp::_v timestampType=Timestamp::NTP)
 
std::string getFormatName () const
 
std::string asPrintableString () noexcept(false)
 
std::string asString () noexcept(false)
 
void decode (const char *buffer, const int size) noexcept(false)
 

Detailed Description

Diameter Time container (NTP timestamp)

Constructor & Destructor Documentation

◆ ~Time()

virtual anna::diameter::codec::basetypes::Time::~Time ( )
inlinevirtual
45 {;}

Member Function Documentation

◆ asPrintableString()

std::string anna::diameter::codec::basetypes::Time::asPrintableString ( )
inlinevirtualnoexcept

Gets the natural/smart string representation for avp data (format-dependent content) Used in diameter message 'data' field Default implementation launch exception when data is not printable

Returns
Natural/smart string representation for avp data

Reimplemented from anna::diameter::codec::basetypes::AvpData.

97  {
98  return anna::functions::asString(a_ntpTimestamp);
99  }
static std::string asString(const int number)
Here is the call graph for this function:

◆ asString()

std::string anna::diameter::codec::basetypes::Time::asString ( void  )
virtualnoexcept

Class string representation Default implementation invokes raw DataBlock 'asString' method, but it should be different specially with complex application data types.

Returns
String with class content

Reimplemented from anna::diameter::codec::basetypes::AvpData.

◆ decode()

void anna::diameter::codec::basetypes::Time::decode ( const char *  buffer,
const int  size 
)
virtualnoexcept

Decodes provided buffer/size

Derived types must invoke base class 'decode()' at the end in order to keep coherence with parent members. This base class decodification actually sets the base class members with the same buffer provided, being more comfortable than using base class setters.

Parameters
bufferRaw avp data
sizeRaw avp data length

Reimplemented from anna::diameter::codec::basetypes::OctetString.

◆ getFormatName()

std::string anna::diameter::codec::basetypes::Time::getFormatName ( ) const
inlinevirtual

Gets the avp data format name

Returns
avp data format name

Reimplemented from anna::diameter::codec::basetypes::OctetString.

92 { return "Time"; }

◆ getTimestamp()

U32 anna::diameter::codec::basetypes::Time::getTimestamp ( Timestamp::_v  timestampType = Timestamp::NTP) const

Gets the timestamp value

Parameters
timestampTypeTimestamp reference (NTP/Unix)
Returns
timestamp value

◆ setTimestamp()

void anna::diameter::codec::basetypes::Time::setTimestamp ( const U32 timestamp,
Timestamp::_v  timestampType = Timestamp::NTP 
)

Sets the timestamp value

Parameters
timestamptimestamp value
timestampTypeTimestamp reference (NTP/Unix)

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