WPILibC++ 2024.3.2
SimpleWidget.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>
9#include <string_view>
10
13
15
16namespace frc {
17
18class ShuffleboardContainer;
19
20/**
21 * A Shuffleboard widget that handles a single data point such as a number or
22 * string.
23 */
24class SimpleWidget final : public ShuffleboardWidget<SimpleWidget> {
25 public:
27
28 /**
29 * Gets the NetworkTable entry that contains the data for this widget.
30 * The widget owns the entry; the returned pointer's lifetime is the same as
31 * that of the widget.
32 */
34
35 /**
36 * Gets the NetworkTable entry that contains the data for this widget.
37 * The widget owns the entry; the returned pointer's lifetime is the same as
38 * that of the widget.
39 *
40 * @param typeString NT type string
41 */
43
44 void BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
45 std::shared_ptr<nt::NetworkTable> metaTable) override;
46
47 private:
48 nt::GenericEntry m_entry;
49 std::string m_typeString;
50
51 void ForceGenerate();
52};
53
54} // namespace frc
Common interface for objects that can contain shuffleboard components.
Definition: ShuffleboardContainer.h:42
Abstract superclass for widgets.
Definition: ShuffleboardWidget.h:29
A Shuffleboard widget that handles a single data point such as a number or string.
Definition: SimpleWidget.h:24
nt::GenericEntry * GetEntry(std::string_view typeString)
Gets the NetworkTable entry that contains the data for this widget.
SimpleWidget(ShuffleboardContainer &parent, std::string_view title)
nt::GenericEntry * GetEntry()
Gets the NetworkTable entry that contains the data for this widget.
void BuildInto(std::shared_ptr< nt::NetworkTable > parentTable, std::shared_ptr< nt::NetworkTable > metaTable) override
Builds the entries for this value.
NetworkTables generic entry.
Definition: GenericEntry.h:435
basic_string_view< char > string_view
Definition: core.h:501
Definition: AprilTagPoseEstimator.h:15