WPILibC++ 2024.3.2
ShuffleboardValue.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
12
13namespace frc {
14
16 public:
17 explicit ShuffleboardValue(std::string_view title) : m_title(title) {}
18
19 virtual ~ShuffleboardValue() = default;
20
23
24 /**
25 * Gets the title of this Shuffleboard value.
26 */
27 const std::string& GetTitle() const { return m_title; }
28
29 /**
30 * Builds the entries for this value.
31 *
32 * @param parentTable The table containing all the data for the parent. Values
33 * that require a complex entry or table structure should
34 * call {@code parentTable.getSubtable(getTitle())} to get
35 * the table to put data into. Values that only use a
36 * single entry should call
37 * {@code parentTable.getEntry(getTitle())} to get that
38 * entry.
39 * @param metaTable The table containing all the metadata for this value and
40 * its sub-values
41 */
42 virtual void BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
43 std::shared_ptr<nt::NetworkTable> metaTable) = 0;
44
45 /**
46 * Enables user control of this widget in the Shuffleboard application.
47 *
48 * This method is package-private to prevent users from enabling control
49 * themselves. Has no effect if the sendable is not marked as an actuator with
50 * SendableBuilder::SetActuator().
51 */
52 virtual void EnableIfActuator() {}
53
54 /**
55 * Disables user control of this widget in the Shuffleboard application.
56 *
57 * This method is package-private to prevent users from enabling control
58 * themselves. Has no effect if the sendable is not marked as an actuator with
59 * SendableBuilder::SetActuator().
60 */
61 virtual void DisableIfActuator() {}
62
63 private:
64 std::string m_title;
65};
66
67} // namespace frc
Definition: ShuffleboardValue.h:15
ShuffleboardValue(const ShuffleboardValue &)=delete
ShuffleboardValue(std::string_view title)
Definition: ShuffleboardValue.h:17
const std::string & GetTitle() const
Gets the title of this Shuffleboard value.
Definition: ShuffleboardValue.h:27
virtual void BuildInto(std::shared_ptr< nt::NetworkTable > parentTable, std::shared_ptr< nt::NetworkTable > metaTable)=0
Builds the entries for this value.
virtual void EnableIfActuator()
Enables user control of this widget in the Shuffleboard application.
Definition: ShuffleboardValue.h:52
virtual ~ShuffleboardValue()=default
ShuffleboardValue & operator=(const ShuffleboardValue &)=delete
virtual void DisableIfActuator()
Disables user control of this widget in the Shuffleboard application.
Definition: ShuffleboardValue.h:61
basic_string_view< char > string_view
Definition: core.h:501
Definition: AprilTagPoseEstimator.h:15