WSF
ComputerPart.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#ifndef L16_COMPUTERPART_HPP
12#define L16_COMPUTERPART_HPP
13
14#include "wsf_l16_export.h"
15
16#include <list>
17#include <map>
18
19#include "IntervalUpdater.hpp"
20#include "SlotParameters.hpp"
21class UtCallback;
22#include "UtCallbackHolder.hpp"
23#include "UtInput.hpp"
24class UtScript;
25class UtScriptClass;
26class WsfCommandChain;
27#include "WsfObject.hpp"
28class WsfPlatform;
30class WsfScenario;
31
32namespace wsf
33{
34namespace comm
35{
36class Comm;
37}
38} // namespace wsf
39
40namespace WsfL16
41{
42class ComputerPart;
44namespace Messages
45{
46class InitialBase;
47}
48
52class WSF_L16_EXPORT ComputerPart : public WsfObject
53{
54public:
55 ComputerPart(WsfScenario& aScenario, const std::string& aClassName = "WsfProcessor");
56 ComputerPart(const ComputerPart& aSrc);
57 ~ComputerPart() override;
58
59 ComputerPart* Clone() const override = 0;
60
61 virtual bool Initialize(double aSimTime, ComputerProcessor& aComputer);
62
64 virtual void HandleReceive(double aSimTime, const Messages::InitialBase& aMessage) = 0;
65
67 virtual void HandleSend(double /*aSimTime*/) {}
68
69 void SendJMessage(double aSimTime, Messages::InitialBase* aMessage);
70
71 bool ProcessInput(UtInput& aInput) override;
72 virtual bool IsNetworkEnabled() { return false; }
73
74 void SetDebug(bool aDebugOn) { mDebug = aDebugOn; }
75 bool Debug() { return mDebug; }
76
77 void SetPlatform(WsfPlatform* aPlatformPtr);
78
79 WsfCommandChain* GetCommandChain() const { return mCommandChainPtr; }
80
81 ComputerProcessor* GetComputer() { return mComputer; }
82
83 WsfPlatform* GetPlatform() { return mPlatformPtr; }
84 WsfSimulation* GetSimulation();
85
87
88 int DebugMore() { return mDebugMore; }
89
90 void SetSendInterval(double aValue) { mSendInterval.SetUpdateInterval(aValue); }
91
92protected:
93 double ProcessSendInterval(UtInput& aInput) const;
94
95protected:
98 UtCallbackHolder mCallbacks;
100
101 double GetSendInterval() { return mSendInterval.GetUpdateInterval(); }
102
104
106 {
107 UtScript* mScript;
108 UtScriptClass* mMessageScriptClass;
109 };
110
111 typedef std::map<int, ScriptData> ScriptMap;
113
114private:
115 ComputerProcessor* mComputer;
116 wsf::comm::Comm* mCommPtr;
117 WsfStringId mCommandChainId;
118 WsfCommandChain* mCommandChainPtr;
119 UtCallback* mCallbackPtr;
120 WsfPlatform* mPlatformPtr;
121 bool mDebug;
122};
123} // namespace WsfL16
124
125#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition WsfCommandChain.hpp:36
Definition ComputerPart.hpp:53
ComputerProcessor * GetComputer()
Definition ComputerPart.hpp:81
int mDebugMore
Definition ComputerPart.hpp:97
UtCallbackHolder mCallbacks
Definition ComputerPart.hpp:98
ComputerPart(WsfScenario &aScenario, const std::string &aClassName="WsfProcessor")
Definition ComputerPart.cpp:41
SlotParameters mSlotParameters
Definition ComputerPart.hpp:99
bool Debug()
Definition ComputerPart.hpp:75
std::map< int, ScriptData > ScriptMap
Definition ComputerPart.hpp:111
void SetDebug(bool aDebugOn)
Definition ComputerPart.hpp:74
WsfCommandChain * GetCommandChain() const
Definition ComputerPart.hpp:79
virtual bool IsNetworkEnabled()
Definition ComputerPart.hpp:72
void SetSendInterval(double aValue)
Definition ComputerPart.hpp:90
ComputerPart * Clone() const override=0
virtual void HandleSend(double)
This method is called when the a slot is open.
Definition ComputerPart.hpp:67
WsfScriptContext * mContextPtr
Definition ComputerPart.hpp:103
double GetSendInterval()
Definition ComputerPart.hpp:101
int DebugMore()
Definition ComputerPart.hpp:88
virtual void HandleReceive(double aSimTime, const Messages::InitialBase &aMessage)=0
Handle an incoming message.
const SlotParameters & GetSlotParameters() const
Definition ComputerPart.hpp:86
virtual bool Initialize(double aSimTime, ComputerProcessor &aComputer)
Definition ComputerPart.cpp:69
ScriptMap mSendScripts
Definition ComputerPart.hpp:112
IntervalUpdater mSendInterval
Definition ComputerPart.hpp:96
WsfPlatform * GetPlatform()
Definition ComputerPart.hpp:83
Sends and receives link16 messages.
Definition ComputerProcessor.hpp:50
Definition IntervalUpdater.hpp:30
Definition Messages.hpp:85
Definition SlotParameters.hpp:20
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfScriptContext.hpp:71
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfComm.hpp:43
Definition ComputerPart.hpp:45
This file should be included prior to defining a message. Currently there is a limit of 32 fields per...
Definition AllMessages.hpp:55
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition ComputerPart.hpp:106
UtScriptClass * mMessageScriptClass
Definition ComputerPart.hpp:108
UtScript * mScript
Definition ComputerPart.hpp:107
Copyrights Multiple, All Rights Reserved