WPILibC++ 2024.1.1-beta-4
FloatArray Functions

Functions

bool nt::SetFloatArray (NT_Handle pubentry, std::span< const float > value, int64_t time=0)
 Publish a new value. More...
 
bool nt::SetDefaultFloatArray (NT_Handle pubentry, std::span< const float > defaultValue)
 Publish a default value. More...
 
std::vector< float > nt::GetFloatArray (NT_Handle subentry, std::span< const float > defaultValue)
 Get the last published value. More...
 
TimestampedFloatArray nt::GetAtomicFloatArray (NT_Handle subentry, std::span< const float > defaultValue)
 Get the last published value along with its timestamp. More...
 
std::vector< TimestampedFloatArraynt::ReadQueueFloatArray (NT_Handle subentry)
 Get an array of all value changes since the last call to ReadQueue. More...
 
std::vector< std::vector< float > > nt::ReadQueueValuesFloatArray (NT_Handle subentry)
 Get an array of all value changes since the last call to ReadQueue. More...
 
std::span< float > nt::GetFloatArray (NT_Handle subentry, wpi::SmallVectorImpl< float > &buf, std::span< const float > defaultValue)
 
TimestampedFloatArrayView nt::GetAtomicFloatArray (NT_Handle subentry, wpi::SmallVectorImpl< float > &buf, std::span< const float > defaultValue)
 

Detailed Description

Function Documentation

◆ GetAtomicFloatArray() [1/2]

TimestampedFloatArray nt::GetAtomicFloatArray ( NT_Handle  subentry,
std::span< const float >  defaultValue 
)

Get the last published value along with its timestamp.

If no value has been published, returns the passed defaultValue and a timestamp of 0.

Parameters
subentrysubscriber or entry handle
defaultValuedefault value to return if no value has been published
Returns
timestamped value

◆ GetAtomicFloatArray() [2/2]

TimestampedFloatArrayView nt::GetAtomicFloatArray ( NT_Handle  subentry,
wpi::SmallVectorImpl< float > &  buf,
std::span< const float >  defaultValue 
)

◆ GetFloatArray() [1/2]

std::vector< float > nt::GetFloatArray ( NT_Handle  subentry,
std::span< const float >  defaultValue 
)

Get the last published value.

If no value has been published, returns the passed defaultValue.

Parameters
subentrysubscriber or entry handle
defaultValuedefault value to return if no value has been published
Returns
value

◆ GetFloatArray() [2/2]

std::span< float > nt::GetFloatArray ( NT_Handle  subentry,
wpi::SmallVectorImpl< float > &  buf,
std::span< const float >  defaultValue 
)

◆ ReadQueueFloatArray()

std::vector< TimestampedFloatArray > nt::ReadQueueFloatArray ( NT_Handle  subentry)

Get an array of all value changes since the last call to ReadQueue.

Also provides a timestamp for each value.

Note
The "poll storage" subscribe option can be used to set the queue depth.
Parameters
subentrysubscriber or entry handle
Returns
Array of timestamped values; empty array if no new changes have been published since the previous call.

◆ ReadQueueValuesFloatArray()

std::vector< std::vector< float > > nt::ReadQueueValuesFloatArray ( NT_Handle  subentry)

Get an array of all value changes since the last call to ReadQueue.

Note
The "poll storage" subscribe option can be used to set the queue depth.
Parameters
subentrysubscriber or entry handle
Returns
Array of values; empty array if no new changes have been published since the previous call.

◆ SetDefaultFloatArray()

bool nt::SetDefaultFloatArray ( NT_Handle  pubentry,
std::span< const float >  defaultValue 
)

Publish a default value.

On reconnect, a default value will never be used in preference to a published value.

Parameters
pubentrypublisher or entry handle
defaultValuedefault value

◆ SetFloatArray()

bool nt::SetFloatArray ( NT_Handle  pubentry,
std::span< const float >  value,
int64_t  time = 0 
)

Publish a new value.

Parameters
pubentrypublisher or entry handle
valuevalue to publish
timetimestamp; 0 indicates current NT time should be used