VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
timeKeeperCmpt.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2011 MAK Technologies, Inc.
3 ** All rights reserved.
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 #pragma once
15 
17 
18 class DtTimeKeeperPSR;
20 
21 //String which uniquely identifies this controller
22 const char TimeKeeperComponentType[] = "time-keeper-component";
23 
25 {
26 public:
27  //constructor
30  DtReaderWriterRegistry * parentRegistry = 0);
31 
32  //destructor
33  virtual ~DtTimeKeeperComponent();
34 
35  //copy constructor
37 
38  //assignment operator
40 
41  //Returns the string type for this component.
42  virtual const char* type() const;
43 
44  //Overridden from the base class to call createPSR().
45  virtual bool init();
46 
47  //Create a time-keeper process state repository, or a different
48  //type if it is specified in the OPD.
49  virtual bool createPSR();
50 
51  //Update control values
52  //For this controller, we simply add dT() to our elapsed time
53  //state variable, and print out the value every 10 seconds of
54  //simulation time.
55  virtual void tick();
56 
57  //This is called by the factory
58  static DtSimComponent* creator(const DtString & name, DtLocalObject* owner,
59  DtSimulationServices * simManager, DtComponentDescriptor* desc,
60  DtReaderWriterRegistry * parentRegistry);
61 
62 protected:
63  //This is the pointer to the custom descriptor
65 
66  //This is the pointer to our process state repository used during
67  //the execution of the simulation.
69 };
70 
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
virtual bool createPSR()
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
Definition: readerWriterRegistry.h:39
Definition: timeKeeperCmpt.h:24
const char TimeKeeperComponentType[]
Definition: timeKeeperCmpt.h:22
Definition: timeKeeperDescriptor.h:16
virtual bool init()
Calls createPorts and createPortGroups Initializes myLastTickSimTime.
DtTimeKeeperDescriptor * myDescriptor
Definition: timeKeeperCmpt.h:64
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry)
DtTimeKeeperComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=NULL, DtReaderWriterRegistry *parentRegistry=0)
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtTimeKeeperComponent & operator=(const DtTimeKeeperComponent &orig)
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
VRF4API_METHOD const DtSimulationServices * simManager() const
This is the deprecated API that can be used as a reference to migrate 4.X code to 5...
Definition: simComponent.h:566
Contains the DtSimComponent class declaration.
DtTimeKeeperPSR * myProcessState
Definition: timeKeeperCmpt.h:68
virtual ~DtTimeKeeperComponent()
virtual DtSymbolString name() const
Accessor for name of this readable/writable object.
Definition: timeKeeperPSR.h:19
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)