Conversely, if you do not want to use the HcsmSystem class, you can maintain your own lists of hcsm that have been instantiated. When it comes time to execute the hcsm, you will call the Hcsm Class member void Hcsm::execute( void ). This differs from the HcsmSystem method in that you call the execute member of each hcsm directly. This is also the means we will use in the hcsm-system.C code that can be found in the testhcsm directory of the source.
Hcsm* myhcsm = new MyNewHcsmClass();
myhcsm->execute();
To show the first process, I will outline a very simple main.C that illustrates how to use the HcsmSystem class.
#include <HcsmSystem.H>
#include <myHcsmClass.H>
int main()
{
// instantiate the Hcsm System Class - allow the
// max number of hcsm in system to be 10
HcsmSystem* hcsmsys = new HcsmSystem(10);
// instantiate and register hcsms with system
// - only want 2 hcsm for this example
hcsmsys->addhcsm( new myHcsm() );
hcsmsys->addhcsm( new myHcsm() );
// run the engine 5 times - likewise, execute each hcsm five times
for (int i=0; i<5; i++)
hcsmsys->engine();
delete hcsmsys;
return 1;
}