mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Command: Use SmallPtrSet for requirements instead of std::set
This commit is contained in:
@@ -8,18 +8,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <wpi/SmallPtrSet.h>
|
||||
#include <wpi/Twine.h>
|
||||
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/commands/Subsystem.h"
|
||||
#include "frc/smartdashboard/SendableBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class CommandGroup;
|
||||
class Subsystem;
|
||||
|
||||
/**
|
||||
* The Command class is at the very core of the entire command framework.
|
||||
@@ -186,7 +186,7 @@ class Command : public ErrorBase, public SendableBase {
|
||||
*/
|
||||
bool DoesRequire(Subsystem* subsystem) const;
|
||||
|
||||
typedef std::set<Subsystem*> SubsystemSet;
|
||||
typedef wpi::SmallPtrSetImpl<Subsystem*> SubsystemSet;
|
||||
|
||||
/**
|
||||
* Returns the requirements (as an std::set of Subsystem pointers) of this
|
||||
@@ -393,7 +393,7 @@ class Command : public ErrorBase, public SendableBase {
|
||||
bool m_initialized = false;
|
||||
|
||||
// The requirements (or null if no requirements)
|
||||
SubsystemSet m_requirements;
|
||||
wpi::SmallPtrSet<Subsystem*, 4> m_requirements;
|
||||
|
||||
// Whether or not it is running
|
||||
bool m_running = false;
|
||||
|
||||
@@ -95,7 +95,8 @@ class Scheduler : public ErrorBase, public SendableBase {
|
||||
|
||||
void ProcessCommandAddition(Command* command);
|
||||
|
||||
Command::SubsystemSet m_subsystems;
|
||||
typedef std::set<Subsystem*> SubsystemSet;
|
||||
SubsystemSet m_subsystems;
|
||||
wpi::mutex m_buttonsMutex;
|
||||
typedef std::vector<std::unique_ptr<ButtonScheduler>> ButtonVector;
|
||||
ButtonVector m_buttons;
|
||||
|
||||
Reference in New Issue
Block a user