WSF
WsfCommProtocolInterface.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2018 Infoscitex, a DCS 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#ifndef WSFCOMMPROTOCOLINTERFACE_HPP
13#define WSFCOMMPROTOCOLINTERFACE_HPP
14
15#include "wsf_export.h"
16
17#include "UtScriptTypes.hpp"
18#include "WsfCommComponent.hpp"
20#include "WsfObject.hpp"
22
23namespace wsf
24{
25namespace comm
26{
27
37{
38public:
39 using ProcessResult = std::pair<bool, bool>;
40
41 ProtocolInterface() = default;
42 ~ProtocolInterface() override = default;
43 const char* GetScriptClassName() const override { return "WsfCommProtocol"; }
44
46
47 WsfComponent* CloneComponent() const override = 0;
48 WsfStringId GetComponentName() const final { return GetNameId(); }
49 const int* GetComponentRoles() const override = 0;
50 void* QueryInterface(int aRole) override = 0;
52
54
55 ProtocolInterface* Clone() const override = 0;
57
59
60 bool Initialize(double aSimTime) override { return true; }
61 bool ProcessInput(UtInput& aInput) override { return false; }
63
65
66 bool operator<(const ProtocolInterface& aRhs) const { return GetPriority() < aRhs.GetPriority(); }
68
73 virtual ProtocolPriority GetPriority() const = 0;
74
95
96
98 virtual ProcessResult ApplicationSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
99 {
100 return std::make_pair(false, true);
101 }
102 virtual ProcessResult ApplicationReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
103 {
104 return std::make_pair(false, true);
105 }
106
107
108 virtual ProcessResult PresentationSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
109 {
110 return std::make_pair(false, true);
111 }
112 virtual ProcessResult PresentationReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
113 {
114 return std::make_pair(false, true);
115 }
116
117
118 virtual ProcessResult SessionSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
119 {
120 return std::make_pair(false, true);
121 }
122 virtual ProcessResult SessionReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
123 {
124 return std::make_pair(false, true);
125 }
126
127
128 virtual ProcessResult TransportSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
129 {
130 return std::make_pair(false, true);
131 }
132 virtual ProcessResult TransportReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
133 {
134 return std::make_pair(false, true);
135 }
136
137
138 virtual ProcessResult NetworkSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
139 {
140 return std::make_pair(false, true);
141 }
142 virtual ProcessResult NetworkReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
143 {
144 return std::make_pair(false, true);
145 }
146
147
148 virtual ProcessResult DatalinkSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
149 {
150 return std::make_pair(false, true);
151 }
152 virtual ProcessResult DatalinkReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
153 {
154 return std::make_pair(false, true);
155 }
156
157
158 virtual ProcessResult PhysicalSend(double aSimTime, size_t aLayerIndex, Message& aMessage)
159 {
160 return std::make_pair(false, true);
161 }
162 virtual ProcessResult PhysicalReceive(double aSimTime, size_t aLayerIndex, Message& aMessage)
163 {
164 return std::make_pair(false, true);
165 }
166
167
168};
169
171class WSF_EXPORT ScriptProtocolClass : public UtScriptClass
172{
173public:
174 ScriptProtocolClass(const std::string& aClassName, UtScriptTypes* aTypesPtr);
175
176 ~ScriptProtocolClass() override = default;
177};
178
179} // namespace comm
180} // namespace wsf
181
183
184#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_COMM_PROTOCOL
Definition WsfComponentRoles.hpp:121
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponent.hpp:39
WsfStringId GetNameId() const
Definition WsfObject.hpp:66
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
Definition WsfCommMessage.hpp:51
Definition WsfCommProtocolInterface.hpp:37
ProtocolInterface * Clone() const override=0
virtual ProcessResult NetworkReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:142
virtual ProcessResult SessionSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:118
virtual ProcessResult ApplicationSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:98
const int * GetComponentRoles() const override=0
virtual ProcessResult DatalinkSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:148
~ProtocolInterface() override=default
virtual ProcessResult NetworkSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:138
bool operator<(const ProtocolInterface &aRhs) const
Definition WsfCommProtocolInterface.hpp:66
bool ProcessInput(UtInput &aInput) override
Definition WsfCommProtocolInterface.hpp:61
virtual ProcessResult PresentationSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:108
virtual ProcessResult DatalinkReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:152
virtual ProtocolPriority GetPriority() const =0
WsfStringId GetComponentName() const final
Definition WsfCommProtocolInterface.hpp:48
virtual ProcessResult ApplicationReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:102
virtual ProcessResult TransportSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:128
virtual ProcessResult SessionReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:122
virtual ProcessResult PhysicalReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:162
virtual ProcessResult PhysicalSend(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:158
virtual ProcessResult TransportReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:132
const char * GetScriptClassName() const override
Definition WsfCommProtocolInterface.hpp:43
std::pair< bool, bool > ProcessResult
Definition WsfCommProtocolInterface.hpp:39
void * QueryInterface(int aRole) override=0
bool Initialize(double aSimTime) override
Definition WsfCommProtocolInterface.hpp:60
virtual ProcessResult PresentationReceive(double aSimTime, size_t aLayerIndex, Message &aMessage)
Definition WsfCommProtocolInterface.hpp:112
WsfComponent * CloneComponent() const override=0
ScriptProtocolClass(const std::string &aClassName, UtScriptTypes *aTypesPtr)
Definition WsfCommProtocolInterface.cpp:20
~ScriptProtocolClass() override=default
Definition WsfComm.cpp:34
ProtocolPriority
Definition WsfCommProtocolPriority.hpp:25
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved