WSF
Variables.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11// ****************************************************************************
12// Updated by Infoscitex, a DCS Company.
13// ****************************************************************************
14
15#ifndef VARIABLES_HPP
16#define VARIABLES_HPP
17
18#include <string>
19
20#include "UtInput.hpp"
21
22namespace engage
23{
24
25class Simulation;
26
29{
30public:
31 Variables();
32
33 static size_t FindRealVariable(const std::string& aName);
34 static size_t FindIntegerVariable(const std::string& aName);
35 static size_t FindStringVariable(const std::string& aName);
36
37 static double GetScaleFactor(size_t aIndex, const std::string& aUnits);
38
39 static double GetRealValue(size_t aVarIndex, Simulation& aSimulation, size_t aArrayIndex);
40
41 static int GetIntegerValue(size_t aVarIndex, Simulation& aSimulation, size_t aArrayIndex);
42
43 static std::string GetStringValue(size_t aVarIndex, Simulation& aSimulation, size_t aArrayIndex);
44
45private:
46 typedef double (*RealAccessorPtr)(Simulation&, size_t aArrayIndex);
47 typedef int (*IntegerAccessorPtr)(Simulation&, size_t aArrayIndex);
48 typedef std::string (*StringAccessorPtr)(Simulation&, size_t aArrayIndex);
49
50 class Variable
51 {
52 public:
53 std::string mFullName;
54 std::string mESAMS_Name;
55 };
56
57 class RealVariable : public Variable
58 {
59 public:
60 UtInput::ValueType mUnitType;
61 RealAccessorPtr mAccessorPtr;
62 };
63
64 class IntegerVariable : public Variable
65 {
66 public:
67 IntegerAccessorPtr mAccessorPtr;
68 };
69
70 class StringVariable : public Variable
71 {
72 public:
73 StringAccessorPtr mAccessorPtr;
74 };
75
76 void DefineRealVariable(const std::string& aName,
77 const std::string& aESAMS_Name,
78 UtInput::ValueType aUnitType,
79 RealAccessorPtr aAccessorPtr);
80
81 void DefineIntegerVariable(const std::string& aName, const std::string& aESAMS_Name, IntegerAccessorPtr aAccessorPtr);
82
83 void DefineStringVariable(const std::string& aName, const std::string& aESAMS_Name, StringAccessorPtr aAccessorPtr);
84
85 static std::vector<RealVariable> sRealVariables;
86 static std::vector<IntegerVariable> sIntegerVariables;
87 static std::vector<StringVariable> sStringVariables;
88};
89
90} // namespace engage
91
92#endif
Definition Simulation.hpp:34
static std::string GetStringValue(size_t aVarIndex, Simulation &aSimulation, size_t aArrayIndex)
Definition Variables.cpp:396
static double GetScaleFactor(size_t aIndex, const std::string &aUnits)
Definition Variables.cpp:344
Variables()
Definition Variables.cpp:242
static int GetIntegerValue(size_t aVarIndex, Simulation &aSimulation, size_t aArrayIndex)
Definition Variables.cpp:380
static size_t FindRealVariable(const std::string &aName)
Definition Variables.cpp:286
static size_t FindStringVariable(const std::string &aName)
Definition Variables.cpp:324
static size_t FindIntegerVariable(const std::string &aName)
Definition Variables.cpp:305
static double GetRealValue(size_t aVarIndex, Simulation &aSimulation, size_t aArrayIndex)
Definition Variables.cpp:364
Definition ApplicationExtension.cpp:26
Copyrights Multiple, All Rights Reserved