C/C++ latency framework API
The C/C++ interface for the latency framework is declared in the header file AP_TimestampSet.h. Plug-ins using the latency framework should include this file and also include the IAF_TimestampConfig.h header file, which declares the timestamp configuration object.
The functions of interest are the following.
addNow
/**
* Add a new index-time pair to the timestamp. The given index and current
* time will be copied into the timestamp. If an element with the same index
* already exists, it will NOT be overwritten.
*
* @param timestamp The AP_TimestampSet instance
* @param index The index of the new element
*/
void (*addNow)(struct AP_TimestampSet* timestamp,
AP_TimestampSetIndex index);
addTime
/**
* Add a new index-time pair to the timestamp. The given index and time will
* be copied into the timestamp. If an element with the same index already
* exists, it will NOT be overwritten.
*
* @param timestamp The AP_TeimestampSet instance
* @param index The index of the new element
* @param time The time of the new element
*/
void (*addTime)(struct AP_TimestampSet* timestamp,
AP_TimestampSetIndex index, AP_TimestampSetTime time);
replace
/**
* Change the time of an indexed element in the timestamp. If an
* element with the given index already exists, its time will be replaced
* with a copy of the given time. Otherwise, a new element is created
* just as though addTime() had been called.
*
* @param timestamp The AP_TimestampSet instance
* @param index The index of the element to be updated
* @param time The new time for the indexed element
*/
void (*replace)(struct AP_TimestampSet* timestamp,
AP_TimestampSetIndex index, AP_TimestampSetTime newTime);
replaceWithNow
/**
* Change the time of an indexed element in the timestamp. If an
* element with the given index already exists, its time will be replaced
* with a copy of the given time. Otherwise, a new element is created
* just as though addNow() had been called.
*
* @param timestamp The AP_TimestampSet instance
* @param index The index of the element to be updated
* @param time The new time for the indexed element
*/
void (*replaceWithNow)(struct AP_TimestampSet* timestamp,
AP_TimestampSetIndex index);
findTime
/**
* Search for an indexed element in the timestamp and return its
* time.
*
* @param timestamp The AP_TimestampSet instance
* @param index The element index to search for
* @return The time associated with the given index, or NULL if no
* matching element could be found.
*/
AP_TimestampSetTime (*findTime)(struct AP_TimestampSet* timestamp,
AP_TimestampSetIndex index);
findTimeAndRemove
/**
* Search for an indexed element in the timestamp and return its
* time. If found, the element will also be removed from the timestamp.
*
* @param timestamp The AP_TimestampSet instance
* @param index The element index to search for
* @return The time associated with the given index, or NULL if no
* matching element could be found. If the element was found, it will be
* deleted from the timestamp. Note that this function cannot distinguish
* between an element with a missing time and an element that does not
* exist - NULL will be returned in either case. The returned object
* (if any) must be explicitly deleted by the caller after use.
*/
AP_TimestampSetTime (*findTimeAndRemove)(
struct AP_TimestampSet* timestamp, AP_TimestampSetIndex index);
getSize
/**
* Return the number of elements in the AP_TimestampSet
*
* @param timestamp The AP_TimestampSet instance
* @return The number of elements in the timestamp set
*/
AP_uint32 (*getSize)(struct AP_TimestampSet* timestamp);
toString
w
/**
* Return a printable string representation of the timestamp. The
* returned string is owned by the caller and should be freed when it is
* no longer required using the char8free function.
*
* @param timestamp The AP_TimestampSet instance
* @return Printable string representation of the timestamp
*/
AP_char8* (*toString)(struct AP_TimestampSet* timestamp);