PathPlannerLib
Loading...
Searching...
No Matches
NamedCommands.h
1#pragma once
2
3#include <string>
4#include <unordered_map>
5#include <memory>
6#include <frc2/command/Commands.h>
7
8namespace pathplanner {
10public:
17 static inline void registerCommand(std::string name,
18 std::shared_ptr<frc2::Command> command) {
19 NamedCommands::GetNamedCommands().emplace(name, command);
20 }
21
22 static inline void registerCommand(std::string name,
23 frc2::CommandPtr &&command) {
24 registerCommand(name,
25 std::shared_ptr < frc2::Command
26 > (std::move(command).Unwrap()));
27 }
28
35 static inline bool hasCommand(std::string name) {
36 return NamedCommands::GetNamedCommands().contains(name);
37 }
38
45 static frc2::CommandPtr getCommand(std::string name);
46
47 static std::unordered_map<std::string, std::shared_ptr<frc2::Command>>& GetNamedCommands();
48};
49}
Definition: NamedCommands.h:9
static frc2::CommandPtr getCommand(std::string name)
Definition: NamedCommands.cpp:7
static void registerCommand(std::string name, std::shared_ptr< frc2::Command > command)
Definition: NamedCommands.h:17
static bool hasCommand(std::string name)
Definition: NamedCommands.h:35