Next: , Previous: Constructors / destructor, Up: Anatomy of a MarSystem


10.2.3 Handling controls

addControls() defines which controls a MarSystem uses:

     addctrl("mrs_real/frequency", 1000);
     //setctrlState("mrs_real/frequency", true);

The addctrl() sets up a control for the MarSystem; this control may be changed by other C++ code by doing

     MarNetwork->updctrl("MyName/myInstanceName/mrs_real/frequency",
     500 );

This will change the value of the control and call MyName::myUpdate().

If we called setctrl instead of updctrl,

     MarNetwork->setctrl("MyName/myInstanceName/mrs_real/frequency",
     500 );

Then myUpdate() will not be called. If we had set setctrlState to true (ie uncommented the line in the initial example), then setting this control would automatically call MyName::myUpdate().