2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2011-2018 FIRST. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2016-05-25 22:40:15 -07:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
#include <string>
|
2016-09-25 16:50:13 -07:00
|
|
|
|
2018-04-29 23:33:19 -07:00
|
|
|
#include <wpi/Twine.h>
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2017-12-04 23:28:33 -08:00
|
|
|
class SendableBuilder;
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
class Sendable {
|
|
|
|
|
public:
|
2018-09-24 00:08:25 -07:00
|
|
|
Sendable() = default;
|
2017-12-04 23:28:33 -08:00
|
|
|
virtual ~Sendable() = default;
|
|
|
|
|
|
2018-09-24 00:08:25 -07:00
|
|
|
Sendable(Sendable&&) = default;
|
|
|
|
|
Sendable& operator=(Sendable&&) = default;
|
|
|
|
|
|
2017-12-04 23:28:33 -08:00
|
|
|
/**
|
|
|
|
|
* Gets the name of this Sendable object.
|
|
|
|
|
*
|
|
|
|
|
* @return Name
|
|
|
|
|
*/
|
|
|
|
|
virtual std::string GetName() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the name of this Sendable object.
|
|
|
|
|
*
|
|
|
|
|
* @param name name
|
|
|
|
|
*/
|
2018-04-29 23:33:19 -07:00
|
|
|
virtual void SetName(const wpi::Twine& name) = 0;
|
2017-12-04 23:28:33 -08:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
2017-12-04 23:28:33 -08:00
|
|
|
* Sets both the subsystem name and device name of this Sendable object.
|
2017-11-16 00:33:51 -08:00
|
|
|
*
|
2017-12-04 23:28:33 -08:00
|
|
|
* @param subsystem subsystem name
|
|
|
|
|
* @param name device name
|
2015-06-25 15:07:55 -04:00
|
|
|
*/
|
2018-04-29 23:33:19 -07:00
|
|
|
void SetName(const wpi::Twine& subsystem, const wpi::Twine& name) {
|
2017-12-04 23:28:33 -08:00
|
|
|
SetSubsystem(subsystem);
|
|
|
|
|
SetName(name);
|
|
|
|
|
}
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
2017-12-04 23:28:33 -08:00
|
|
|
* Gets the subsystem name of this Sendable object.
|
|
|
|
|
*
|
|
|
|
|
* @return Subsystem name
|
|
|
|
|
*/
|
|
|
|
|
virtual std::string GetSubsystem() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the subsystem name of this Sendable object.
|
|
|
|
|
*
|
|
|
|
|
* @param subsystem subsystem name
|
|
|
|
|
*/
|
2018-04-29 23:33:19 -07:00
|
|
|
virtual void SetSubsystem(const wpi::Twine& subsystem) = 0;
|
2017-12-04 23:28:33 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initializes this Sendable object.
|
|
|
|
|
*
|
|
|
|
|
* @param builder sendable builder
|
2015-06-25 15:07:55 -04:00
|
|
|
*/
|
2017-12-04 23:28:33 -08:00
|
|
|
virtual void InitSendable(SendableBuilder& builder) = 0;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|