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