The contents of the main steering program can be almost read off from figure 5.1. Firstly, the Simulation object is created:
Simulation exampleSim;Then the four objects that make up the simulation are created, in lines similar to:
ExampleXorElement simpleGate;Next, the four objects are added to the Simulation, for example:
exampleSim += compoundGate;The next step is to connect the components together. This is generally a two step process. First find the output port of one object, then request it to be connected to its destination, eg:
DataPort* testA = testValues.getOutput( "Output", 0 ); simpleGate.connectInput( "Input", testA, 0 );Note that a single output (eg Output0 from the ExampleReader) can be connected into several destinations. Once all eight connections have been made, all that remains is to attach the input and output files:
testValues.inputFromFile( "exercise.dat" ); resultLogger.outputToFile( "results.dat" );before stepping through the simulation:
while ( exampleSim.newEvent() == procOk ) { // do something if required between steps }This steps through each set of test-vectors one by one until they are exhausted.