WPILibC++ 2024.3.2
NTSendableBuilder.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 <memory>
8#include <string_view>
9
10#include <wpi/FunctionExtras.h>
12
14#include "networktables/Topic.h"
15
16namespace nt {
17
18/**
19 * Helper class for building Sendable dashboard representations for
20 * NetworkTables.
21 */
23 public:
24 /**
25 * Set the function that should be called to update the network table
26 * for things other than properties. Note this function is not passed
27 * the network table object; instead it should use the entry handles
28 * returned by GetEntry().
29 *
30 * @param func function
31 */
32 virtual void SetUpdateTable(wpi::unique_function<void()> func) = 0;
33
34 /**
35 * Add a property without getters or setters. This can be used to get
36 * entry handles for the function called by SetUpdateTable().
37 *
38 * @param key property name
39 * @return Network table topic
40 */
42
43 /**
44 * Get the network table.
45 * @return The network table
46 */
47 virtual std::shared_ptr<NetworkTable> GetTable() = 0;
48
49 /**
50 * Gets the kind of backend being used.
51 *
52 * @return Backend kind
53 */
54 BackendKind GetBackendKind() const override;
55};
56
57} // namespace nt
This file provides a collection of function (or more generally, callable) type erasure utilities supp...
Helper class for building Sendable dashboard representations for NetworkTables.
Definition: NTSendableBuilder.h:22
virtual std::shared_ptr< NetworkTable > GetTable()=0
Get the network table.
virtual Topic GetTopic(std::string_view key)=0
Add a property without getters or setters.
BackendKind GetBackendKind() const override
Gets the kind of backend being used.
virtual void SetUpdateTable(wpi::unique_function< void()> func)=0
Set the function that should be called to update the network table for things other than properties.
NetworkTables Topic.
Definition: Topic.h:28
Helper class for building Sendable dashboard representations.
Definition: SendableBuilder.h:21
BackendKind
The backend kinds used for the sendable builder.
Definition: SendableBuilder.h:26
unique_function is a type-erasing functor similar to std::function.
Definition: FunctionExtras.h:57
basic_string_view< char > string_view
Definition: core.h:501
NetworkTables (ntcore) namespace.
Definition: ntcore_cpp.h:36