Class CommandMapping
Defined in File command_mapping.hpp
Inheritance Relationships
Derived Types
public tap::control::HoldCommandMapping
(Class HoldCommandMapping)public tap::control::HoldRepeatCommandMapping
(Class HoldRepeatCommandMapping)public tap::control::PressCommandMapping
(Class PressCommandMapping)public tap::control::ToggleCommandMapping
(Class ToggleCommandMapping)
Class Documentation
-
class CommandMapping
A class that combines a vector of
Command
s and a RemoteMapState whose behavior is defined by derived classes. Used in conjunction with the CommandMapper to add and removeCommand
s from the scheduler when the derived CommandMapping sees fit, depending on the current state of the remote data.See also
See also
See also
See also
Subclassed by tap::control::HoldCommandMapping, tap::control::HoldRepeatCommandMapping, tap::control::PressCommandMapping, tap::control::ToggleCommandMapping
Public Functions
-
CommandMapping(Drivers *drivers, const std::vector<Command*> cmds, const RemoteMapState &rms)
Initializes the CommandMapping with the set of passed in
Command
s mapped to a particular RemoteMapState.Note
All nullptr
Command
s in cmds will be removed.- Parameters:
cmds – [in] A list of
Command
s that are associated with the mapping.rms – [in] The map state that will be compared to the actual remote state to determine whether or not to add
cmds
.
-
virtual ~CommandMapping() = default
Nothing dynamically allocated that isn’t taken care of automatically.
-
virtual void executeCommandMapping(const RemoteMapState &currState) = 0
Using currState, determines whether or not to add or remove
Command
s from the main scheduler. Up the the implementer to determine what the criteria for adding and removingCommand
s should be.- Parameters:
currState – [in] The current state of the remote.
-
virtual bool mappingSubset(const RemoteMapState &mapState)
- Returns:
true
ifthis
’smapState
is a subset of the passed inmapState
. Returnsfalse
otherwise.
-
inline const RemoteMapState &getAssociatedRemoteMapState() const
Public Static Functions
-
static inline bool negKeysSubset(const RemoteMapState &state1, const RemoteMapState &state2)
- Returns:
true
ifstate1
’s neg keys are a subset ofstate2
’s keys pressed,false
otherwise.
Protected Functions
-
void addCommands()
Adds all the
Command
s to the main CommandScheduler.
-
void removeCommands()
Removes all the
Command
s from the main CommandScheduler.
-
bool noCommandsScheduled() const
- Returns:
True if none of the associated commands are scheduled.
Protected Attributes
-
const RemoteMapState mapState
The RemoteMapState specified when constructing the CommandMapping.
-
Drivers *drivers
Friends
-
friend bool operator==(const CommandMapping &cm1, const CommandMapping &cm2)
Straight equality of the mapState and mappedCommands between cm1 and cm2.
-
friend bool mapStateEqual(const CommandMapping &cm1, const CommandMapping &cm2)
Checks for equality between the
mapState
s of cm1 and cm2.
-
CommandMapping(Drivers *drivers, const std::vector<Command*> cmds, const RemoteMapState &rms)