===== SteereoCommand =====

==== Description ====
The SteereoCommand class is the base class for all commands, which determine the steering functionality of a simulation.

==== Writing own commands ====
An example is already given in the [[steereo:simple_howto#writing_own_commands|Howto]]. Here I will explain more detailed what you can do in your commands: \\
=== Functions to use ===
This functions from SteereoCommand can be used to configure your own command:
  * <code cpp> void setCommandName (std::string name) </code> With this you determine the name of your command. This can be quite important as this will be the name a client has to use to call this command, when you decide to automatically load the commands into your simulation.
  * <code cpp> void setUndoable (bool flag = true) </code> per default a command is not undoable. But with this function you can declare it as such. You also have to override the //undo// function then. With this the command will get into an execution history queue after execution and can be "undone" (it calls the //undo// function), if the client requests it.
  * <code cpp> void* getData () </code> <code cpp> int getDataSize () </code> Get the data pointer and the size of the data given to the command in the simulation. Especially with Fortran simulations the simulation data will only be available this way. 
  * <code cpp> SteereoStream* getAdditionalData () </code> Access data which the client transferred additionaly to the parameters.
  * <code cpp> SteereoCommunicator* getCommunicator () </code> <code cpp> SteereoConnection* getConnection () </code> Gives you the communicator respectively the connection to the client, that requested this command. Will be very helpful for sending results to the client.
The first two can be set as the second (name), respectively first parameter (undoable flag) of the //SteereoCommand// constructor. \\

=== Functions to override ===
You shape the main characteristics of your command by overriding the following functions:
  * (mandatory) <code cpp> static SteereoCommand* generateNewInstance () </code> In this function you should specify how to generate a new instance of your command. In most cases a //return new myCommand;// should suffice.
  * (recommended) <code cpp> void setParameters (std::list<std::string> params) </code> The command receives the parameters with which the client requests it. If your command is parameterized, you have to implement this function.
  * (mandatory) <code cpp> ReturnType execute () </code> The core of your command. Here you should specify what your command does. At the end you should return one of the following values:
    * NOT_EXECUTED -> the command couldn't be executed fully by some misfortune
    * REPETITION_REQUESTED -> everything went fine, but the command shall be called again and thus be put into the command queue (again).
    * EXECUTED -> everything went fine and the command will be removed from the command queue
  * <code cpp> ReturnType undo () </code> Only needed, when you set the //undoable// flag to true. Then you have to specify here how the command can be undone. The return value is of the same type as for the //execute// function.
  * <code cpp> bool condition () </code> Before a command is executed the function //condition// is called. If the result is true (the default implementation just returns that) the command is executed, otherwise it is left in the queue. For example you can achieve, that the command is only executed, when the current step number is divisible by 5 or every 5 steps, when your //execute// function returns //REPETITION_REQUESTED//.
   

  