WPILibC++  2019.1.1-beta-4-32-g6bdd7ce
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Sendable.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2011-2018 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <string>
11 
12 #include <wpi/Twine.h>
13 
14 namespace frc {
15 
16 class SendableBuilder;
17 
18 class Sendable {
19  public:
20  Sendable() = default;
21  virtual ~Sendable() = default;
22 
23  Sendable(Sendable&&) = default;
24  Sendable& operator=(Sendable&&) = default;
25 
31  virtual std::string GetName() const = 0;
32 
38  virtual void SetName(const wpi::Twine& name) = 0;
39 
46  void SetName(const wpi::Twine& subsystem, const wpi::Twine& name) {
47  SetSubsystem(subsystem);
48  SetName(name);
49  }
50 
56  virtual std::string GetSubsystem() const = 0;
57 
63  virtual void SetSubsystem(const wpi::Twine& subsystem) = 0;
64 
70  virtual void InitSendable(SendableBuilder& builder) = 0;
71 };
72 
73 } // namespace frc
void SetName(const wpi::Twine &subsystem, const wpi::Twine &name)
Sets both the subsystem name and device name of this Sendable object.
Definition: Sendable.h:46
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
virtual void SetSubsystem(const wpi::Twine &subsystem)=0
Sets the subsystem name of this Sendable object.
virtual void InitSendable(SendableBuilder &builder)=0
Initializes this Sendable object.
virtual std::string GetSubsystem() const =0
Gets the subsystem name of this Sendable object.
virtual void SetName(const wpi::Twine &name)=0
Sets the name of this Sendable object.
Definition: SendableBuilder.h:23
Definition: Sendable.h:18
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
virtual std::string GetName() const =0
Gets the name of this Sendable object.