WPILibC++ 2023.4.3-108-ge5452e3
Utility Functions

Functions

void NT_DisposeValue (struct NT_Value *value)
 Frees value memory. More...
 
void NT_InitValue (struct NT_Value *value)
 Initializes a NT_Value. More...
 
void NT_DisposeString (struct NT_String *str)
 Frees string memory. More...
 
void NT_InitString (struct NT_String *str)
 Initializes a NT_String. More...
 
void NT_DisposeValueArray (struct NT_Value *arr, size_t count)
 Frees an array of NT_Values. More...
 
void NT_DisposeConnectionInfoArray (struct NT_ConnectionInfo *arr, size_t count)
 Disposes a connection info array. More...
 
void NT_DisposeTopicInfoArray (struct NT_TopicInfo *arr, size_t count)
 Disposes a topic info array. More...
 
void NT_DisposeTopicInfo (struct NT_TopicInfo *info)
 Disposes a single topic info (as returned by NT_GetTopicInfo). More...
 
void NT_DisposeEventArray (struct NT_Event *arr, size_t count)
 Disposes an event array. More...
 
void NT_DisposeEvent (struct NT_Event *event)
 Disposes a single event. More...
 
int64_t NT_Now (void)
 Returns monotonic current time in 1 us increments. More...
 
void NT_SetNow (int64_t timestamp)
 Sets the current timestamp used for timestamping values that do not provide a timestamp (e.g. More...
 

Detailed Description

Function Documentation

◆ NT_DisposeConnectionInfoArray()

void NT_DisposeConnectionInfoArray ( struct NT_ConnectionInfo arr,
size_t  count 
)

Disposes a connection info array.

Parameters
arrpointer to the array to dispose
countnumber of elements in the array

◆ NT_DisposeEvent()

void NT_DisposeEvent ( struct NT_Event event)

Disposes a single event.

Parameters
eventpointer to the event to dispose

◆ NT_DisposeEventArray()

void NT_DisposeEventArray ( struct NT_Event arr,
size_t  count 
)

Disposes an event array.

Parameters
arrpointer to the array to dispose
countnumber of elements in the array

◆ NT_DisposeString()

void NT_DisposeString ( struct NT_String str)

Frees string memory.

Parameters
strstring to free

◆ NT_DisposeTopicInfo()

void NT_DisposeTopicInfo ( struct NT_TopicInfo info)

Disposes a single topic info (as returned by NT_GetTopicInfo).

Parameters
infopointer to the info to dispose

◆ NT_DisposeTopicInfoArray()

void NT_DisposeTopicInfoArray ( struct NT_TopicInfo arr,
size_t  count 
)

Disposes a topic info array.

Parameters
arrpointer to the array to dispose
countnumber of elements in the array

◆ NT_DisposeValue()

void NT_DisposeValue ( struct NT_Value value)

Frees value memory.

Parameters
valuevalue to free

◆ NT_DisposeValueArray()

void NT_DisposeValueArray ( struct NT_Value arr,
size_t  count 
)

Frees an array of NT_Values.

Parameters
arrpointer to the value array to free
countnumber of elements in the array

Note that the individual NT_Values in the array should NOT be freed before calling this. This function will free all the values individually.

◆ NT_InitString()

void NT_InitString ( struct NT_String str)

Initializes a NT_String.

Sets length to zero and pointer to null.

Parameters
strstring to initialize

◆ NT_InitValue()

void NT_InitValue ( struct NT_Value value)

Initializes a NT_Value.

Sets type to NT_UNASSIGNED and clears rest of struct.

Parameters
valuevalue to initialize

◆ NT_Now()

int64_t NT_Now ( void  )

Returns monotonic current time in 1 us increments.

This is the same time base used for entry and connection timestamps. This function by default simply wraps WPI_Now(), but if NT_SetNow() is called, this function instead returns the value passed to NT_SetNow(); this can be used to reduce overhead.

Returns
Timestamp

◆ NT_SetNow()

void NT_SetNow ( int64_t  timestamp)

Sets the current timestamp used for timestamping values that do not provide a timestamp (e.g.

a value of 0 is passed). For consistency, it also results in NT_Now() returning the set value. This should generally be used only if the overhead of calling WPI_Now() is a concern. If used, it should be called periodically with the value of WPI_Now().

Parameters
timestamptimestamp (1 us increments)