VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
esrWithTemperature.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
8 #if DtHLA
9 
11 #include <stdio.h>
13 #include <vl/entityPublisher.h>
14 #include <vl/reflectedEntityList.h>
15 
16 // Because this example adds a concept that did not already exist in VR-Link's
17 // DtEntityStateRepository class, we create this subclass of that adds the concept of temperature.
18 
20 {
21 public:
24  , myTemperature(0.)
25  {
26  }
27 
31  {
32  }
33 
34  // Set/Get the value of temperature
35  virtual void setTemperature(double temp);
36  virtual double temperature() const;
37 
38  // Virtual function override: print the state rep's data.
39  virtual void printData() const;
40 
41 public:
42 
43  // Create a DtEntityStateRepWithTemperature. Caller is responsible for deletion.
45 
46  // Copy shallow (false) or deep (true).
47  virtual DtStateRepository* clone(bool copy = false) const;
48 
49 protected:
50 
52 };
53 
54 // Inline functions
55 
57 {
58  myTemperature = temp;
59 }
60 
62 {
63  return myTemperature;
64 }
65 
67 {
68  DtEntityStateRepository::printData();
69  printf("Temperature: %lf\n", temperature());
70 }
71 
73 {
75 }
76 
78 {
79  if (copy)
80  {
81  return new DtEntityStateRepWithTemperature(*this);
82  }
83  else
84  {
86  }
87 }
88 
90 {
91 public:
92 
96  {
97  DtWarn << "Constructing" << std::endl;
98  }
99 
102  {
103  DtWarn << "Destructing" << std::endl;
104  }
105 
106 protected:
107 
109  {
110  DtEntityPublisher::setStateRepCreator((DtEntityPublisher::DtStateRepCreator)
112  }
113 
115  {
116  DtReflectedEntity::setStateRepCreator((DtReflectedEntity::DtStateRepCreator)
118  }
119 };
120 
121 #endif
virtual ~DtEntityExtendedAttributesWithTemperatureInitializer()
Destructor.
Definition: esrWithTemperature.h:101
The extended attributes initializer for entity objects.
Definition: extendedAttributesInitializer.h:150
virtual double temperature() const
Definition: esrWithTemperature.h:61
void setReflectedObjectStateRepCreator()
Sets the state rep creator for the associated reflected object. Specific to a particular reflected ob...
Definition: esrWithTemperature.h:114
virtual void printData() const
Print data to the DtInfo stream.
Definition: esrWithTemperature.h:66
DtEntityExtendedAttributesWithTemperatureInitializer()
Constructor.
Definition: esrWithTemperature.h:94
DtEntityStateRepWithTemperature(const DtEntityStateRepWithTemperature &o)
Definition: esrWithTemperature.h:28
Definition: esrWithTemperature.h:19
Definition: esrWithTemperature.h:89
DtExtEntityStateRepository class extends the DtExtEntityBaseStateRepository to be able to handle exte...
Definition: extEntityStateRepository.h:25
float myTemperature
Definition: esrWithTemperature.h:51
static DtExtEntityStateRepository * create()
Definition: esrWithTemperature.h:72
void setPublisherStateRepCreator()
Sets the state rep creator for the associated publisher. Specific to a particular publisher class and...
Definition: esrWithTemperature.h:108
Contains the DtExtEntityStateRepository class.
virtual void setTemperature(double temp)
Definition: esrWithTemperature.h:56
virtual DtStateRepository * clone(bool copy=false) const
Return a copy/empty object of the same type as this.
Definition: esrWithTemperature.h:77
DtEntityStateRepWithTemperature()
Definition: esrWithTemperature.h:22

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)