VR-Forces 4.7 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
examples
addSimComponent
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/simComponent.h
"
16
17
class
DtTimeKeeperPSR
;
18
class
DtTimeKeeperDescriptor
;
19
20
//String which uniquely identifies this controller
21
const
char
TimeKeeperComponentType
[] =
"time-keeper-component"
;
22
23
class
DtTimeKeeperComponent
:
public
DtSimComponent
24
{
25
public
:
26
//constructor
27
DtTimeKeeperComponent
(
const
DtString
&
name
,
DtVrfObject
* owner,
28
DtSimManager
*
simManager
,
DtComponentDescriptor
* desc = NULL,
29
DtReaderWriterRegistry
* parentRegistry = 0);
30
31
//destructor
32
virtual
~DtTimeKeeperComponent
();
33
34
//copy constructor
35
DtTimeKeeperComponent
(
const
DtTimeKeeperComponent
& orig);
36
37
//assignment operator
38
DtTimeKeeperComponent
&
operator=
(
const
DtTimeKeeperComponent
& orig);
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
63
DtTimeKeeperDescriptor
*
myDescriptor
;
64
65
//This is the pointer to our process state repository used during
66
//the execution of the simulation.
67
DtTimeKeeperPSR
*
myProcessState
;
68
};
69
Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (
www.mak.com
)