|
WSF
|
The scenario object (WsfScenario) is populated with input from files or other sources.
WSF implements an abstract concept of an input stream call UtInput. This class provides numerous methods to extract data from the stream. WSF provides two concrete implementations of UtInput:
Nearly every major object in WSF implements the method:
This method examines the current command in the input stream to see if it should be processed by the class. If so, it processes the command and returns 'true'. If it doesn't recognize the command and if it is a derived class, then it should call the base class ProcessInput method which continues the process. If any class in the heirarchy recognizes the command then 'true' should be returned. If no class in the heirarchy recognizes the command then 'false' should be returned.
The scenario makes use of various 'TypeList' classes (for example, WsfPlatformTypes, WsfSensorTypes, etc.) to process the input stream. A type list looks at the current command and if it recognizes it, processes the command and returns 'true'. If it does't recognize it then it simply returns 'false'.
The scenario simply reads a command and passes it to each type list where it is given a chance to process the command. If a type list recognizes the command it is processed by creating and updating objects using the ProcessInput methods and returns 'true' to the scenario. If a factory does not recognize a command then it returns 'false' to the scenario which tells it to try the next type list. If no scenario object recognizes the command then the command is passed to extensions registered with the scenario. If it doesn't recognize the command then the command is invalid.
Any error encountered in the input will result in an exception being thrown. The calling routine may catch the error, but input errors may leave objects in an indeterminate state and cause the simulation to crash if allowed to continue.
The type lists makes extensive use of the object type system (The 'Object Type' System) described earlier. Commands will direct it to create new object types or to create instances of object types. For instance, a 'platform_type' command will result in WsfPlatformTypes::LoadType creating a new platform type (by calling WsfPlatformTypes::Add). A 'platform' command will result in WsfPlatformTypes::LoadInstance cloning one of the defined types (WsfPlatformTypes::Clone) and adding it to the scenario. Other type lists perform similar operations.
What do you want to do next?