VR-Forces 4.1.1 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
examples
addAttr
addAttrSim
myEsr.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2007 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
/*******************************************************************************
6
** $RCSfile: myEsr.h,v $ $Revision: 1.8 $ $State: Exp $
7
*******************************************************************************/
8
9
#pragma once
10
11
#if DtHLA
12
13
#include <
vrfExtObjects/extEntSR.h
>
14
15
#include <stdio.h>
16
17
//Because this example adds a concept that did not already exist in VR-Link's
18
//DtEntityStateRepository class, we create this subclass of
19
//DtEntityStateRepository that adds the concept of mass.
20
21
class
MyEntityStateRep
:
public
DtExtEntityStateRepository
22
{
23
public
:
24
MyEntityStateRep
()
25
:
DtExtEntityStateRepository
()
26
,
myMass
(0.)
27
{
28
}
29
30
MyEntityStateRep
(
const
MyEntityStateRep
& o)
31
:
DtExtEntityStateRepository
(o)
32
,
myMass
(o.
myMass
)
33
{
34
}
35
36
//Set/Get the value of mass
37
virtual
void
setMass
(
float
mass
);
38
virtual
float
mass
()
const
;
39
40
//Virtual function override: print the state rep's data.
41
virtual
void
printData
()
const
;
42
43
public
:
44
45
//Create a MyEntityStateRep. Caller is reponsible for deletion.
46
static
DtExtEntityStateRepository
*
create
();
47
48
//Copy shallow (false) or deep (true).
49
virtual
DtStateRepository*
clone
(
bool
copy =
false
)
const
;
50
51
protected
:
52
53
float
myMass
;
54
};
55
56
//Inline functions
57
58
inline
void
MyEntityStateRep::setMass
(
float
temp)
59
{
60
myMass
= temp;
61
}
62
63
inline
float
MyEntityStateRep::mass
()
const
64
{
65
return
myMass
;
66
}
67
68
inline
void
MyEntityStateRep::printData
()
const
69
{
70
DtEntityStateRepository::printData
();
71
printf(
"Mass: %lf\n"
,
mass
());
72
}
73
74
inline
DtExtEntityStateRepository
*
MyEntityStateRep::create
()
75
{
76
return
new
MyEntityStateRep
();
77
}
78
79
inline
DtStateRepository*
MyEntityStateRep::clone
(
bool
copy)
const
80
{
81
if
(copy)
82
{
83
return
new
MyEntityStateRep
(*
this
);
84
}
85
else
86
{
87
return
new
MyEntityStateRep
();
88
}
89
}
90
91
#endif
Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)