Previous Next        Current Page: NeXtMidas Training / Primitives / Primitive Restarts / Restarting a Primitive
back
+ Start Here   
+ Background   
+ Common Midas Concepts   
+ Getting Started - Part 1   
+ Getting Started - Part 2   
+ Working with Files   
+ Option Trees   
+ Macros - Part 1 (Basics)   
+ Macros - Part 2 (Graphics)   
+ NetBeans - Part 1 (Setup)   
+ NetBeans - Part 2 (GUIs)   
+ NetBeans - Part 3 (Profiler)   
+ Eclipse - Part 1 (Setup)   
+ Eclipse - Part 2 (GUIs)   
- Primitives   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   + Special Variables   
   + Lab 2   
   + Lab 3*   
   + Files in a Primitive   
   + Lab 4   
   + Lab 5*   
   + Test Macros   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   - Primitive Restarts   
      - Using Restarts   
      - Control Flow (Restart)   
      - Control Flow (Restart)   
      - Restart-Safe Primitives   
      - Preserving State   
      - Restarting a Primitive   
   + Introduction to DSP   
   + Lab 9   
   - Commands executing commands   
+ WebStart   
+ Maps & Imagery   
+ X-Midas Interoperability   
+ RMIF & Remoting   
+ Installing NeXtMidas   
+ Support & Maintenance   
+ File Handlers   


  • Restarting a Primitive:
    • Typically the macro writer does not need to be aware of situations that require a restart. The primitive takes care of it inside one its setFoo(..) methods.
    • Since a restart is similar to a normal start with different input parameters, the restart is implemented this way.
      • Prior to a restart a primitive overwrites its original input arguments and then sets the state to RESTART.
      • The arguments are overridden using the setArg(name, value) method.
      • Example:
          public void setFrameSize(int fs) {
            setArg("FS", Integer.toString(fs));
            setState(RESTART);
          }
        
      • The open() treats the setArg("FOO","newVal") as if the user had put "FOO=newVal" on the command line.

back