#include <BasicCommands.h>
|
static PtrType | create (int nCycles=-1) |
|
This command makes commands executing again until the given number of cycles is reached. Its behavior is depend on how the command is executed.
- The command is executed directly by the command processor: All previously executed commands are executed again.
- The command is part of macro command: All previously attached commands are executed again. That means the repeat command attached to a macro command repeats only commands of this command also if this macro is attached to another macro.
Example: two loops in one command plus a seperate repeat. 2 times 2 times 2 (8) torpedos with
litte pauses are fired. (in python)
innerLoop.attach(CSWFireCommand.create(self.getFrontLeftWeaponBattery(), None))
innerLoop.attach(CSWWaitCommand.create(2.5))
outerLoop.attach(CSWWaitCommand.create(5))
outerLoop.attach(innerLoop)
self.getCommandProcessor().execute(outerLoop)
Definition: MacroCommand.h:18
static PtrType create(const std::string &strName)
Definition: MacroCommand.cpp:19
Definition: BasicCommands.h:41
static PtrType create(int nCycles=-1)
Definition: BasicCommands.cpp:13
◆ copy()
ARSTD::Command::PtrType ARSTD::RepeatCommand::copy |
( |
| ) |
const |
|
virtual |
Returns a copy of the command.
- Returns
- The copied command.
Implements ARSTD::Command.
◆ create()
RepeatCommand::PtrType ARSTD::RepeatCommand::create |
( |
int |
nCycles = -1 | ) |
|
|
static |
Creates a new repeat command.
- Parameters
-
nCycles | The number of cycles that all previous commands should repeat. If a negativ value is given the repeating does not terminate automatically. |
- Returns
- Returns the new constructed command.
◆ getName()
std::string ARSTD::RepeatCommand::getName |
( |
| ) |
const |
|
virtual |
Returns the name of the command.
- Returns
- The name of the command.
Implements ARSTD::Command.