WPILibC++ 2027.0.0-alpha-5
Loading...
Searching...
No Matches
NetworkBooleanEvent.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
12namespace wpi::nt {
14class BooleanTopic;
15class NetworkTable;
17} // namespace wpi::nt
18
19namespace wpi {
20/**
21 * A Button that uses a NetworkTable boolean field.
22 */
24 public:
25 /**
26 * Creates a new event with the given boolean topic determining whether it is
27 * active.
28 *
29 * @param loop the loop that polls this event
30 * @param topic The boolean topic that contains the value
31 */
33
34 /**
35 * Creates a new event with the given boolean subscriber determining whether
36 * it is active.
37 *
38 * @param loop the loop that polls this event
39 * @param sub The boolean subscriber that provides the value
40 */
42
43 /**
44 * Creates a new event with the given boolean topic determining whether it is
45 * active.
46 *
47 * @param loop the loop that polls this event
48 * @param table The NetworkTable that contains the topic
49 * @param topicName The topic name within the table that contains the value
50 */
52 std::shared_ptr<wpi::nt::NetworkTable> table,
53 std::string_view topicName);
54
55 /**
56 * Creates a new event with the given boolean topic determining whether it is
57 * active.
58 *
59 * @param loop the loop that polls this event
60 * @param tableName The NetworkTable name that contains the topic
61 * @param topicName The topic name within the table that contains the value
62 */
63 NetworkBooleanEvent(EventLoop* loop, std::string_view tableName,
64 std::string_view topicName);
65
66 /**
67 * Creates a new event with the given boolean topic determining whether it is
68 * active.
69 *
70 * @param loop the loop that polls this event
71 * @param inst The NetworkTable instance to use
72 * @param tableName The NetworkTable that contains the topic
73 * @param topicName The topic name within the table that contains the value
74 */
76 std::string_view tableName, std::string_view topicName);
77};
78} // namespace wpi
BooleanEvent(EventLoop *loop, std::function< bool()> signal)
Creates a new event that is active when the condition is true.
A declarative way to bind a set of actions to a loop and execute them when the loop is polled.
Definition EventLoop.hpp:15
NetworkBooleanEvent(EventLoop *loop, wpi::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, wpi::nt::BooleanSubscriber sub)
Creates a new event with the given boolean subscriber determining whether it is active.
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, wpi::nt::BooleanTopic topic)
Creates a new event with the given boolean topic determining whether it is active.
NetworkBooleanEvent(EventLoop *loop, std::shared_ptr< wpi::nt::NetworkTable > table, std::string_view topicName)
Creates a new event with the given boolean topic determining whether it is active.
NetworkTables Boolean subscriber.
Definition BooleanTopic.hpp:33
NetworkTables Boolean topic.
Definition BooleanTopic.hpp:234
A network table that knows its subtable path.
Definition NetworkTable.hpp:57
NetworkTables Instance.
Definition NetworkTableInstance.hpp:67
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
Definition CvSource.hpp:15