VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
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 
22 {
23 public:
26  , myMass(0.)
27  {
28  }
29 
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.
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 {
71  printf("Mass: %lf\n", mass());
72 }
73 
75 {
76  return new MyEntityStateRep();
77 }
78 
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 Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)