WSF
ComputerProcessor.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_COMPUTERPROCESSOR_HPP
12#define L16_COMPUTERPROCESSOR_HPP
13
14#include "wsf_l16_export.h"
15
16#include <list>
17#include <map>
18
19#include "DisEntityId.hpp"
20#include "Messages.hpp"
21#include "TrackList.hpp"
22#include "UtCallback.hpp"
23#include "UtCallbackHolder.hpp"
24
25class WsfCommandChain;
28class WsfLocalTrack;
29#include "WsfProcessor.hpp"
30#include "WsfTrackId.hpp"
31
32namespace wsf
33{
34namespace comm
35{
36class Comm;
37class Result;
38} // namespace comm
39} // namespace wsf
40
41namespace WsfL16
42{
43class ComputerPart;
44class JMessage;
46class Interface;
47
50{
51public:
54 ~ComputerProcessor() override;
55
56 typedef std::map<WsfStringId, ComputerPart*> PartMap;
57
58 WsfProcessor* Clone() const override;
59
60 const char* GetScriptClassName() const override;
61
62 bool ProcessInput(UtInput& aInput) override;
63
64 bool Initialize(double aSimTime) override;
65
66 ComputerPart* CreatePart(const std::string& aName, const std::string& aType);
67
68 wsf::comm::Comm* GetComm() { return mCommPtr; }
69 WsfJTIDS_Terminal* GetJTIDS_Comm() { return mUsingJTIDS ? (WsfJTIDS_Terminal*)mCommPtr : nullptr; }
70
74 {
75 DisEntityId mEntityId;
76 unsigned int mTrackNumber;
77 bool mIsC2;
80 std::string mCallsign;
82 };
83
85 /*const*/ Configuration& Config() { return mConfig; }
86
87 unsigned int GetTrackNumber() const { return mConfig.mTrackNumber; }
88
89 // finds the l16 processor and returns the controller track number
90 static WSF_L16_EXPORT unsigned int GetPlatformTrackNumber(WsfPlatform& aPlatform);
91
92 bool ProcessMessage(double aSimTime, const WsfMessage& aMessage) override;
93
94 virtual void ProcessJMessage(double aSimTime, const Messages::InitialBase& aMessage);
95
96 void SentJMessage(double aSimTime, ComputerPart* aPartPtr, JMessage& aMessage, WsfCommandChain* aCommandChainPtr);
97
98 bool DisOutputEnabled() const { return mOutputDis; }
99
100 bool WSF_OutputEnabled() const { return mOutputWSF; }
101
102 TrackList& GetPPLI_List() { return mPPLI_TrackList; }
103
104 const PartMap& GetParts() { return mParts; }
105
107
108 static void RegisterType(UtScriptTypes& aTypes);
109
110 bool GetTrackNumber(const WsfLocalTrack& aLocalTrack, int& aTrackNumber);
111
112 void ClearTrackNumber(const WsfLocalTrack& aLocalTrack);
113
114 void SetTrackNumber(WsfLocalTrack& aLocalTrack, int aTrackNumber, int aSourceTrackNumber);
115
116 Interface* GetInterface() const { return mInterfacePtr; }
117 // static void AddPartType(const std::string& aType,
118 // ComputerPart* aPartPtr);
119private:
120 void ProcessMessageP(double aSimTime,
121 wsf::comm::Comm* aXmtrCommPtr,
122 wsf::comm::Comm* aReceiverCommPtr,
123 const WsfMessage& aMessage,
124 wsf::comm::Result& aResult);
125
126 // static void InitializePartTypes();
127 void HandleMessageSent(double aSimTime, const WsfMessage* aMessagePtr, int aSlotNumber, WsfJTIDS_SlotGroup* aSlotGroup);
128
129 void HandlePPLI_Message(double aSimTime, const Messages::InitialBase& aMessage);
130
131 void FillPPLI_Track(double aSimTime, WsfTrack& aTrack, const Messages::InitialBase& aPPLI);
132
133 void HandleTrackMessage(double aSimTime, const Messages::InitialBase& aMessage);
134
135 void FillSurvTrack(double aSimTime, WsfTrack& aTrack, const class TrackMessageProxy& aTrackMsg);
136
137 bool IsJ11_1_Valid(const Messages::InitialBase* aMessage);
138
139 void LoadPart(UtInput& aInput, ComputerPart* aProcessor);
140
141 bool MessageShouldBeSent(const Messages::InitialBase* aMessage);
142
143 void SetTrackColorFromIFF(WsfTrack* aTrackPtr, int aIFF);
144
145 void SetPlatform(WsfPlatform* aPlatformPtr) override;
146
147
148 Configuration mConfig;
149 PartMap mParts;
150 wsf::comm::Comm* mCommPtr;
151 WsfStringId mCommNameId;
152 bool mOutputDis;
153 bool mOutputWSF;
154 bool mUsingJTIDS;
155 bool mIgnoreSurveillanceTracks;
156 UtCallbackHolder mCallbacks;
157 TrackList mPPLI_TrackList;
158 TrackList mSurvTrackList;
159 SurveillancePart* mSurvPart;
160
161 std::map<WsfTrackId, int> mTrackNumberMapping;
162 std::map<int, WsfStringId> mIFF_ColorMap;
163 Interface* mInterfacePtr;
164 // static PartMap mBasePartTypes;
165};
166
167} // namespace WsfL16
168
169#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition Configuration.hpp:26
Definition WsfCommandChain.hpp:36
Definition WsfJTIDS_SlotGroup.hpp:48
A specialization of WsfComm representing a JTIDS terminal.
Definition WsfJTIDS_Terminal.hpp:63
Definition ComputerPart.hpp:53
std::map< WsfStringId, ComputerPart * > PartMap
Definition ComputerProcessor.hpp:56
bool ProcessMessage(double aSimTime, const WsfMessage &aMessage) override
Definition ComputerProcessor.cpp:380
ComputerPart * FindPart(WsfStringId aNameId)
Definition ComputerProcessor.cpp:798
void SentJMessage(double aSimTime, ComputerPart *aPartPtr, JMessage &aMessage, WsfCommandChain *aCommandChainPtr)
Definition ComputerProcessor.cpp:339
void SetTrackNumber(WsfLocalTrack &aLocalTrack, int aTrackNumber, int aSourceTrackNumber)
Definition ComputerProcessor.cpp:819
bool WSF_OutputEnabled() const
Definition ComputerProcessor.hpp:100
WsfJTIDS_Terminal * GetJTIDS_Comm()
Definition ComputerProcessor.hpp:69
~ComputerProcessor() override
Definition ComputerProcessor.cpp:113
const PartMap & GetParts()
Definition ComputerProcessor.hpp:104
Interface * GetInterface() const
Definition ComputerProcessor.hpp:116
TrackList & GetPPLI_List()
Definition ComputerProcessor.hpp:102
virtual void ProcessJMessage(double aSimTime, const Messages::InitialBase &aMessage)
Definition ComputerProcessor.cpp:393
unsigned int GetTrackNumber() const
Definition ComputerProcessor.hpp:87
wsf::comm::Comm * GetComm()
Definition ComputerProcessor.hpp:68
static void RegisterType(UtScriptTypes &aTypes)
Definition ComputerProcessor.cpp:886
const char * GetScriptClassName() const override
Definition ComputerProcessor.cpp:842
bool Initialize(double aSimTime) override
Definition ComputerProcessor.cpp:138
ComputerPart * CreatePart(const std::string &aName, const std::string &aType)
Definition ComputerProcessor.cpp:123
static WSF_L16_EXPORT unsigned int GetPlatformTrackNumber(WsfPlatform &aPlatform)
Definition ComputerProcessor.cpp:352
WsfProcessor * Clone() const override
Definition ComputerProcessor.cpp:72
bool ProcessInput(UtInput &aInput) override
Definition ComputerProcessor.cpp:202
bool DisOutputEnabled() const
Definition ComputerProcessor.hpp:98
void ClearTrackNumber(const WsfLocalTrack &aLocalTrack)
Definition ComputerProcessor.cpp:833
ComputerProcessor(WsfScenario &aScenario)
Definition ComputerProcessor.cpp:77
Configuration & Config()
Returns a reference to the Computer's configuration.
Definition ComputerProcessor.hpp:85
Definition Interface.hpp:116
Definition JMessage.hpp:24
SurveillancePart is responsible for sending tracks.
Definition SurveillancePart.hpp:33
Definition TrackList.hpp:38
Definition TrackMessageProxy.hpp:27
Definition WsfLocalTrack.hpp:32
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
WsfProcessor(const WsfScenario &aScenario)
Definition WsfProcessor.cpp:25
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfComm.hpp:43
Definition WsfCommResult.hpp:34
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 ComputerProcessor.hpp:74
DisEntityId mEntityId
Definition ComputerProcessor.hpp:75
int mSpecificTypeID
Definition ComputerProcessor.hpp:81
std::string mCallsign
Definition ComputerProcessor.hpp:80
bool mIsC2
Definition ComputerProcessor.hpp:77
unsigned int mTrackNumber
Definition ComputerProcessor.hpp:76
bool mIsSimulated
Definition ComputerProcessor.hpp:78
bool mIndirectSender
Definition ComputerProcessor.hpp:79
Copyrights Multiple, All Rights Reserved