WPILibC++ 2023.4.3-108-ge5452e3
NetworkBooleanEvent.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 "BooleanEvent.h"
11
12namespace nt {
13class BooleanSubscriber;
14class BooleanTopic;
15class NetworkTable;
16class NetworkTableInstance;
17} // namespace nt
18
19namespace frc {
20/**
21 * A Button that uses a NetworkTable boolean field.
22 *
23 * This class is provided by the NewCommands VendorDep
24 */
26 public:
27 /**
28 * Creates a new event with the given boolean topic determining whether it is
29 * active.
30 *
31 * @param loop the loop that polls this event
32 * @param topic The boolean topic that contains the value
33 */
35
36 /**
37 * Creates a new event with the given boolean subscriber determining whether
38 * it is active.
39 *
40 * @param loop the loop that polls this event
41 * @param sub The boolean subscriber that provides the value
42 */
44
45 /**
46 * Creates a new event with the given boolean topic determining whether it is
47 * active.
48 *
49 * @param loop the loop that polls this event
50 * @param table The NetworkTable that contains the topic
51 * @param topicName The topic name within the table that contains the value
52 */
53 NetworkBooleanEvent(EventLoop* loop, std::shared_ptr<nt::NetworkTable> table,
54 std::string_view topicName);
55
56 /**
57 * Creates a new event with the given boolean topic determining whether it is
58 * active.
59 *
60 * @param loop the loop that polls this event
61 * @param tableName The NetworkTable name that contains the topic
62 * @param topicName The topic name within the table that contains the value
63 */
65 std::string_view topicName);
66
67 /**
68 * Creates a new event with the given boolean topic determining whether it is
69 * active.
70 *
71 * @param loop the loop that polls this event
72 * @param inst The NetworkTable instance to use
73 * @param tableName The NetworkTable that contains the topic
74 * @param topicName The topic name within the table that contains the value
75 */
77 std::string_view tableName, std::string_view topicName);
78};
79} // namespace frc
This class provides an easy way to link actions to inputs.
Definition: BooleanEvent.h:31
The loop polling BooleanEvent objects and executing the actions bound to them.
Definition: EventLoop.h:15
A Button that uses a NetworkTable boolean field.
Definition: NetworkBooleanEvent.h:25
NetworkBooleanEvent(EventLoop *loop, std::string_view tableName, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, nt::BooleanSubscriber sub)
Creates a new event with the given boolean subscriber determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, std::shared_ptr< nt::NetworkTable > table, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, nt::NetworkTableInstance inst, std::string_view tableName, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, nt::BooleanTopic topic)
Creates a new event with the given boolean topic determining whether it is active.
NetworkTables Boolean subscriber.
Definition: BooleanTopic.h:29
NetworkTables Boolean topic.
Definition: BooleanTopic.h:210
NetworkTables Instance.
Definition: NetworkTableInstance.h:59
basic_string_view< char > string_view
Definition: core.h:520
Definition: AprilTagPoseEstimator.h:15
NetworkTables (ntcore) namespace.
Definition: Topic.inc:15