next up previous contents index
Next: Run console menu Up: Scalable Real-Time Engine: SRTEngine Previous: Scalable Real-Time Engine: SRTEngine   Contents   Index

Constructor

SRTEngine(Devs& modl, Time ending_t = DBL_MAX, CallBack cbf=NULL);
The constructor needs three arguments: the first argument is the Devs model to be simulated, the second is the simulation terminating time, the last is a callback function that is used to inject a user-input into the simulation model.

Callback function's type is defined as

PortValue (*CallBack)(Devs& md).
It returns a PortValue which can be a pair of an input port and a value. The associated input port should belong to Devs md. The following example shows that InjectMsg returns a PortValue whose port is vm's ip input port.

PortValue InjectMsg(Devs& md) {
    VM& vm = (VM&) md;
    return PortValue(vm.ip);
}
We can pass the function pointer of a callback function to an instance of SRTEngine as follows.
SRTEngine simEngine(vm, 10000, InjectMsg);



MHHwang 2007-05-07