WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
NetworkTableEntry.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#include <span>
10#include <string>
11#include <string_view>
12#include <vector>
13
16#include "ntcore_cpp.h"
17
18namespace nt {
19
20class NetworkTableInstance;
21class Topic;
22
23/**
24 * NetworkTables Entry
25 *
26 * @note For backwards compatibility, the NetworkTableEntry destructor does not
27 * release the entry.
28 *
29 * @ingroup ntcore_cpp_api
30 */
31class NetworkTableEntry final {
32 public:
33 /**
34 * Construct invalid instance.
35 */
36 NetworkTableEntry() = default;
37
38 /**
39 * Construct from native handle.
40 *
41 * @param handle Native handle
42 */
43 explicit NetworkTableEntry(NT_Entry handle) : m_handle{handle} {}
44
45 /**
46 * Determines if the native handle is valid.
47 *
48 * @return True if the native handle is valid, false otherwise.
49 */
50 explicit operator bool() const { return m_handle != 0; }
51
52 /**
53 * Gets the native handle for the entry.
54 *
55 * @return Native handle
56 */
57 NT_Entry GetHandle() const { return m_handle; }
58
59 /**
60 * Gets the instance for the entry.
61 *
62 * @return Instance
63 */
65
66 /**
67 * Determines if the entry currently exists.
68 *
69 * @return True if the entry exists, false otherwise.
70 */
71 bool Exists() const { return GetEntryType(m_handle) != NT_UNASSIGNED; }
72
73 /**
74 * Gets the name of the entry (the key).
75 *
76 * @return the entry's name
77 */
78 std::string GetName() const { return GetEntryName(m_handle); }
79
80 /**
81 * Gets the type of the entry.
82 *
83 * @return the entry's type
84 */
86 return static_cast<NetworkTableType>(GetEntryType(m_handle));
87 }
88
89 /**
90 * Gets the last time the entry's value was changed.
91 *
92 * @return Entry last change time
93 */
94 int64_t GetLastChange() const { return GetEntryLastChange(m_handle); }
95
96 /**
97 * Gets the entry's value. If the entry does not exist, returns an empty
98 * value.
99 *
100 * @return the entry's value or an empty value if it does not exist.
101 */
103
104 /**
105 * Gets the entry's value as a boolean. If the entry does not exist or is of
106 * different type, it will return the default value.
107 *
108 * @param defaultValue the value to be returned if no value is found
109 * @return the entry's value or the given default value
110 */
111 bool GetBoolean(bool defaultValue) const {
112 return nt::GetBoolean(m_handle, defaultValue);
113 }
114
115 /**
116 * Gets the entry's value as a integer. If the entry does not exist or is of
117 * different type, it will return the default value.
118 *
119 * @param defaultValue the value to be returned if no value is found
120 * @return the entry's value or the given default value
121 */
122 int64_t GetInteger(int64_t defaultValue) const {
123 return nt::GetInteger(m_handle, defaultValue);
124 }
125
126 /**
127 * Gets the entry's value as a float. If the entry does not exist or is of
128 * different type, it will return the default value.
129 *
130 * @param defaultValue the value to be returned if no value is found
131 * @return the entry's value or the given default value
132 */
133 float GetFloat(float defaultValue) const {
134 return nt::GetFloat(m_handle, defaultValue);
135 }
136
137 /**
138 * Gets the entry's value as a double. If the entry does not exist or is of
139 * different type, it will return the default value.
140 *
141 * @param defaultValue the value to be returned if no value is found
142 * @return the entry's value or the given default value
143 */
144 double GetDouble(double defaultValue) const {
145 return nt::GetDouble(m_handle, defaultValue);
146 }
147
148 /**
149 * Gets the entry's value as a string. If the entry does not exist or is of
150 * different type, it will return the default value.
151 *
152 * @param defaultValue the value to be returned if no value is found
153 * @return the entry's value or the given default value
154 */
155 std::string GetString(std::string_view defaultValue) const {
156 return nt::GetString(m_handle, defaultValue);
157 }
158
159 /**
160 * Gets the entry's value as a raw. If the entry does not exist or is of
161 * different type, it will return the default value.
162 *
163 * @param defaultValue the value to be returned if no value is found
164 * @return the entry's value or the given default value
165 */
166 std::vector<uint8_t> GetRaw(std::span<const uint8_t> defaultValue) const {
167 return nt::GetRaw(m_handle, defaultValue);
168 }
169
170 /**
171 * Gets the entry's value as a boolean array. If the entry does not exist
172 * or is of different type, it will return the default value.
173 *
174 * @param defaultValue the value to be returned if no value is found
175 * @return the entry's value or the given default value
176 *
177 * @note This makes a copy of the array. If the overhead of this is a
178 * concern, use GetValue() instead.
179 *
180 * @note The returned array is std::vector<int> instead of std::vector<bool>
181 * because std::vector<bool> is special-cased in C++. 0 is false, any
182 * non-zero value is true.
183 */
184 std::vector<int> GetBooleanArray(std::span<const int> defaultValue) const {
185 return nt::GetBooleanArray(m_handle, defaultValue);
186 }
187
188 /**
189 * Gets the entry's value as a integer array. If the entry does not exist
190 * or is of different type, it will return the default value.
191 *
192 * @param defaultValue the value to be returned if no value is found
193 * @return the entry's value or the given default value
194 *
195 * @note This makes a copy of the array. If the overhead of this is a
196 * concern, use GetValue() instead.
197 */
198 std::vector<int64_t> GetIntegerArray(
199 std::span<const int64_t> defaultValue) const {
200 return nt::GetIntegerArray(m_handle, defaultValue);
201 }
202
203 /**
204 * Gets the entry's value as a float array. If the entry does not exist
205 * or is of different type, it will return the default value.
206 *
207 * @param defaultValue the value to be returned if no value is found
208 * @return the entry's value or the given default value
209 *
210 * @note This makes a copy of the array. If the overhead of this is a
211 * concern, use GetValue() instead.
212 */
213 std::vector<float> GetFloatArray(std::span<const float> defaultValue) const {
214 return nt::GetFloatArray(m_handle, defaultValue);
215 }
216
217 /**
218 * Gets the entry's value as a double array. If the entry does not exist
219 * or is of different type, it will return the default value.
220 *
221 * @param defaultValue the value to be returned if no value is found
222 * @return the entry's value or the given default value
223 *
224 * @note This makes a copy of the array. If the overhead of this is a
225 * concern, use GetValue() instead.
226 */
227 std::vector<double> GetDoubleArray(
228 std::span<const double> defaultValue) const {
229 return nt::GetDoubleArray(m_handle, defaultValue);
230 }
231
232 /**
233 * Gets the entry's value as a string array. If the entry does not exist
234 * or is of different type, it will return the default value.
235 *
236 * @param defaultValue the value to be returned if no value is found
237 * @return the entry's value or the given default value
238 *
239 * @note This makes a copy of the array. If the overhead of this is a
240 * concern, use GetValue() instead.
241 */
242 std::vector<std::string> GetStringArray(
243 std::span<const std::string> defaultValue) const {
244 return nt::GetStringArray(m_handle, defaultValue);
245 }
246
247 /**
248 * Get an array of all value changes since the last call to ReadQueue.
249 *
250 * The "poll storage" subscribe option can be used to set the queue depth.
251 *
252 * @return Array of values; empty array if no new changes have been
253 * published since the previous call.
254 */
255 std::vector<NetworkTableValue> ReadQueue() {
257 }
258
259 /**
260 * Sets the entry's value if it does not exist.
261 *
262 * @param defaultValue the default value to set
263 * @return True if the entry did not already have a value, otherwise False
264 */
265 bool SetDefaultValue(const Value& defaultValue) {
266 return SetDefaultEntryValue(m_handle, defaultValue);
267 }
268
269 /**
270 * Sets the entry's value if it does not exist.
271 *
272 * @param defaultValue the default value to set
273 * @return True if the entry did not already have a value, otherwise False
274 */
275 bool SetDefaultBoolean(bool defaultValue) {
276 return nt::SetDefaultBoolean(m_handle, defaultValue);
277 }
278
279 /**
280 * Sets the entry's value if it does not exist.
281 *
282 * @param defaultValue the default value to set
283 * @return True if the entry did not already have a value, otherwise False
284 */
285 bool SetDefaultInteger(int64_t defaultValue) {
286 return nt::SetDefaultInteger(m_handle, defaultValue);
287 }
288
289 /**
290 * Sets the entry's value if it does not exist.
291 *
292 * @param defaultValue the default value to set
293 * @return True if the entry did not already have a value, otherwise False
294 */
295 bool SetDefaultFloat(float defaultValue) {
296 return nt::SetDefaultFloat(m_handle, defaultValue);
297 }
298
299 /**
300 * Sets the entry's value if it does not exist.
301 *
302 * @param defaultValue the default value to set
303 * @return True if the entry did not already have a value, otherwise False
304 */
305 bool SetDefaultDouble(double defaultValue) {
306 return nt::SetDefaultDouble(m_handle, defaultValue);
307 }
308
309 /**
310 * Sets the entry's value if it does not exist.
311 *
312 * @param defaultValue the default value to set
313 * @return True if the entry did not already have a value, otherwise False
314 */
315 bool SetDefaultString(std::string_view defaultValue) {
316 return nt::SetDefaultString(m_handle, defaultValue);
317 }
318
319 /**
320 * Sets the entry's value if it does not exist.
321 *
322 * @param defaultValue the default value to set
323 * @return True if the entry did not already have a value, otherwise False
324 */
325 bool SetDefaultRaw(std::span<const uint8_t> defaultValue) {
326 return nt::SetDefaultRaw(m_handle, defaultValue);
327 }
328
329 /**
330 * Sets the entry's value if it does not exist.
331 *
332 * @param defaultValue the default value to set
333 * @return True if the entry did not already have a value, otherwise False
334 */
335 bool SetDefaultBooleanArray(std::span<const int> defaultValue) {
336 return nt::SetDefaultBooleanArray(m_handle, defaultValue);
337 }
338
339 /**
340 * Sets the entry's value if it does not exist.
341 *
342 * @param defaultValue the default value to set
343 * @return True if the entry did not already have a value, otherwise False
344 */
345 bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue) {
346 return nt::SetDefaultIntegerArray(m_handle, defaultValue);
347 }
348
349 /**
350 * Sets the entry's value if it does not exist.
351 *
352 * @param defaultValue the default value to set
353 * @return True if the entry did not already have a value, otherwise False
354 */
355 bool SetDefaultFloatArray(std::span<const float> defaultValue) {
356 return nt::SetDefaultFloatArray(m_handle, defaultValue);
357 }
358
359 /**
360 * Sets the entry's value if it does not exist.
361 *
362 * @param defaultValue the default value to set
363 * @return True if the entry did not already have a value, otherwise False
364 */
365 bool SetDefaultDoubleArray(std::span<const double> defaultValue) {
366 return nt::SetDefaultDoubleArray(m_handle, defaultValue);
367 }
368
369 /**
370 * Sets the entry's value if it does not exist.
371 *
372 * @param defaultValue the default value to set
373 * @return True if the entry did not already have a value, otherwise False
374 */
375 bool SetDefaultStringArray(std::span<const std::string> defaultValue) {
376 return nt::SetDefaultStringArray(m_handle, defaultValue);
377 }
378
379 /**
380 * Sets the entry's value.
381 *
382 * @param value the value to set
383 * @return False if the entry exists with a different type
384 */
385 bool SetValue(const Value& value) { return SetEntryValue(m_handle, value); }
386
387 /**
388 * Sets the entry's value.
389 *
390 * @param value the value to set
391 * @param time the timestamp to set (0 = nt::Now())
392 * @return False if the entry exists with a different type
393 */
394 bool SetBoolean(bool value, int64_t time = 0) {
395 return nt::SetBoolean(m_handle, value, time);
396 }
397
398 /**
399 * Sets the entry's value.
400 *
401 * @param value the value to set
402 * @param time the timestamp to set (0 = nt::Now())
403 * @return False if the entry exists with a different type
404 */
405 bool SetInteger(int64_t value, int64_t time = 0) {
406 return nt::SetInteger(m_handle, value, time);
407 }
408
409 /**
410 * Sets the entry's value.
411 *
412 * @param value the value to set
413 * @param time the timestamp to set (0 = nt::Now())
414 * @return False if the entry exists with a different type
415 */
416 bool SetFloat(float value, int64_t time = 0) {
417 return nt::SetFloat(m_handle, value, time);
418 }
419
420 /**
421 * Sets the entry's value.
422 *
423 * @param value the value to set
424 * @param time the timestamp to set (0 = nt::Now())
425 * @return False if the entry exists with a different type
426 */
427 bool SetDouble(double value, int64_t time = 0) {
428 return nt::SetDouble(m_handle, value, time);
429 }
430
431 /**
432 * Sets the entry's value.
433 *
434 * @param value the value to set
435 * @param time the timestamp to set (0 = nt::Now())
436 * @return False if the entry exists with a different type
437 */
438 bool SetString(std::string_view value, int64_t time = 0) {
439 return nt::SetString(m_handle, value, time);
440 }
441
442 /**
443 * Sets the entry's value.
444 *
445 * @param value the value to set
446 * @param time the timestamp to set (0 = nt::Now())
447 * @return False if the entry exists with a different type
448 */
449 bool SetRaw(std::span<const uint8_t> value, int64_t time = 0) {
450 return nt::SetRaw(m_handle, value, time);
451 }
452
453 /**
454 * Sets the entry's value.
455 *
456 * @param value the value to set
457 * @param time the timestamp to set (0 = nt::Now())
458 * @return False if the entry exists with a different type
459 */
460 bool SetBooleanArray(std::span<const bool> value, int64_t time = 0) {
461 return SetEntryValue(m_handle, Value::MakeBooleanArray(value, time));
462 }
463
464 /**
465 * Sets the entry's value.
466 *
467 * @param value the value to set
468 * @param time the timestamp to set (0 = nt::Now())
469 * @return False if the entry exists with a different type
470 */
471 bool SetBooleanArray(std::span<const int> value, int64_t time = 0) {
472 return nt::SetBooleanArray(m_handle, value, time);
473 }
474
475 /**
476 * Sets the entry's value.
477 *
478 * @param value the value to set
479 * @param time the timestamp to set (0 = nt::Now())
480 * @return False if the entry exists with a different type
481 */
482 bool SetIntegerArray(std::span<const int64_t> value, int64_t time = 0) {
483 return nt::SetIntegerArray(m_handle, value, time);
484 }
485
486 /**
487 * Sets the entry's value.
488 *
489 * @param value the value to set
490 * @param time the timestamp to set (0 = nt::Now())
491 * @return False if the entry exists with a different type
492 */
493 bool SetFloatArray(std::span<const float> value, int64_t time = 0) {
494 return nt::SetFloatArray(m_handle, value, time);
495 }
496
497 /**
498 * Sets the entry's value.
499 *
500 * @param value the value to set
501 * @param time the timestamp to set (0 = nt::Now())
502 * @return False if the entry exists with a different type
503 */
504 bool SetDoubleArray(std::span<const double> value, int64_t time = 0) {
505 return nt::SetDoubleArray(m_handle, value, time);
506 }
507
508 /**
509 * Sets the entry's value.
510 *
511 * @param value the value to set
512 * @param time the timestamp to set (0 = nt::Now())
513 * @return False if the entry exists with a different type
514 */
515 bool SetStringArray(std::span<const std::string> value, int64_t time = 0) {
516 return nt::SetStringArray(m_handle, value, time);
517 }
518
519 /**
520 * Make value persistent through program restarts.
521 */
525
526 /**
527 * Stop making value persistent through program restarts.
528 */
532
533 /**
534 * Returns whether the value is persistent through program restarts.
535 *
536 * @return True if the value is persistent.
537 */
541
542 /**
543 * Stops publishing the entry if it's been published.
544 */
545 void Unpublish() { return nt::Unpublish(m_handle); }
546
547 /**
548 * Gets the entry's topic.
549 *
550 * @return Topic
551 */
553
554 /**
555 * Equality operator. Returns true if both instances refer to the same
556 * native handle.
557 */
558 bool operator==(const NetworkTableEntry&) const = default;
559
560 protected:
561 /* Native handle */
563};
564
565} // namespace nt
NetworkTables Entry.
Definition NetworkTableEntry.h:31
NetworkTableType GetType() const
Gets the type of the entry.
Definition NetworkTableEntry.h:85
bool SetBooleanArray(std::span< const int > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:471
std::vector< int > GetBooleanArray(std::span< const int > defaultValue) const
Gets the entry's value as a boolean array.
Definition NetworkTableEntry.h:184
std::string GetName() const
Gets the name of the entry (the key).
Definition NetworkTableEntry.h:78
bool SetDouble(double value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:427
void Unpublish()
Stops publishing the entry if it's been published.
Definition NetworkTableEntry.h:545
NetworkTableEntry(NT_Entry handle)
Construct from native handle.
Definition NetworkTableEntry.h:43
std::vector< float > GetFloatArray(std::span< const float > defaultValue) const
Gets the entry's value as a float array.
Definition NetworkTableEntry.h:213
void ClearPersistent()
Stop making value persistent through program restarts.
Definition NetworkTableEntry.h:529
std::vector< std::string > GetStringArray(std::span< const std::string > defaultValue) const
Gets the entry's value as a string array.
Definition NetworkTableEntry.h:242
void SetPersistent()
Make value persistent through program restarts.
Definition NetworkTableEntry.h:522
bool SetString(std::string_view value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:438
float GetFloat(float defaultValue) const
Gets the entry's value as a float.
Definition NetworkTableEntry.h:133
bool SetDefaultValue(const Value &defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:265
Topic GetTopic() const
Gets the entry's topic.
bool SetDefaultFloat(float defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:295
bool SetBoolean(bool value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:394
int64_t GetLastChange() const
Gets the last time the entry's value was changed.
Definition NetworkTableEntry.h:94
bool SetDefaultFloatArray(std::span< const float > defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:355
std::vector< double > GetDoubleArray(std::span< const double > defaultValue) const
Gets the entry's value as a double array.
Definition NetworkTableEntry.h:227
bool SetDefaultRaw(std::span< const uint8_t > defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:325
bool IsPersistent() const
Returns whether the value is persistent through program restarts.
Definition NetworkTableEntry.h:538
bool SetValue(const Value &value)
Sets the entry's value.
Definition NetworkTableEntry.h:385
bool SetDoubleArray(std::span< const double > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:504
double GetDouble(double defaultValue) const
Gets the entry's value as a double.
Definition NetworkTableEntry.h:144
std::vector< uint8_t > GetRaw(std::span< const uint8_t > defaultValue) const
Gets the entry's value as a raw.
Definition NetworkTableEntry.h:166
NetworkTableEntry()=default
Construct invalid instance.
bool SetDefaultString(std::string_view defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:315
bool SetFloatArray(std::span< const float > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:493
bool SetInteger(int64_t value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:405
bool SetFloat(float value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:416
int64_t GetInteger(int64_t defaultValue) const
Gets the entry's value as a integer.
Definition NetworkTableEntry.h:122
bool Exists() const
Determines if the entry currently exists.
Definition NetworkTableEntry.h:71
bool SetDefaultDouble(double defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:305
bool SetDefaultDoubleArray(std::span< const double > defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:365
Value GetValue() const
Gets the entry's value.
Definition NetworkTableEntry.h:102
NetworkTableInstance GetInstance() const
Gets the instance for the entry.
bool SetDefaultBooleanArray(std::span< const int > defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:335
std::vector< NetworkTableValue > ReadQueue()
Get an array of all value changes since the last call to ReadQueue.
Definition NetworkTableEntry.h:255
bool operator==(const NetworkTableEntry &) const =default
Equality operator.
NT_Entry m_handle
Definition NetworkTableEntry.h:562
bool SetRaw(std::span< const uint8_t > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:449
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition NetworkTableEntry.h:57
bool GetBoolean(bool defaultValue) const
Gets the entry's value as a boolean.
Definition NetworkTableEntry.h:111
std::vector< int64_t > GetIntegerArray(std::span< const int64_t > defaultValue) const
Gets the entry's value as a integer array.
Definition NetworkTableEntry.h:198
bool SetDefaultBoolean(bool defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:275
bool SetBooleanArray(std::span< const bool > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:460
bool SetStringArray(std::span< const std::string > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:515
bool SetDefaultStringArray(std::span< const std::string > defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:375
std::string GetString(std::string_view defaultValue) const
Gets the entry's value as a string.
Definition NetworkTableEntry.h:155
bool SetDefaultIntegerArray(std::span< const int64_t > defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:345
bool SetDefaultInteger(int64_t defaultValue)
Sets the entry's value if it does not exist.
Definition NetworkTableEntry.h:285
bool SetIntegerArray(std::span< const int64_t > value, int64_t time=0)
Sets the entry's value.
Definition NetworkTableEntry.h:482
NetworkTables Instance.
Definition NetworkTableInstance.h:68
NetworkTables Topic.
Definition Topic.h:28
A network table entry value.
Definition NetworkTableValue.h:35
static Value MakeBooleanArray(std::span< const bool > value, int64_t time=0)
Creates a boolean array entry value.
bool SetBoolean(NT_Handle pubentry, bool value, int64_t time=0)
Publish a new value.
bool SetDefaultBoolean(NT_Handle pubentry, bool defaultValue)
Publish a default value.
bool GetBoolean(NT_Handle subentry, bool defaultValue)
Get the last published value.
bool SetBooleanArray(NT_Handle pubentry, std::span< const int > value, int64_t time=0)
Publish a new value.
bool SetDefaultBooleanArray(NT_Handle pubentry, std::span< const int > defaultValue)
Publish a default value.
std::vector< int > GetBooleanArray(NT_Handle subentry, std::span< const int > defaultValue)
Get the last published value.
bool SetDefaultDouble(NT_Handle pubentry, double defaultValue)
Publish a default value.
double GetDouble(NT_Handle subentry, double defaultValue)
Get the last published value.
bool SetDouble(NT_Handle pubentry, double value, int64_t time=0)
Publish a new value.
bool SetDoubleArray(NT_Handle pubentry, std::span< const double > value, int64_t time=0)
Publish a new value.
bool SetDefaultDoubleArray(NT_Handle pubentry, std::span< const double > defaultValue)
Publish a default value.
std::vector< double > GetDoubleArray(NT_Handle subentry, std::span< const double > defaultValue)
Get the last published value.
bool SetDefaultFloat(NT_Handle pubentry, float defaultValue)
Publish a default value.
float GetFloat(NT_Handle subentry, float defaultValue)
Get the last published value.
bool SetFloat(NT_Handle pubentry, float value, int64_t time=0)
Publish a new value.
std::vector< float > GetFloatArray(NT_Handle subentry, std::span< const float > defaultValue)
Get the last published value.
bool SetDefaultFloatArray(NT_Handle pubentry, std::span< const float > defaultValue)
Publish a default value.
bool SetFloatArray(NT_Handle pubentry, std::span< const float > value, int64_t time=0)
Publish a new value.
int64_t GetInteger(NT_Handle subentry, int64_t defaultValue)
Get the last published value.
bool SetDefaultInteger(NT_Handle pubentry, int64_t defaultValue)
Publish a default value.
bool SetInteger(NT_Handle pubentry, int64_t value, int64_t time=0)
Publish a new value.
bool SetIntegerArray(NT_Handle pubentry, std::span< const int64_t > value, int64_t time=0)
Publish a new value.
std::vector< int64_t > GetIntegerArray(NT_Handle subentry, std::span< const int64_t > defaultValue)
Get the last published value.
bool SetDefaultIntegerArray(NT_Handle pubentry, std::span< const int64_t > defaultValue)
Publish a default value.
bool SetDefaultRaw(NT_Handle pubentry, std::span< const uint8_t > defaultValue)
Publish a default value.
std::vector< uint8_t > GetRaw(NT_Handle subentry, std::span< const uint8_t > defaultValue)
Get the last published value.
bool SetRaw(NT_Handle pubentry, std::span< const uint8_t > value, int64_t time=0)
Publish a new value.
std::string GetString(NT_Handle subentry, std::string_view defaultValue)
Get the last published value.
bool SetDefaultString(NT_Handle pubentry, std::string_view defaultValue)
Publish a default value.
bool SetString(NT_Handle pubentry, std::string_view value, int64_t time=0)
Publish a new value.
bool SetDefaultStringArray(NT_Handle pubentry, std::span< const std::string > defaultValue)
Publish a default value.
bool SetStringArray(NT_Handle pubentry, std::span< const std::string > value, int64_t time=0)
Publish a new value.
std::vector< std::string > GetStringArray(NT_Handle subentry, std::span< const std::string > defaultValue)
Get the last published value.
NT_Handle NT_Entry
Definition ntcore_c.h:37
@ NT_UNASSIGNED
Definition ntcore_c.h:54
NetworkTableType
NetworkTable entry type.
Definition NetworkTableType.h:15
NT_Type GetEntryType(NT_Entry entry)
Gets the type for the specified entry, or unassigned if non existent.
Value GetEntryValue(NT_Handle subentry)
Get Entry Value.
int64_t GetEntryLastChange(NT_Handle subentry)
Gets the last time the entry was changed.
std::vector< Value > ReadQueueValue(NT_Handle subentry)
Read Entry Queue.
std::string GetEntryName(NT_Entry entry)
Gets the name of the specified entry.
bool SetEntryValue(NT_Entry entry, const Value &value)
Set Entry Value.
bool SetDefaultEntryValue(NT_Entry entry, const Value &value)
Set Default Entry Value.
NT_Topic GetTopicFromHandle(NT_Handle pubsubentry)
Gets the topic handle from an entry/subscriber/publisher handle.
void SetTopicPersistent(NT_Topic topic, bool value)
Sets the persistent property of a topic.
void Unpublish(NT_Handle pubentry)
Stops publisher.
bool GetTopicPersistent(NT_Topic topic)
Gets the persistent property of a topic.
NetworkTables (ntcore) namespace.
Definition ntcore_cpp.h:36