WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
String Functions

Functions

bool wpi::nt::SetString (NT_Handle pubentry, std::string_view value, int64_t time=0)
 Publish a new value.
bool wpi::nt::SetDefaultString (NT_Handle pubentry, std::string_view defaultValue)
 Publish a default value.
std::string wpi::nt::GetString (NT_Handle subentry, std::string_view defaultValue)
 Get the last published value.
TimestampedString wpi::nt::GetAtomicString (NT_Handle subentry, std::string_view defaultValue)
 Get the last published value along with its timestamp.
std::vector< TimestampedStringwpi::nt::ReadQueueString (NT_Handle subentry)
 Get an array of all value changes since the last call to ReadQueue.
std::vector< std::string > wpi::nt::ReadQueueValuesString (NT_Handle subentry)
 Get an array of all value changes since the last call to ReadQueue.
std::string_view wpi::nt::GetString (NT_Handle subentry, wpi::util::SmallVectorImpl< char > &buf, std::string_view defaultValue)
TimestampedStringView wpi::nt::GetAtomicString (NT_Handle subentry, wpi::util::SmallVectorImpl< char > &buf, std::string_view defaultValue)

Detailed Description

Function Documentation

◆ GetAtomicString() [1/2]

TimestampedString wpi::nt::GetAtomicString ( NT_Handle subentry,
std::string_view 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

◆ GetAtomicString() [2/2]

TimestampedStringView wpi::nt::GetAtomicString ( NT_Handle subentry,
wpi::util::SmallVectorImpl< char > & buf,
std::string_view defaultValue )

◆ GetString() [1/2]

std::string wpi::nt::GetString ( NT_Handle subentry,
std::string_view 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

◆ GetString() [2/2]

std::string_view wpi::nt::GetString ( NT_Handle subentry,
wpi::util::SmallVectorImpl< char > & buf,
std::string_view defaultValue )

◆ ReadQueueString()

std::vector< TimestampedString > wpi::nt::ReadQueueString ( 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.

◆ ReadQueueValuesString()

std::vector< std::string > wpi::nt::ReadQueueValuesString ( 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.

◆ SetDefaultString()

bool wpi::nt::SetDefaultString ( NT_Handle pubentry,
std::string_view 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

◆ SetString()

bool wpi::nt::SetString ( NT_Handle pubentry,
std::string_view 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