Previous Next        Current Page: NeXtMidas Training / Primitives / Open, Process, Close / open()
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   
      - Processing Stages   
      - Control Flow   
      - Control Flow (Host)   
      - 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   
   + Introduction to DSP   
   + Lab 9   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • The open() method.
    • Should handle all initialization.
      • This includes getting any command-line parameters or switches.
      • Do not initialize in a constructor.
        • This will cause problems if the primitive needs to be restarted. (More on this later.)
        • NeXtMidas uses reflection to call primitives. If the constructor takes in any arguments, NeXtMidas won't know how to call it.
        • Primitives should not even have a constructor declared.
    • Should open any files used.
      • If a pipe is opened in process(), there may be data loss.
    • Should return one of the following:
      NORMAL Normal operation, ready for process().
      FINISH Nothing to process, skip to close(). (This is rarely used.)
    • Example of using FINISH: A primitive that takes in a list of files to process may return FINISH if no files are given.