mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Add move constructors and assignment operators to wpilibc (#1314)
Fixes #898.
This commit is contained in:
committed by
Peter Johnson
parent
b1965f74a8
commit
1aa8446725
@@ -115,6 +115,9 @@ class Command : public ErrorBase, public SendableBase {
|
||||
|
||||
~Command() override = default;
|
||||
|
||||
Command(Command&&) = default;
|
||||
Command& operator=(Command&&) = default;
|
||||
|
||||
/**
|
||||
* Returns the time since this command was initialized (in seconds).
|
||||
*
|
||||
|
||||
@@ -46,6 +46,9 @@ class CommandGroup : public Command {
|
||||
|
||||
virtual ~CommandGroup() = default;
|
||||
|
||||
CommandGroup(CommandGroup&&) = default;
|
||||
CommandGroup& operator=(CommandGroup&&) = default;
|
||||
|
||||
/**
|
||||
* Adds a new Command to the group. The Command will be started after all the
|
||||
* previously added Commands.
|
||||
|
||||
@@ -21,6 +21,10 @@ class CommandGroupEntry {
|
||||
|
||||
CommandGroupEntry() = default;
|
||||
CommandGroupEntry(Command* command, Sequence state, double timeout = -1.0);
|
||||
|
||||
CommandGroupEntry(CommandGroupEntry&&) = default;
|
||||
CommandGroupEntry& operator=(CommandGroupEntry&&) = default;
|
||||
|
||||
bool IsTimedOut() const;
|
||||
|
||||
double m_timeout = -1.0;
|
||||
|
||||
@@ -54,6 +54,9 @@ class ConditionalCommand : public Command {
|
||||
|
||||
virtual ~ConditionalCommand() = default;
|
||||
|
||||
ConditionalCommand(ConditionalCommand&&) = default;
|
||||
ConditionalCommand& operator=(ConditionalCommand&&) = default;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The Condition to test to determine which Command to run.
|
||||
|
||||
@@ -81,6 +81,9 @@ class InstantCommand : public Command {
|
||||
InstantCommand() = default;
|
||||
virtual ~InstantCommand() = default;
|
||||
|
||||
InstantCommand(InstantCommand&&) = default;
|
||||
InstantCommand& operator=(InstantCommand&&) = default;
|
||||
|
||||
protected:
|
||||
std::function<void()> m_func = nullptr;
|
||||
void _Initialize() override;
|
||||
|
||||
@@ -40,6 +40,9 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
|
||||
Subsystem& subsystem);
|
||||
virtual ~PIDCommand() = default;
|
||||
|
||||
PIDCommand(PIDCommand&&) = default;
|
||||
PIDCommand& operator=(PIDCommand&&) = default;
|
||||
|
||||
void SetSetpointRelative(double deltaSetpoint);
|
||||
|
||||
// PIDOutput interface
|
||||
|
||||
@@ -105,6 +105,9 @@ class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
|
||||
|
||||
~PIDSubsystem() override = default;
|
||||
|
||||
PIDSubsystem(PIDSubsystem&&) = default;
|
||||
PIDSubsystem& operator=(PIDSubsystem&&) = default;
|
||||
|
||||
/**
|
||||
* Enables the internal PIDController.
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,9 @@ class PrintCommand : public InstantCommand {
|
||||
explicit PrintCommand(const wpi::Twine& message);
|
||||
virtual ~PrintCommand() = default;
|
||||
|
||||
PrintCommand(PrintCommand&&) = default;
|
||||
PrintCommand& operator=(PrintCommand&&) = default;
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
|
||||
|
||||
@@ -87,6 +87,9 @@ class Scheduler : public ErrorBase, public SendableBase {
|
||||
Scheduler();
|
||||
~Scheduler() override;
|
||||
|
||||
Scheduler(Scheduler&&) = default;
|
||||
Scheduler& operator=(Scheduler&&) = default;
|
||||
|
||||
struct Impl;
|
||||
std::unique_ptr<Impl> m_impl;
|
||||
};
|
||||
|
||||
@@ -16,6 +16,9 @@ class StartCommand : public InstantCommand {
|
||||
explicit StartCommand(Command* commandToStart);
|
||||
virtual ~StartCommand() = default;
|
||||
|
||||
StartCommand(StartCommand&&) = default;
|
||||
StartCommand& operator=(StartCommand&&) = default;
|
||||
|
||||
protected:
|
||||
virtual void Initialize();
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ class Subsystem : public ErrorBase, public SendableBase {
|
||||
*/
|
||||
explicit Subsystem(const wpi::Twine& name);
|
||||
|
||||
Subsystem(Subsystem&&) = default;
|
||||
Subsystem& operator=(Subsystem&&) = default;
|
||||
|
||||
/**
|
||||
* Sets the default command. If this is not called or is called with null,
|
||||
* then there will be no default command for the subsystem.
|
||||
|
||||
@@ -54,6 +54,9 @@ class TimedCommand : public Command {
|
||||
|
||||
virtual ~TimedCommand() = default;
|
||||
|
||||
TimedCommand(TimedCommand&&) = default;
|
||||
TimedCommand& operator=(TimedCommand&&) = default;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Ends command when timed out.
|
||||
|
||||
@@ -31,6 +31,9 @@ class WaitCommand : public TimedCommand {
|
||||
WaitCommand(const wpi::Twine& name, double timeout);
|
||||
|
||||
virtual ~WaitCommand() = default;
|
||||
|
||||
WaitCommand(WaitCommand&&) = default;
|
||||
WaitCommand& operator=(WaitCommand&&) = default;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -19,6 +19,9 @@ class WaitForChildren : public Command {
|
||||
WaitForChildren(const wpi::Twine& name, double timeout);
|
||||
virtual ~WaitForChildren() = default;
|
||||
|
||||
WaitForChildren(WaitForChildren&&) = default;
|
||||
WaitForChildren& operator=(WaitForChildren&&) = default;
|
||||
|
||||
protected:
|
||||
virtual bool IsFinished();
|
||||
};
|
||||
|
||||
@@ -29,6 +29,9 @@ class WaitUntilCommand : public Command {
|
||||
|
||||
virtual ~WaitUntilCommand() = default;
|
||||
|
||||
WaitUntilCommand(WaitUntilCommand&&) = default;
|
||||
WaitUntilCommand& operator=(WaitUntilCommand&&) = default;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Check if we've reached the actual finish time.
|
||||
|
||||
Reference in New Issue
Block a user