WPILibC++  2020.3.2
SubsystemBase.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2019 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 <frc/smartdashboard/Sendable.h>
13 #include <frc/smartdashboard/SendableHelper.h>
14 
15 #include "frc2/command/Subsystem.h"
16 
17 namespace frc2 {
22 class SubsystemBase : public Subsystem,
23  public frc::Sendable,
24  public frc::SendableHelper<SubsystemBase> {
25  public:
26  void InitSendable(frc::SendableBuilder& builder) override;
27 
33  std::string GetName() const;
34 
40  void SetName(const wpi::Twine& name);
41 
47  std::string GetSubsystem() const;
48 
54  void SetSubsystem(const wpi::Twine& name);
55 
63  void AddChild(std::string name, frc::Sendable* child);
64 
65  protected:
66  SubsystemBase();
67 };
68 } // namespace frc2
frc2::SubsystemBase::InitSendable
void InitSendable(frc::SendableBuilder &builder) override
Initializes this Sendable object.
frc2::SubsystemBase::AddChild
void AddChild(std::string name, frc::Sendable *child)
Associate a Sendable with this Subsystem.
frc2::SubsystemBase::SetSubsystem
void SetSubsystem(const wpi::Twine &name)
Sets the subsystem name of this Subsystem.
frc2::SubsystemBase::SetName
void SetName(const wpi::Twine &name)
Sets the name of this Subsystem.
frc::Sendable
Interface for Sendable objects.
Definition: Sendable.h:17
frc2::SubsystemBase
A base for subsystems that handles registration in the constructor, and provides a more intuitive met...
Definition: SubsystemBase.h:22
frc2::Subsystem
A robot subsystem.
Definition: Subsystem.h:39
frc2::SubsystemBase::GetName
std::string GetName() const
Gets the name of this Subsystem.
wpi::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:85
frc2::SubsystemBase::GetSubsystem
std::string GetSubsystem() const
Gets the subsystem name of this Subsystem.
frc::SendableHelper
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28
frc::SendableBuilder
Definition: SendableBuilder.h:23