Previous Next        Current Page: NeXtMidas Training / Primitives / Open, Process, Close / process()
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 process() method.
    • Should process a single set of data.
      • Generally only one "transfer length" of data is processed on each call to process().
      • This method will be called again, and again, and again until it returns FINISH.
    • Should return one of the following:
      NORMAL Normal operation, data was processed.
      NOOP Nothing to process, wait for next frame.
      FINISH Done processing, go to close().
    • It is important to return NOOP if nothing was done (usually waiting for piped data).
      • NOOP tells NeXtMidas to pause before calling process() again.
        • The pause delay defaults to 0.0125 seconds, but can be changed by via the setPollTime(..) method or via the /POLL= switch.
      • This prevents process() from "spinning" and using up a lot of CPU while waiting.
X-Midas Users Take Note:
The process method is called many times. This is because NeXtMidas abstracts most of the process loop away from the individual primitive. By abstracting most of the process loop, the primitive can run in many modes (piped, not piped, run from X-Midas, run by a processing engine, etc.) without alteration.
Don't Make This Mistake:
One of the most common mistakes is returning NORMAL from process() when nothing has been done. This will cause the process loop to spin and use up all of the CPU time.