Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Download the configured GMAT source
  2. Download, or refer to, the GMAT C++ Code Style Guide from the GMAT Wiki .  Code used in GMAT follows the standard GMAT coding style must be followed for any new/modified codeas defined in this guide.
  3. Build GMAT on your platform with no code changes (see instructions on building the source on the GMAT Wiki) [NOTE: to maintain cross-platform compatibility, code must build successfully using the GCC compiler and Visual Studio in order to be considered for inclusion into in GMAT.]
  4. Run the Sample Missions (or SmokeTests * and possibly a subset of relevant system test folderstests, if you have access to thosethe GMAT test system) before code modification, to
    1. Confirm successful execution of the unmodified GMAT, and
    2. Obtain an initial set of 'truth' data for later testing

Once these steps have been completed and GMAT runs successfully as-isfrom this clean build, you can start the work to create a new Command.

...

Though GMAT is a modular system, adding a new Command is not as simple as just compiling and linking a new class. There are requirements that must be met regarding, among other things:

  • Deriving the new class from a base classes class (either an existing Command class, or GmatCommand)
  • Implementing, at a minimum, several specific methods
  • Adding a the new type command to the appropriate factory (or creating a new factory)
  • Updating base type lists and related enumerated types
  • Modification of types and addition of methods in GUI management classes
  • Optionally, creating GUI components to edit your new Command

...

  • InterpretAction(): Parses the command string and builds the corresponding command structures. During the script interpretation, this method is called to parse the string and to set Resource object names and options.
  • GetWrapperObjectNameArray(), SetElementWrapper(), ClearWrappers(): If a Command access accesses configured Parameters or other Resource properties, these methods should be implemented.
  • RenameRefObject(): If a Command access accesses one or more configured Resource, this method should be implemented.
  • Initialize(): Initializes the internal command data. During the Sandbox initialization, this method is called to set Resource object pointers to the objects in the Sandbox.
  • Execute(): Performs actions on associated Resource objects or just performs actions without associated Resource objects. During the Sandbox execution, this method is called to perform actions.
  • TakeAction(): Performs an action specific to a the Command. This method is usually called from other Commands.
  • GetGeneratingString(): Generates a the command string as it appears in the script. This method is called when saving GUI resources and commands to a script file, or when showing scripts from the individual resource panel.

...

There are practices and/or strategies that may be helpful to a developer in creating a new Command, e.g., sometimes it is . It is often helpful to:

  • First, determine scripting of the new component
  • Next, modify/add the minimal set of code for the new Command until the associated script parses
  • Then, add validation of the input data
  • Then, begin to add the functionality necessary to make the Command work (may be done in steps)

Procedures for Adding a New Command

...