C++ TargetRTS
|
Represents a timer port. More...
#include <RTTiming.h>
Public Types | |
enum | { rti_timeout = rtiLast_RTProtocol + 1 } |
Public Member Functions | |
RTInSignal | timeout (void) |
Return the object that represents the timeout event which is received by this port when the timer has expired. | |
RTTimespec | currentTime (void) const |
Return the current time. | |
RTTimerNode * | informAt (const RTTimespec &when, const void *data, const RTObject_class *type, int prio=General) |
Start a timer which will expire at a particular absolute point in time. | |
RTTimerNode * | informAt (const RTTimespec &when, int prio=General) |
Start a timer which will expire at a particular absolute point in time. | |
RTTimerNode * | informAt (const RTTimespec &when, const RTDataObject &data, int prio=General) |
Start a timer which will expire at a particular absolute point in time. | |
RTTimerNode * | informAt (const RTTimespec &when, const RTTypedValue &info, int prio=General) |
Start a timer which will expire at a particular absolute point in time. | |
RTTimerNode * | informIn (const RTTimespec &delta, const void *data, const RTObject_class *type, int prio=General) |
Start a timer which will expire after a specified time interval. | |
RTTimerNode * | informIn (const RTTimespec &delta, int prio=General) |
Start a timer which will expire after a specified time interval. | |
RTTimerNode * | informIn (const RTTimespec &delta, const RTDataObject &data, int prio=General) |
Start a timer which will expire after a specified time interval. | |
RTTimerNode * | informIn (const RTTimespec &delta, const RTTypedValue &info, int prio=General) |
Start a timer which will expire after a specified time interval. | |
RTTimerNode * | informIn (unsigned long centiseconds, int prio=General) |
RTTimerNode * | informIn (unsigned long centiseconds, const RTDataObject &data, int prio=General) |
RTTimerNode * | informIn (unsigned long centiseconds, const RTTypedValue &info, int prio=General) |
RTTimerNode * | informEvery (const RTTimespec &delta, const void *data, const RTObject_class *type, int prio=General) |
Start a periodic timer which will expire at regular intervals. | |
RTTimerNode * | informEvery (const RTTimespec &delta, const RTDataObject &data, int prio=General) |
Start a periodic timer which will expire at regular intervals. | |
RTTimerNode * | informEvery (const RTTimespec &delta, const RTTypedValue &info, int prio=General) |
Start a periodic timer which will expire at regular intervals. | |
RTTimerNode * | informEvery (const RTTimespec &delta) |
Start a periodic timer which will expire at regular intervals. | |
int | timeouts (const RTTimerId &id) |
Get the number of timeout intervals that passed before the timeout of a periodic timer was actually processed. | |
int | cancelTimer (RTTimerId &id) |
Cancel a timer. | |
void | adjustTimeBegin (void) |
Begin adjustment of system time. | |
void | adjustTimeEnd (const RTTimespec &delta) |
End adjustment of system time. | |
RTTimerNode * | informAt (const std::chrono::system_clock::time_point &when, const void *data, const RTObject_class *type, int prio=General) |
RTTimerNode * | informAt (const std::chrono::system_clock::time_point &when, int prio=General) |
RTTimerNode * | informAt (const std::chrono::system_clock::time_point &when, const RTDataObject &data, int prio=General) |
RTTimerNode * | informAt (const std::chrono::system_clock::time_point &when, const RTTypedValue &info, int prio=General) |
RTTimerNode * | informIn (const std::chrono::nanoseconds &delta_ns, const void *data, const RTObject_class *type, int prio=General) |
RTTimerNode * | informIn (const std::chrono::nanoseconds &delta_ns, int prio=General) |
RTTimerNode * | informIn (const std::chrono::nanoseconds &delta_ns, const RTDataObject &data, int prio=General) |
RTTimerNode * | informIn (const std::chrono::nanoseconds &delta_ns, const RTTypedValue &info, int prio=General) |
RTTimerNode * | informEvery (const std::chrono::nanoseconds &delta_ns, const void *data, const RTObject_class *type, int prio=General) |
RTTimerNode * | informEvery (const std::chrono::nanoseconds &delta_ns, const RTDataObject &data, int prio=General) |
RTTimerNode * | informEvery (const std::chrono::nanoseconds &delta_ns, const RTTypedValue &info, int prio=General) |
RTTimerNode * | informEvery (const std::chrono::nanoseconds &delta_ns) |
Public Member Functions inherited from RTProtocol | |
RTController * | context (void) const |
Get the context of the capsule that owns this port. | |
int | getId (void) const |
Get the id of the port. | |
const RTPortDescriptor * | getInfo (void) const |
Get information about a port. | |
const char * | getName (void) const |
Get the name of the port. | |
RTActor * | getOwner (void) const |
Get the owner capsule to which the port belongs. | |
int | size (void) const |
Get the size of the port. | |
int | resize (int new_size) |
Set a new size (i.e. | |
int | registerSAP (const char *service) |
Register an unwired port (SAP) with the layer service (as a "client"). | |
int | deregisterSAP (void) |
Deregister an unwired port (SAP). | |
int | registerSPP (const char *service) |
Register an unwired port (SPP) with the layer service (as the "provider"). | |
int | deregisterSPP (void) |
Deregister an unwired port (SPP). | |
const char * | defaultLayerName (void) const |
Get the default registration name for the port. | |
int | isRegistered (void) const |
Determine if the port is currently registered with the layer service or not. | |
const char * | getRegisteredName (void) const |
Get the registration name of the port. | |
int | registerAs (const char *service) |
Register an unwired port either as an SAP or SPP (depending on the "Publish" property of the port). | |
int | deregister (void) |
Deregister an unwired port (either an SAP or SPP). | |
int | isBoundAt (int index) const |
Determine if a port instance is currently connected to another port instance. | |
int | isIndexTo (int index, RTActor *capsule) const |
Determine if a port instance is currently connected to a port instance owned by a certain capsule instance. | |
int | indexTo (RTActor *capsule) const |
Determine if there exists a port instance currently connected to a port instance owned by a certain capsule instance. | |
int | purge (void) |
Empty the defer queue of all port instances without recalling any deferred message. | |
int | purgeAt (int index) |
Empty the defer queue of a specified port instance without recalling any deferred message. | |
int | recall (void) |
Recall a message from the defer queue and insert it at the back of the controller's message queue (after other queued messages). | |
int | recallFront (void) |
Recall a message from the defer queue and insert it at the front of the controller's message queue (before other queued messages). | |
int | recallAt (int index, int front=0) |
Recall a message from the defer queue and insert it in the controller's message queue. | |
int | recallAll (void) |
Recall all messages from the defer queue and insert them at the back of the controller's message queue (after other queued messages). | |
int | recallAllFront (void) |
Recall all messages from the defer queue and insert them at the front of the controller's message queue (before other queued messages). | |
int | recallAllAt (int index, int front=0) |
Recall all messages from the defer queue and insert them in the controller's message queue. | |
void | bindingNotification (int on_off) |
Turn on or off binding notifications for this port. | |
int | bindingNotificationRequested (void) const |
Determine if binding notifications are currently enabled for the port. | |
void | sendTypeCheckEnable (int on_off) |
Turn on or off type checking when performing send(), invoke() or reply() on the port. | |
int | sendTypeCheckEnabled (void) const |
Determine if type checking when sending events is enabled. | |
RTProtocolDescriptor::Status | sendCheck (int signal, const RTObject_class *type) const |
Check if a particular event would be possible to send on this port. | |
void | receiveTypeCheckEnable (int on_off) |
Turn on or off type checking when receiving an event on the port. | |
int | receiveTypeCheckEnabled (void) const |
Determine if type checking when receiving events is enabled. | |
RTProtocolDescriptor::Status | receiveCheck (int signal, const RTObject_class *type) const |
Check if a particular event would be possible to receive on this port. | |
int | invoke (RTMessage *replyBuffer, int signal, const void *data, const RTObject_class *type, bool implicitReply) |
Invoke an event on the port. | |
int | invokeAt (int index, RTMessage *replyBuffer, int signal, const void *data, const RTObject_class *type, bool implicitReply) |
Invoke an event on a replicated port at a specified index. | |
int | reply (int signal, const void *data, const RTObject_class *type) |
Make a reply to respond to an invoke. | |
int | send (int signal, const void *data, const RTObject_class *type, int priority, bool moveData=false) |
Send an event on the port. | |
int | sendAt (int index, int signal, const void *data, const RTObject_class *type, int priority, bool moveData=false) |
Send an event on a replicated port at a specified index. | |
Static Public Attributes | |
static const RTProtocolDescriptor | rt_class |
Protected Types | |
enum | { rtiLast_Timing = rti_timeout } |
Protected Types inherited from RTProtocol | |
enum | { BindingNotification = 1 , RegisteredAsSAP = 2 , SendTypeCheck = 4 , ReceiveTypeCheck = 8 , Resized = 16 } |
enum | { rtiLast_RTProtocol = 0 } |
Protected Member Functions | |
RTTimerNode * | informIn (const RTTimespec &when, const RTTimespec &repeatInterval, const void *data, const RTObject_class *type, int prio) |
Protected Member Functions inherited from RTProtocol | |
void | init (const RTPortDescriptor *) |
int | getFlags (void) const |
void | setFlag (int) |
void | resetFlag (int) |
void | bindAt (int, RTBindingEnd &, RTController *) |
int | peerAt (int, RTBindingEnd &) |
void | unbindAt (int, RTController *) |
void | notifyInit (RTController *) |
void | notifyBoundAt (int, RTController *) |
Friends | |
class | RTTimerActor |
class | RTTimerNode |
Represents a timer port.
void Timing::Base::adjustTimeBegin | ( | void | ) |
Begin adjustment of system time.
If ever the real-time clock needs to be adjusted it has to be done between calls to adjustTimeBegin() and adjustTimeEnd() so that the run-time system can be aware of it and make any necessary adjustments to its internal data structures so that relative timeouts (requested via informIn() or informEvery() calls) are not delayed nor advanced.
void Timing::Base::adjustTimeEnd | ( | const RTTimespec & | delta | ) |
End adjustment of system time.
If ever the real-time clock needs to be adjusted it has to be done between calls to adjustTimeBegin() and adjustTimeEnd() so that the run-time system can be aware of it and make any necessary adjustments to its internal data structures so that relative timeouts (requested via informIn() or informEvery() calls) are not delayed nor advanced.
[in] | delta | Specifies how the real-time clock was changed |
int Timing::Base::cancelTimer | ( | RTTimerId & | id | ) |
Cancel a timer.
The function ensures that the timeout event of the specified timer will not be delivered to this timer port. This is true even if the timer already have expired at the time when this function is called, but the timeout event is waiting to be dispatched.
[in] | id | Timer identifier for the timer to be cancelled. |
RTTimespec Timing::Base::currentTime | ( | void | ) | const |
Return the current time.
It is recommended, for performance reasons, to instead use RTTimespec::getclock().
RTTimerNode * Timing::Base::informAt | ( | const RTTimespec & | when, |
const RTDataObject & | data, | ||
int | prio = General |
||
) |
Start a timer which will expire at a particular absolute point in time.
[in] | when | The desired absolute time when the timer is to expire. |
[in] | data | Data object to put in the timeout event. The data is copied by the TargetRTS using the copy function of the type descriptor for the data object. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informAt | ( | const RTTimespec & | when, |
const RTTypedValue & | info, | ||
int | prio = General |
||
) |
Start a timer which will expire at a particular absolute point in time.
[in] | when | The desired absolute time when the timer is to expire. |
[in] | info | An RTTypedValue object which encapsules the data object to put in the timeout event and its type descriptor. The data is copied by the TargetRTS using the copy function of the type descriptor. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informAt | ( | const RTTimespec & | when, |
const void * | data, | ||
const RTObject_class * | type, | ||
int | prio = General |
||
) |
Start a timer which will expire at a particular absolute point in time.
[in] | when | The desired absolute time when the timer is to expire. |
[in] | data | Data object to put in the timeout event. The data is copied by the TargetRTS using the copy function of the type descriptor. |
[in] | type | Type descriptor for the data object. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informAt | ( | const RTTimespec & | when, |
int | prio = General |
||
) |
Start a timer which will expire at a particular absolute point in time.
[in] | when | The desired absolute time when the timer is to expire. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informEvery | ( | const RTTimespec & | delta | ) |
Start a periodic timer which will expire at regular intervals.
[in] | delta | The desired time interval specifying how frequently the timer should expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
RTTimerNode * Timing::Base::informEvery | ( | const RTTimespec & | delta, |
const RTDataObject & | data, | ||
int | prio = General |
||
) |
Start a periodic timer which will expire at regular intervals.
[in] | delta | The desired time interval specifying how frequently the timer should expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | data | Data object to put in the timeout event. The data is copied by the TargetRTS using the copy function of the type descriptor for the data object. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informEvery | ( | const RTTimespec & | delta, |
const RTTypedValue & | info, | ||
int | prio = General |
||
) |
Start a periodic timer which will expire at regular intervals.
[in] | delta | The desired time interval specifying how frequently the timer should expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | info | An RTTypedValue object which encapsules the data object to put in the timeout event and its type descriptor. The data is copied by the TargetRTS using the copy function of the type descriptor. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informEvery | ( | const RTTimespec & | delta, |
const void * | data, | ||
const RTObject_class * | type, | ||
int | prio = General |
||
) |
Start a periodic timer which will expire at regular intervals.
[in] | delta | The desired time interval specifying how frequently the timer should expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | data | Data object to put in the timeout event. The data is copied by the TargetRTS using the copy function of the type descriptor. |
[in] | type | Type descriptor for the data object. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informIn | ( | const RTTimespec & | delta, |
const RTDataObject & | data, | ||
int | prio = General |
||
) |
Start a timer which will expire after a specified time interval.
[in] | delta | The desired time interval (expressed as a time relative from now) when the timer is to expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | data | Data object to put in the timeout event. The data is copied by the TargetRTS using the copy function of the type descriptor for the data object. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informIn | ( | const RTTimespec & | delta, |
const RTTypedValue & | info, | ||
int | prio = General |
||
) |
Start a timer which will expire after a specified time interval.
[in] | delta | The desired time interval (expressed as a time relative from now) when the timer is to expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | info | An RTTypedValue object which encapsules the data object to put in the timeout event and its type descriptor. The data is copied by the TargetRTS using the copy function of the type descriptor. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informIn | ( | const RTTimespec & | delta, |
const void * | data, | ||
const RTObject_class * | type, | ||
int | prio = General |
||
) |
Start a timer which will expire after a specified time interval.
[in] | delta | The desired time interval (expressed as a time relative from now) when the timer is to expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | data | Data object to put in the timeout event. The data is copied by the TargetRTS using the copy function of the type descriptor. |
[in] | type | Type descriptor for the data object. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
RTTimerNode * Timing::Base::informIn | ( | const RTTimespec & | delta, |
int | prio = General |
||
) |
Start a timer which will expire after a specified time interval.
[in] | delta | The desired time interval (expressed as a time relative from now) when the timer is to expire. If the interval is less than or equal to the current time or equal to zero, the timer will expire immediately. |
[in] | prio | The priority at which the timeout event should be sent. A message priority is interpreted as its relative importance with respect to all other unprocessed messages on a thread. The priority evaluates to one of the defined global priority values. |
int Timing::Base::timeouts | ( | const RTTimerId & | id | ) |
Get the number of timeout intervals that passed before the timeout of a periodic timer was actually processed.
Calling this function is a way to measure the accuracy of a periodic timer. The precision of a periodic timer depends on the underlying operating system. If you set a periodic timer with a timeout interval that is small, you may miss certain timeouts simply because the underlying operating system cannot process the timeouts fast enough. This function returns how many timeout intervals that have been missed since the last time a periodic timer expired. NOTE: Setting a timeout frequency higher than the granularity of the operating system means that the memory usage will grow since timeout messages then are produced at a higher pace than what they are consumed. If this goes on for long enough the application will run out of memory.
[in] | id | Timer identifier for a periodic timer to measure the accuracy of. |