Next: , Previous: Handling controls, Up: Anatomy of a MarSystem


10.2.4 myProcess()

myProcess() is called every time the MarSystem receives a tick() (ie all the time the program is running).

Resource-intensive operations (such as changing the buffer size, computing trigonomic functions, etc) that only depend on the controls (not the actual dataflow input) should be performed inside myUpdate(). For more information, see myUpdate() vs. myProcess()

Most myProcess() functions will look like this:

     void
     MyMar::myProcess(realvec& in, realvec& out)
     {
     	// pre-loop initialization
     	...
     
     	// loop over buffer
     	for (o=0; o < inObservations_; o++)
     		for (t = 0; t < inSamples_; t++)
     		// calculate next value
     		...
     		out(o,t) = ...;
     
     	// post-loop actions
     	...
     }