WSF
WsfCommMediumGuided.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 2019 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 WSFCOMMMEDIUMGUIDED_HPP
13#define WSFCOMMMEDIUMGUIDED_HPP
14
15#include "wsf_export.h"
16
17#include "UtMath.hpp"
18#include "WsfCommMedium.hpp"
21#include "WsfRandomVariable.hpp"
22
23namespace wsf
24{
25namespace comm
26{
27namespace medium
28{
29
32{
33public:
34 ModeGuided() = default;
35 ModeGuided(const std::string& aName)
36 : Mode(aName)
37 {
38 }
39 ~ModeGuided() override = default;
40 ModeGuided(const ModeGuided& aSrc) = default;
41 ModeGuided* Clone() const override { return new ModeGuided(*this); }
42
43 const char* GetScriptClassName() const override { return "WsfCommMediumModeGuided"; }
44
45 bool ProcessInput(UtInput& aInput) override;
46 double GetTransmissionTime(double aSimTime, Comm& aXmtr, Layer* aLayerPtr, Message& aMessage) override;
47 double GetPropagationTime(double aSimTime, Comm& aXmtr, Comm& aRcvr, Message& aMessage) override;
48 double GetPacketLossTime(double aSimTime, Message& aMessage) override;
49
50 WsfRandomVariable& GetPropagationSpeed() { return mPropagationSpeed; }
51 WsfRandomVariable& GetTransferRate() { return mTransferRate; }
52 WsfRandomVariable& GetDelayTime() { return mDelayTime; }
53
54private:
55 WsfRandomVariable mPropagationSpeed{UtMath::cLIGHT_SPEED, WsfRandomVariable::cNON_NEGATIVE};
58};
59
62{
63public:
64 ScriptMediumModeGuidedClass(const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
65
66 ~ScriptMediumModeGuidedClass() override = default;
67
68 UT_DECLARE_SCRIPT_METHOD(GetPropagationSpeed);
69 UT_DECLARE_SCRIPT_METHOD(GetTransferRate);
70 UT_DECLARE_SCRIPT_METHOD(GetPacketLossTime);
71};
72
78class WSF_EXPORT Guided : public Medium
79{
80public:
81 static void RegisterFactory(Types& aTypes);
82
83 Guided(WsfScenario& aScenario);
84 ~Guided() override = default;
85
86 const char* GetScriptClassName() const override { return "WsfCommMediumGuided"; }
88 Guided* Clone() const override;
89 bool ProcessInput(UtInput& aInput) override;
90
91 std::unique_ptr<Mode> CreateDefaultMode() const override { return ut::make_unique<ModeGuided>(); }
92
93 TransmissionResult TransmitMessage(double aSimTime, Layer* aLayerPtr, Message& aMessage, Comm& aXmtr) override;
94
95 void EndTransmission(double aSimTime, const Message::Identifier& aIdentifier) final;
96
97 virtual void EndTransmission(double aSimTime, MessageStatus& aMessageStatus, const Message::Identifier& aIdentifier);
98
99 void PropagateMessage(double aSimTime, const Message::Identifier& aIdentifier) final;
100
101 void PropagateMessage(double aSimTime, MessageStatus& aMessageStatus, const Message::Identifier& aIdentifier);
102
103 void EndPropagation(double aSimTime, const Message::Identifier& aIdentifier) final;
104
105 virtual void EndPropagation(double aSimTime, MessageStatus& aMessageStatus, const Message::Identifier& aIdentifier);
106};
107
109
110} // namespace medium
111} // namespace comm
112} // namespace wsf
113
114#endif
#define WSF_COMM_MEDIUM_DECLARE_ROLE_TYPE(TYPE, ROLE)
Definition WsfCommMediumTypeIdentifier.hpp:34
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfRandomVariable.hpp:33
@ cPOSITIVE
Value must be greater than zero.
Definition WsfRandomVariable.hpp:49
@ cNON_NEGATIVE
Value must be greater than or equal to zero.
Definition WsfRandomVariable.hpp:50
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfComm.hpp:43
Definition WsfCommLayer.hpp:40
Definition WsfCommMessage.hpp:95
Definition WsfCommMessage.hpp:51
Definition WsfCommMediumGuided.hpp:79
Guided(WsfScenario &aScenario)
Definition WsfCommMediumGuided.cpp:191
static void RegisterFactory(Types &aTypes)
Definition WsfCommMediumGuided.cpp:199
std::unique_ptr< Mode > CreateDefaultMode() const override
Definition WsfCommMediumGuided.hpp:91
TypeIdentifier GetMediumIdentifier() const override
Definition WsfCommMediumGuided.hpp:87
~Guided() override=default
const char * GetScriptClassName() const override
Definition WsfCommMediumGuided.hpp:86
Medium(WsfScenario &aScenario)
Definition WsfCommMedium.cpp:52
Definition WsfCommMediumMessageStatus.hpp:35
WsfRandomVariable & GetPropagationSpeed()
Definition WsfCommMediumGuided.hpp:50
WsfRandomVariable & GetDelayTime()
Definition WsfCommMediumGuided.hpp:52
const char * GetScriptClassName() const override
Definition WsfCommMediumGuided.hpp:43
~ModeGuided() override=default
ModeGuided(const std::string &aName)
Definition WsfCommMediumGuided.hpp:35
ModeGuided * Clone() const override
Definition WsfCommMediumGuided.hpp:41
WsfRandomVariable & GetTransferRate()
Definition WsfCommMediumGuided.hpp:51
ModeGuided(const ModeGuided &aSrc)=default
ScriptMediumModeClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfCommMedium.cpp:34
ScriptMediumModeGuidedClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfCommMediumGuided.cpp:159
Definition WsfCommMediumTypes.hpp:40
Definition WsfCommMedium.cpp:31
TypeIdentifier
Definition WsfCommMediumTypeIdentifier.hpp:50
@ cGUIDED
Definition WsfCommMediumTypeIdentifier.hpp:52
TransmissionResult
Definition WsfCommMedium.hpp:48
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved