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