gPTP Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClockIdentity Class Reference

#include <ieee1588.hpp>

Collaboration diagram for ClockIdentity:
Collaboration graph

Public Member Functions

 ClockIdentity ()
 
 ClockIdentity (uint8_t *id)
 Constructs the object and sets its ID. More...
 
bool operator== (const ClockIdentity &cmp) const
 Implements the operator '==' overloading method. More...
 
bool operator!= (const ClockIdentity &cmp) const
 Implements the operator '!=' overloading method. More...
 
bool operator< (const ClockIdentity &cmp) const
 Implements the operator '<' overloading method. More...
 
bool operator> (const ClockIdentity &cmp) const
 Implements the operator '>' overloading method. More...
 
std::string getIdentityString ()
 Gets the identity string from the ClockIdentity object. More...
 
void getIdentityString (uint8_t *id)
 Gets the identity string from the ClockIdentity object. More...
 
void set (uint8_t *id)
 Set the clock id to the object. More...
 
void set (LinkLayerAddress *address)
 Set clock id based on the link layer address. Clock id is 8 octets long whereas link layer address is 6 octets long and it is turned into a clock identity as per the 802.1AS standard described in clause 8.5.2.2. More...
 
void print (const char *str)
 This method is only enabled at compiling time. When enabled, it prints on the stderr output the clock identity information. More...
 

Detailed Description

Provides a ClockIdentity abstraction See IEEE 802.1AS-2011 Clause 8.5.2.2

Constructor & Destructor Documentation

ClockIdentity::ClockIdentity ( )
inline

Default constructor. Sets ID to zero

ClockIdentity::ClockIdentity ( uint8_t *  id)
inline

Constructs the object and sets its ID.

Parameters
id[in] clock id as an octet array

Member Function Documentation

std::string ClockIdentity::getIdentityString ( )

Gets the identity string from the ClockIdentity object.

Returns
String containing the clock identity
void ClockIdentity::getIdentityString ( uint8_t *  id)
inline

Gets the identity string from the ClockIdentity object.

Parameters
id[out] Value copied from the object ClockIdentity. Needs to be at least PTP_CLOCK_IDENTITY_LENGTH long.
Returns
void
bool ClockIdentity::operator!= ( const ClockIdentity cmp) const
inline

Implements the operator '!=' overloading method.

Parameters
cmpReference to the ClockIdentity comparing value
Returns
TRUE if cmp differs from the object's clock identity. FALSE otherwise.
bool ClockIdentity::operator< ( const ClockIdentity cmp) const
inline

Implements the operator '<' overloading method.

Parameters
cmpReference to the ClockIdentity comparing value
Returns
TRUE if cmp value is lower than the object's clock identity value. FALSE otherwise.
bool ClockIdentity::operator== ( const ClockIdentity cmp) const
inline

Implements the operator '==' overloading method.

Parameters
cmpReference to the ClockIdentity comparing value
Returns
TRUE if cmp equals to the object's clock identity. FALSE otherwise
bool ClockIdentity::operator> ( const ClockIdentity cmp) const
inline

Implements the operator '>' overloading method.

Parameters
cmpReference to the ClockIdentity comparing value
Returns
TRUE if cmp value is greater than the object's clock identity value. FALSE otherwise
void ClockIdentity::print ( const char *  str)
inline

This method is only enabled at compiling time. When enabled, it prints on the stderr output the clock identity information.

Parameters
str[in] String to be print out before the clock identity value
Returns
void
void ClockIdentity::set ( uint8_t *  id)
inline

Set the clock id to the object.

Parameters
id[in] Value to be set
Returns
void
void ClockIdentity::set ( LinkLayerAddress address)

Set clock id based on the link layer address. Clock id is 8 octets long whereas link layer address is 6 octets long and it is turned into a clock identity as per the 802.1AS standard described in clause 8.5.2.2.

Parameters
addressLink layer address
Returns
void

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