VR-Forces Development_Version Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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/simComponent.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
const
char
*
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 Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (
www.mak.com
)