YARP
Yet Another Robot Platform
yarp::os::NetworkClock Class Reference

#include <yarp/os/NetworkClock.h>

+ Inheritance diagram for yarp::os::NetworkClock:

Public Member Functions

 NetworkClock ()
 
virtual ~NetworkClock ()
 
bool open (const ConstString &clockSourcePortName, ConstString localPortName="")
 
virtual double now () override
 Return the current time in seconds, relative to an arbitrary starting point. More...
 
virtual void delay (double seconds) override
 Wait for a certain number of seconds. More...
 
virtual bool isValid () const override
 Check if time is valid (non-zero). More...
 
virtual bool read (ConnectionReader &reader) override
 Read this object from a network connection. More...
 
- Public Member Functions inherited from yarp::os::Clock
virtual ~Clock ()
 Destructor. More...
 

Private Attributes

ConstString clockName
 
void * pwaiters
 
Port port
 
Mutex listMutex
 
Mutex timeMutex
 
YARP_INT32 sec
 
YARP_INT32 nsec
 
double _time
 
bool closing
 
bool initted
 

Additional Inherited Members

- Private Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType ()
 

Detailed Description

Definition at line 24 of file NetworkClock.h.

Constructor & Destructor Documentation

◆ NetworkClock()

NetworkClock::NetworkClock ( )

Definition at line 25 of file NetworkClock.cpp.

◆ ~NetworkClock()

NetworkClock::~NetworkClock ( )
virtual

Definition at line 35 of file NetworkClock.cpp.

Member Function Documentation

◆ delay()

void NetworkClock::delay ( double  seconds)
overridevirtual

Wait for a certain number of seconds.

This may be fractional.

Parameters
secondsthe duration of the delay, in seconds

Implements yarp::os::Clock.

Definition at line 117 of file NetworkClock.cpp.

◆ isValid()

bool NetworkClock::isValid ( ) const
overridevirtual

Check if time is valid (non-zero).

For example, for a network clock, if no timestamp has yet been received, this method will return false.

Implements yarp::os::Clock.

Definition at line 142 of file NetworkClock.cpp.

◆ now()

double NetworkClock::now ( )
overridevirtual

Return the current time in seconds, relative to an arbitrary starting point.

Returns
the time in seconds

Implements yarp::os::Clock.

Definition at line 110 of file NetworkClock.cpp.

◆ open()

bool NetworkClock::open ( const ConstString clockSourcePortName,
ConstString  localPortName = "" 
)

Definition at line 65 of file NetworkClock.cpp.

◆ read()

bool NetworkClock::read ( ConnectionReader reader)
overridevirtual

Read this object from a network connection.

Override this for your particular class.

Parameters
readeran interface to the network connection for reading
Returns
true iff the object is successfully read

Implements yarp::os::PortReader.

Definition at line 146 of file NetworkClock.cpp.

Member Data Documentation

◆ _time

double yarp::os::NetworkClock::_time
private

Definition at line 47 of file NetworkClock.h.

◆ clockName

ConstString yarp::os::NetworkClock::clockName
private

Definition at line 38 of file NetworkClock.h.

◆ closing

bool yarp::os::NetworkClock::closing
private

Definition at line 48 of file NetworkClock.h.

◆ initted

bool yarp::os::NetworkClock::initted
private

Definition at line 49 of file NetworkClock.h.

◆ listMutex

Mutex yarp::os::NetworkClock::listMutex
private

Definition at line 42 of file NetworkClock.h.

◆ nsec

YARP_INT32 yarp::os::NetworkClock::nsec
private

Definition at line 46 of file NetworkClock.h.

◆ port

Port yarp::os::NetworkClock::port
private

Definition at line 40 of file NetworkClock.h.

◆ pwaiters

void* yarp::os::NetworkClock::pwaiters
private

Definition at line 39 of file NetworkClock.h.

◆ sec

YARP_INT32 yarp::os::NetworkClock::sec
private

Definition at line 45 of file NetworkClock.h.

◆ timeMutex

Mutex yarp::os::NetworkClock::timeMutex
private

Definition at line 43 of file NetworkClock.h.


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