VR-Forces 4.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
examples
addPSR
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
15
#include "
vrfobjcore/simCmpnt.h
"
16
17
class
DtTimeKeeperPSR
;
18
19
//String which uniquely identifies this controller
20
const
char
TimeKeeperComponentType
[] =
"time-keeper-component"
;
21
22
class
DtTimeKeeperComponent
:
public
DtSimComponent
23
{
24
public
:
25
//constructor
26
DtTimeKeeperComponent
(
const
DtString
&
name
,
DtVrfObject
* owner,
27
DtSimManager
*
simManager
,
DtComponentDescriptor
* desc = NULL,
28
DtReaderWriterRegistry
* parentRegistry = 0);
29
30
//destructor
31
virtual
~DtTimeKeeperComponent
();
32
33
//copy constructor
34
DtTimeKeeperComponent
(
const
DtTimeKeeperComponent
& orig);
35
36
//assignment operator
37
DtTimeKeeperComponent
&
operator=
(
const
DtTimeKeeperComponent
& orig);
38
39
//Returns the string type for this component.
40
virtual
DtString
type
()
const
;
41
42
//Overridden from the base class to call createPSR().
43
virtual
bool
init
();
44
45
//Create a time-keeper process state repository, or a different
46
//type if it is specified in the OPD.
47
virtual
bool
createPSR
();
48
49
//Update control values
50
//For this controller, we simply add dT() to our elapsed time
51
//state variable, and print out the value every 10 seconds of
52
//simulation time.
53
virtual
void
tick
();
54
55
//This is called by the factory
56
static
DtSimComponent
*
creator
(
const
DtString
& name,
DtVrfObject
* owner,
57
DtSimManager
* simManager,
DtComponentDescriptor
* desc,
58
DtReaderWriterRegistry
* parentRegistry);
59
60
protected
:
61
//This is the pointer to our process state repository used during
62
//the execution of the simulation.
63
DtTimeKeeperPSR
*
myProcessState
;
64
};
65
Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (
www.mak.com
)