WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
GenericEntry.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
14#include "networktables/Topic.h"
15#include "ntcore_cpp.h"
16
17namespace nt {
18
19class Value;
20
21/**
22 * NetworkTables generic subscriber.
23 */
25 public:
28 using ParamType = const Value&;
30
31 GenericSubscriber() = default;
32
33 /**
34 * Construct from a subscriber handle; recommended to use
35 * Topic::GenericSubscribe() instead.
36 *
37 * @param handle Native handle
38 */
39 explicit GenericSubscriber(NT_Subscriber handle) : Subscriber{handle} {}
40
41 /**
42 * Get the last published value.
43 * If no value has been published, returns a value with unassigned type.
44 *
45 * @return value
46 */
47 ValueType Get() const { return ::nt::GetEntryValue(m_subHandle); }
48
49 /**
50 * Gets the entry's value as a boolean. If the entry does not exist or is of
51 * different type, it will return the default value.
52 *
53 * @param defaultValue the value to be returned if no value is found
54 * @return the entry's value or the given default value
55 */
56 bool GetBoolean(bool defaultValue) const {
57 return ::nt::GetBoolean(m_subHandle, defaultValue);
58 }
59
60 /**
61 * Gets the entry's value as a integer. If the entry does not exist or is of
62 * different type, it will return the default value.
63 *
64 * @param defaultValue the value to be returned if no value is found
65 * @return the entry's value or the given default value
66 */
67 int64_t GetInteger(int64_t defaultValue) const {
68 return ::nt::GetInteger(m_subHandle, defaultValue);
69 }
70
71 /**
72 * Gets the entry's value as a float. If the entry does not exist or is of
73 * different type, it will return the default value.
74 *
75 * @param defaultValue the value to be returned if no value is found
76 * @return the entry's value or the given default value
77 */
78 float GetFloat(float defaultValue) const {
79 return ::nt::GetFloat(m_subHandle, defaultValue);
80 }
81
82 /**
83 * Gets the entry's value as a double. If the entry does not exist or is of
84 * different type, it will return the default value.
85 *
86 * @param defaultValue the value to be returned if no value is found
87 * @return the entry's value or the given default value
88 */
89 double GetDouble(double defaultValue) const {
90 return ::nt::GetDouble(m_subHandle, defaultValue);
91 }
92
93 /**
94 * Gets the entry's value as a string. If the entry does not exist or is of
95 * different type, it will return the default value.
96 *
97 * @param defaultValue the value to be returned if no value is found
98 * @return the entry's value or the given default value
99 */
100 std::string GetString(std::string_view defaultValue) const {
101 return ::nt::GetString(m_subHandle, defaultValue);
102 }
103
104 /**
105 * Gets the entry's value as a raw. 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 std::vector<uint8_t> GetRaw(std::span<const uint8_t> defaultValue) const {
112 return ::nt::GetRaw(m_subHandle, defaultValue);
113 }
114
115 /**
116 * Gets the entry's value as a boolean array. If the entry does not exist
117 * or is of 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 * @note This makes a copy of the array. If the overhead of this is a
123 * concern, use GetValue() instead.
124 *
125 * @note The returned array is std::vector<int> instead of std::vector<bool>
126 * because std::vector<bool> is special-cased in C++. 0 is false, any
127 * non-zero value is true.
128 */
129 std::vector<int> GetBooleanArray(std::span<const int> defaultValue) const {
130 return ::nt::GetBooleanArray(m_subHandle, defaultValue);
131 }
132
133 /**
134 * Gets the entry's value as a integer array. If the entry does not exist
135 * or is of different type, it will return the default value.
136 *
137 * @param defaultValue the value to be returned if no value is found
138 * @return the entry's value or the given default value
139 *
140 * @note This makes a copy of the array. If the overhead of this is a
141 * concern, use GetValue() instead.
142 */
143 std::vector<int64_t> GetIntegerArray(
144 std::span<const int64_t> defaultValue) const {
145 return ::nt::GetIntegerArray(m_subHandle, defaultValue);
146 }
147
148 /**
149 * Gets the entry's value as a float array. If the entry does not exist
150 * or is of 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 * @note This makes a copy of the array. If the overhead of this is a
156 * concern, use GetValue() instead.
157 */
158 std::vector<float> GetFloatArray(std::span<const float> defaultValue) const {
159 return ::nt::GetFloatArray(m_subHandle, defaultValue);
160 }
161
162 /**
163 * Gets the entry's value as a double array. If the entry does not exist
164 * or is of different type, it will return the default value.
165 *
166 * @param defaultValue the value to be returned if no value is found
167 * @return the entry's value or the given default value
168 *
169 * @note This makes a copy of the array. If the overhead of this is a
170 * concern, use GetValue() instead.
171 */
172 std::vector<double> GetDoubleArray(
173 std::span<const double> defaultValue) const {
174 return ::nt::GetDoubleArray(m_subHandle, defaultValue);
175 }
176
177 /**
178 * Gets the entry's value as a string array. If the entry does not exist
179 * or is of different type, it will return the default value.
180 *
181 * @param defaultValue the value to be returned if no value is found
182 * @return the entry's value or the given default value
183 *
184 * @note This makes a copy of the array. If the overhead of this is a
185 * concern, use GetValue() instead.
186 */
187 std::vector<std::string> GetStringArray(
188 std::span<const std::string> defaultValue) const {
189 return ::nt::GetStringArray(m_subHandle, defaultValue);
190 }
191
192 /**
193 * Get an array of all value changes since the last call to ReadQueue.
194 * Also provides a timestamp for each value.
195 *
196 * @note The "poll storage" subscribe option can be used to set the queue
197 * depth.
198 *
199 * @return Array of timestamped values; empty array if no new changes have
200 * been published since the previous call.
201 */
202 std::vector<TimestampedValueType> ReadQueue() {
203 return ::nt::ReadQueueValue(m_subHandle);
204 }
205
206 /**
207 * Get the corresponding topic.
208 *
209 * @return Topic
210 */
214};
215
216/**
217 * NetworkTables generic publisher.
218 */
220 public:
223 using ParamType = const Value&;
225
226 GenericPublisher() = default;
227
228 /**
229 * Construct from a publisher handle; recommended to use
230 * Topic::GenericPublish() instead.
231 *
232 * @param handle Native handle
233 */
234 explicit GenericPublisher(NT_Publisher handle) : Publisher{handle} {}
235
236 /**
237 * Publish a new value.
238 *
239 * @param value value to publish
240 */
242
243 /**
244 * Sets the entry's value.
245 *
246 * @param value the value to set
247 * @param time the timestamp to set (0 = nt::Now())
248 * @return False if the entry exists with a different type
249 */
250 bool SetBoolean(bool value, int64_t time = 0) {
251 return nt::SetBoolean(m_pubHandle, value, time);
252 }
253
254 /**
255 * Sets the entry's value.
256 *
257 * @param value the value to set
258 * @param time the timestamp to set (0 = nt::Now())
259 * @return False if the entry exists with a different type
260 */
261 bool SetInteger(int64_t value, int64_t time = 0) {
262 return nt::SetInteger(m_pubHandle, value, time);
263 }
264
265 /**
266 * Sets the entry's value.
267 *
268 * @param value the value to set
269 * @param time the timestamp to set (0 = nt::Now())
270 * @return False if the entry exists with a different type
271 */
272 bool SetFloat(float value, int64_t time = 0) {
273 return nt::SetFloat(m_pubHandle, value, time);
274 }
275
276 /**
277 * Sets the entry's value.
278 *
279 * @param value the value to set
280 * @param time the timestamp to set (0 = nt::Now())
281 * @return False if the entry exists with a different type
282 */
283 bool SetDouble(double value, int64_t time = 0) {
284 return nt::SetDouble(m_pubHandle, value, time);
285 }
286
287 /**
288 * Sets the entry's value.
289 *
290 * @param value the value to set
291 * @param time the timestamp to set (0 = nt::Now())
292 * @return False if the entry exists with a different type
293 */
294 bool SetString(std::string_view value, int64_t time = 0) {
295 return nt::SetString(m_pubHandle, value, time);
296 }
297
298 /**
299 * Sets the entry's value.
300 *
301 * @param value the value to set
302 * @param time the timestamp to set (0 = nt::Now())
303 * @return False if the entry exists with a different type
304 */
305 bool SetRaw(std::span<const uint8_t> value, int64_t time = 0) {
306 return nt::SetRaw(m_pubHandle, value, time);
307 }
308
309 /**
310 * Sets the entry's value.
311 *
312 * @param value the value to set
313 * @param time the timestamp to set (0 = nt::Now())
314 * @return False if the entry exists with a different type
315 */
316 bool SetBooleanArray(std::span<const bool> value, int64_t time = 0) {
318 }
319
320 /**
321 * Sets the entry's value.
322 *
323 * @param value the value to set
324 * @param time the timestamp to set (0 = nt::Now())
325 * @return False if the entry exists with a different type
326 */
327 bool SetBooleanArray(std::span<const int> value, int64_t time = 0) {
328 return nt::SetBooleanArray(m_pubHandle, value, time);
329 }
330
331 /**
332 * Sets the entry's value.
333 *
334 * @param value the value to set
335 * @param time the timestamp to set (0 = nt::Now())
336 * @return False if the entry exists with a different type
337 */
338 bool SetIntegerArray(std::span<const int64_t> value, int64_t time = 0) {
339 return nt::SetIntegerArray(m_pubHandle, value, time);
340 }
341
342 /**
343 * Sets the entry's value.
344 *
345 * @param value the value to set
346 * @param time the timestamp to set (0 = nt::Now())
347 * @return False if the entry exists with a different type
348 */
349 bool SetFloatArray(std::span<const float> value, int64_t time = 0) {
350 return nt::SetFloatArray(m_pubHandle, value, time);
351 }
352
353 /**
354 * Sets the entry's value.
355 *
356 * @param value the value to set
357 * @param time the timestamp to set (0 = nt::Now())
358 * @return False if the entry exists with a different type
359 */
360 bool SetDoubleArray(std::span<const double> value, int64_t time = 0) {
361 return nt::SetDoubleArray(m_pubHandle, value, time);
362 }
363
364 /**
365 * Sets the entry's value.
366 *
367 * @param value the value to set
368 * @param time the timestamp to set (0 = nt::Now())
369 * @return False if the entry exists with a different type
370 */
371 bool SetStringArray(std::span<const std::string> value, int64_t time = 0) {
372 return nt::SetStringArray(m_pubHandle, value, time);
373 }
374
375 /**
376 * Publish a default value.
377 * On reconnect, a default value will never be used in preference to a
378 * published value.
379 *
380 * @param value value
381 */
385
386 /**
387 * Sets the entry's value if it does not exist.
388 *
389 * @param defaultValue the default value to set
390 * @return True if the entry did not already have a value, otherwise False
391 */
392 bool SetDefaultBoolean(bool defaultValue) {
393 return nt::SetDefaultBoolean(m_pubHandle, defaultValue);
394 }
395
396 /**
397 * Sets the entry's value if it does not exist.
398 *
399 * @param defaultValue the default value to set
400 * @return True if the entry did not already have a value, otherwise False
401 */
402 bool SetDefaultInteger(int64_t defaultValue) {
403 return nt::SetDefaultInteger(m_pubHandle, defaultValue);
404 }
405
406 /**
407 * Sets the entry's value if it does not exist.
408 *
409 * @param defaultValue the default value to set
410 * @return True if the entry did not already have a value, otherwise False
411 */
412 bool SetDefaultFloat(float defaultValue) {
413 return nt::SetDefaultFloat(m_pubHandle, defaultValue);
414 }
415
416 /**
417 * Sets the entry's value if it does not exist.
418 *
419 * @param defaultValue the default value to set
420 * @return True if the entry did not already have a value, otherwise False
421 */
422 bool SetDefaultDouble(double defaultValue) {
423 return nt::SetDefaultDouble(m_pubHandle, defaultValue);
424 }
425
426 /**
427 * Sets the entry's value if it does not exist.
428 *
429 * @param defaultValue the default value to set
430 * @return True if the entry did not already have a value, otherwise False
431 */
432 bool SetDefaultString(std::string_view defaultValue) {
433 return nt::SetDefaultString(m_pubHandle, defaultValue);
434 }
435
436 /**
437 * Sets the entry's value if it does not exist.
438 *
439 * @param defaultValue the default value to set
440 * @return True if the entry did not already have a value, otherwise False
441 */
442 bool SetDefaultRaw(std::span<const uint8_t> defaultValue) {
443 return nt::SetDefaultRaw(m_pubHandle, defaultValue);
444 }
445
446 /**
447 * Sets the entry's value if it does not exist.
448 *
449 * @param defaultValue the default value to set
450 * @return True if the entry did not already have a value, otherwise False
451 */
452 bool SetDefaultBooleanArray(std::span<const int> defaultValue) {
453 return nt::SetDefaultBooleanArray(m_pubHandle, defaultValue);
454 }
455
456 /**
457 * Sets the entry's value if it does not exist.
458 *
459 * @param defaultValue the default value to set
460 * @return True if the entry did not already have a value, otherwise False
461 */
462 bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue) {
463 return nt::SetDefaultIntegerArray(m_pubHandle, defaultValue);
464 }
465
466 /**
467 * Sets the entry's value if it does not exist.
468 *
469 * @param defaultValue the default value to set
470 * @return True if the entry did not already have a value, otherwise False
471 */
472 bool SetDefaultFloatArray(std::span<const float> defaultValue) {
473 return nt::SetDefaultFloatArray(m_pubHandle, defaultValue);
474 }
475
476 /**
477 * Sets the entry's value if it does not exist.
478 *
479 * @param defaultValue the default value to set
480 * @return True if the entry did not already have a value, otherwise False
481 */
482 bool SetDefaultDoubleArray(std::span<const double> defaultValue) {
483 return nt::SetDefaultDoubleArray(m_pubHandle, defaultValue);
484 }
485
486 /**
487 * Sets the entry's value if it does not exist.
488 *
489 * @param defaultValue the default value to set
490 * @return True if the entry did not already have a value, otherwise False
491 */
492 bool SetDefaultStringArray(std::span<const std::string> defaultValue) {
493 return nt::SetDefaultStringArray(m_pubHandle, defaultValue);
494 }
495
496 /**
497 * Get the corresponding topic.
498 *
499 * @return Topic
500 */
504};
505
506/**
507 * NetworkTables generic entry.
508 *
509 * @note Unlike NetworkTableEntry, the entry goes away when this is destroyed.
510 */
511class GenericEntry final : public GenericSubscriber, public GenericPublisher {
512 public:
517 using ParamType = const Value&;
519
520 GenericEntry() = default;
521
522 /**
523 * Construct from an entry handle; recommended to use
524 * RawTopic::GetEntry() instead.
525 *
526 * @param handle Native handle
527 */
528 explicit GenericEntry(NT_Entry handle)
529 : GenericSubscriber{handle}, GenericPublisher{handle} {}
530
531 /**
532 * Determines if the native handle is valid.
533 *
534 * @return True if the native handle is valid, false otherwise.
535 */
536 explicit operator bool() const { return m_subHandle != 0; }
537
538 /**
539 * Gets the native handle for the entry.
540 *
541 * @return Native handle
542 */
543 NT_Entry GetHandle() const { return m_subHandle; }
544
545 /**
546 * Get the corresponding topic.
547 *
548 * @return Topic
549 */
553
554 /**
555 * Stops publishing the entry if it's published.
556 */
558};
559
560} // namespace nt
NetworkTables generic entry.
Definition GenericEntry.h:511
GenericEntry(NT_Entry handle)
Construct from an entry handle; recommended to use RawTopic::GetEntry() instead.
Definition GenericEntry.h:528
void Unpublish()
Stops publishing the entry if it's published.
Definition GenericEntry.h:557
NT_Entry GetHandle() const
Gets the native handle for the entry.
Definition GenericEntry.h:543
TopicType GetTopic() const
Get the corresponding topic.
Definition GenericEntry.h:550
GenericEntry()=default
NetworkTables generic publisher.
Definition GenericEntry.h:219
bool SetDefaultRaw(std::span< const uint8_t > defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:442
bool SetDefaultDoubleArray(std::span< const double > defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:482
bool SetDefaultString(std::string_view defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:432
bool SetString(std::string_view value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:294
bool SetDouble(double value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:283
bool SetDoubleArray(std::span< const double > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:360
bool SetDefaultDouble(double defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:422
GenericPublisher(NT_Publisher handle)
Construct from a publisher handle; recommended to use Topic::GenericPublish() instead.
Definition GenericEntry.h:234
bool SetStringArray(std::span< const std::string > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:371
bool SetBoolean(bool value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:250
bool SetBooleanArray(std::span< const int > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:327
void SetDefault(ParamType value)
Publish a default value.
Definition GenericEntry.h:382
bool SetDefaultFloatArray(std::span< const float > defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:472
bool SetInteger(int64_t value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:261
bool SetDefaultBooleanArray(std::span< const int > defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:452
bool SetDefaultFloat(float defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:412
bool SetFloat(float value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:272
void Set(ParamType value)
Publish a new value.
Definition GenericEntry.h:241
bool SetFloatArray(std::span< const float > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:349
bool SetDefaultInteger(int64_t defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:402
bool SetIntegerArray(std::span< const int64_t > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:338
bool SetDefaultBoolean(bool defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:392
bool SetBooleanArray(std::span< const bool > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:316
bool SetDefaultIntegerArray(std::span< const int64_t > defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:462
bool SetDefaultStringArray(std::span< const std::string > defaultValue)
Sets the entry's value if it does not exist.
Definition GenericEntry.h:492
GenericPublisher()=default
TopicType GetTopic() const
Get the corresponding topic.
Definition GenericEntry.h:501
bool SetRaw(std::span< const uint8_t > value, int64_t time=0)
Sets the entry's value.
Definition GenericEntry.h:305
NetworkTables generic subscriber.
Definition GenericEntry.h:24
double GetDouble(double defaultValue) const
Gets the entry's value as a double.
Definition GenericEntry.h:89
std::vector< int > GetBooleanArray(std::span< const int > defaultValue) const
Gets the entry's value as a boolean array.
Definition GenericEntry.h:129
ValueType Get() const
Get the last published value.
Definition GenericEntry.h:47
int64_t GetInteger(int64_t defaultValue) const
Gets the entry's value as a integer.
Definition GenericEntry.h:67
float GetFloat(float defaultValue) const
Gets the entry's value as a float.
Definition GenericEntry.h:78
std::vector< float > GetFloatArray(std::span< const float > defaultValue) const
Gets the entry's value as a float array.
Definition GenericEntry.h:158
std::vector< uint8_t > GetRaw(std::span< const uint8_t > defaultValue) const
Gets the entry's value as a raw.
Definition GenericEntry.h:111
GenericSubscriber()=default
std::vector< double > GetDoubleArray(std::span< const double > defaultValue) const
Gets the entry's value as a double array.
Definition GenericEntry.h:172
std::string GetString(std::string_view defaultValue) const
Gets the entry's value as a string.
Definition GenericEntry.h:100
GenericSubscriber(NT_Subscriber handle)
Construct from a subscriber handle; recommended to use Topic::GenericSubscribe() instead.
Definition GenericEntry.h:39
std::vector< TimestampedValueType > ReadQueue()
Get an array of all value changes since the last call to ReadQueue.
Definition GenericEntry.h:202
std::vector< std::string > GetStringArray(std::span< const std::string > defaultValue) const
Gets the entry's value as a string array.
Definition GenericEntry.h:187
std::vector< int64_t > GetIntegerArray(std::span< const int64_t > defaultValue) const
Gets the entry's value as a integer array.
Definition GenericEntry.h:143
TopicType GetTopic() const
Get the corresponding topic.
Definition GenericEntry.h:211
bool GetBoolean(bool defaultValue) const
Gets the entry's value as a boolean.
Definition GenericEntry.h:56
NetworkTables publisher.
Definition Topic.h:393
NT_Publisher m_pubHandle
NetworkTables handle.
Definition Topic.h:441
NetworkTables subscriber.
Definition Topic.h:321
NT_Subscriber m_subHandle
Definition Topic.h:386
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 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.
bool SetDefaultDouble(NT_Handle pubentry, double defaultValue)
Publish a default 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.
bool SetDefaultFloat(NT_Handle pubentry, float defaultValue)
Publish a default value.
bool SetFloat(NT_Handle pubentry, float value, int64_t time=0)
Publish a new 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.
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.
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.
bool SetRaw(NT_Handle pubentry, std::span< const uint8_t > value, int64_t time=0)
Publish a new 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.
NT_Handle NT_Subscriber
Definition ntcore_c.h:43
NT_Handle NT_Publisher
Definition ntcore_c.h:44
NT_Handle NT_Entry
Definition ntcore_c.h:37
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 Unpublish(NT_Handle pubentry)
Stops publisher.
NetworkTables (ntcore) namespace.
Definition ntcore_cpp.h:36