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
Commands and a RemoteMapState whose behavior is defined by derived classes. Used in conjunction with the CommandMapper to add and removeCommands 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
Commands mapped to a particular RemoteMapState.Note
All nullptr
Commands in cmds will be removed.- Parameters:
cmds – [in] A list of
Commands 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
Commands from the main scheduler. Up the the implementer to determine what the criteria for adding and removingCommands should be.- Parameters:
currState – [in] The current state of the remote.
-
virtual bool mappingSubset(const RemoteMapState &mapState)
- Returns:
trueifthis’smapStateis a subset of the passed inmapState. Returnsfalseotherwise.
-
inline const RemoteMapState &getAssociatedRemoteMapState() const
Public Static Functions
-
static inline bool negKeysSubset(const RemoteMapState &state1, const RemoteMapState &state2)
- Returns:
trueifstate1’s neg keys are a subset ofstate2’s keys pressed,falseotherwise.
Protected Functions
-
void addCommands()
Adds all the
Commands to the main CommandScheduler.
-
void removeCommands()
Removes all the
Commands 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
mapStates of cm1 and cm2.
-
CommandMapping(Drivers *drivers, const std::vector<Command*> cmds, const RemoteMapState &rms)