next up previous contents
Next: Calls the kernel provides Up: The TimeWarp class Previous: Methods the application provides

Data defined by the User

The events passed between the simulation objects will most likely need to be defined by the user. Many types of events might need to be defined, which is easy to do. All user defined event types must be derived from the BasicEvent class. The definition of this class follows:

class BasicEvent {
   int size;        // the sender MUST fill this in!
   VTime sendTime;   // this is filled in when it's sent
   VTime recvTime;   // the sender must fill this in!  This is the time
                    // that the message should be received by the
                    // receiving object
   int sender;      // this gets filled in when it's sent
   int dest;        // the user must fill this in
}

This data represents the minimum amount of information needed to send an event from one object to another. A description of which fields must be filled in before passing an event to sendEvent is in the section describing that method.

Since the ``ping pong'' application needs no additional data to that of a BasicEvent, it does not explicitly declare it's own event type. However, if one wished to, they could simply do a typedef BasicEvent Ball; to have a ``Ball'' class.

By default, WARPED has a simple notion of time. More precisely, time is defined in the class VTime as a signed integer. Obviously, particular instances of a simulation with the WARPED kernel may have different requirements for the concept of time. For instance, simulators for the hardware description language VHDL require a more complex definition of time. Thus, WARPED includes a mechanism for defining a more complex structure for time.

If the simple, kernel-supplied version of time is insufficient, the application programmer need only define the preprocessor macro USE_USER_VTIME during compilation. (This will be discussed more in the section on the configuration file, config.hh) In addition, the user must define the class VTime with data members appropriate to the application's needs. In addition to the definition requirements, the WARPED kernel has requirements about the defined methods of the type VTime. More specifically, the implementation of VTime must supply the following operators and data, either by default or through explicit instantiation:


next up previous contents
Next: Calls the kernel provides Up: The TimeWarp class Previous: Methods the application provides
Philip A. Wilsey
1/26/1998