VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
timeKeeperCmpt.h
Go to the documentation of this file.
1 /********************************************************************************* Copyright (c) 2004 MAK Technologies, Inc.
2 ** All rights reserved.
3 *******************************************************************************//********************************************************************************* $RCSfile: timeKeeperCmpt.h,v $ $Revision: 1.3 $ $State: Exp $
4 *******************************************************************************/
5 
6 //
7 //class DtTimeKeeperComponent
8 //
9 //This is a component which simply keeps track of the elapsed simulation time
10 //since the component was created. It illustrates the creation and use of
11 //a process state repository to save the simulation time since creation
12 //into a checkpointed scenario file, and read it back in at load time.
13 //
14 
16 
17 class DtTimeKeeperPSR;
19 
20 //String which uniquely identifies this controller
21 const char TimeKeeperComponentType[] = "time-keeper-component";
22 
24 {
25 public:
26  //constructor
29  DtReaderWriterRegistry * parentRegistry = 0);
30 
31  //destructor
32  virtual ~DtTimeKeeperComponent();
33 
34  //copy constructor
36 
37  //assignment operator
39 
40  //Returns the string type for this component.
41  virtual const char* type() const;
42 
43  //Overridden from the base class to call createPSR().
44  virtual bool init();
45 
46  //Create a time-keeper process state repository, or a different
47  //type if it is specified in the OPD.
48  virtual bool createPSR();
49 
50  //Update control values
51  //For this controller, we simply add dT() to our elapsed time
52  //state variable, and print out the value every 10 seconds of
53  //simulation time.
54  virtual void tick();
55 
56  //This is called by the factory
57  static DtSimComponent* creator(const DtString & name, DtVrfObject* owner,
58  DtSimManager * simManager, DtComponentDescriptor* desc,
59  DtReaderWriterRegistry * parentRegistry);
60 
61 protected:
62  //This is the pointer to the custom descriptor
64 
65  //This is the pointer to our process state repository used during
66  //the execution of the simulation.
68 };
69 
virtual void tick()
This gives the thread of control to the component.
DtVrfObject is used to represent any type of simulated object (entities, aggregate, control objects) in a VR-Forces application.
Definition: vrfObject.h:215
virtual bool createPSR()
DtSimManager * simManager()
Gets the sim manager.
Definition: simComponent.h:410
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:42
Definition: readerWriterRegistry.h:39
Definition: timeKeeperCmpt.h:23
const char TimeKeeperComponentType[]
Definition: timeKeeperCmpt.h:21
Definition: timeKeeperDescriptor.h:16
virtual bool init()
Calls createPorts and createPortGroups Initializes myLastTickSimTime.
DtTimeKeeperDescriptor * myDescriptor
Definition: timeKeeperCmpt.h:63
static DtSimComponent * creator(const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry)
DtTimeKeeperComponent(const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=NULL, DtReaderWriterRegistry *parentRegistry=0)
virtual const char * type() const
Returns a string identifies the class type of component.
DtTimeKeeperComponent & operator=(const DtTimeKeeperComponent &orig)
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:67
The simulation engine is controlled by a single,top-level class called the Simulation Manager...
Definition: simManager.h:103
DtTimeKeeperPSR * myProcessState
Definition: timeKeeperCmpt.h:67
virtual ~DtTimeKeeperComponent()
virtual DtSymbolString name() const
Accessor for name of this readable/writable object.
Definition: timeKeeperPSR.h:23

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)