WSF
WsfCommSlotGroupLayerJTIDS.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 WSFCOMMSLOTGROUPLAYERJTIDS_HPP
13#define WSFCOMMSLOTGROUPLAYERJTIDS_HPP
14
15#include <map>
16#include <vector>
17
18#include "UtCallback.hpp"
19#include "UtCallbackHolder.hpp"
20#include "WsfStringId.hpp"
21
22class WsfCommandChain;
23class WsfMessage;
25
26// Base class
27#include "WsfCommLayer.hpp"
28
29namespace wsf
30{
31namespace comm
32{
33
35{
36public:
37 // Constructor and destructor
39 ~SlotGroupLayerJTIDS() override;
40
42
43 wsf::comm::LayerImp* Clone() const override;
44 bool Initialize(double aSimTime) override;
45 bool ProcessInput(UtInput& aInput) override;
47
49
50 bool Receive(double aSimTime, Comm* aXmtrPtr, Message& aMessage, bool& aNotifyNextLayer) override;
51 bool Send(double aSimTime, size_t aLayerIndex, Message& aMessage, bool& aNotifyNextLayer) override;
53
55
56 bool ProcessLayerMessage(double aSimTime, layer::Message aMessage, Message* aCommMessagePtr) override;
58
59 void TurnOff(double aSimTime);
60
62
64 int GetBitsPerSlot() const { return mBitsPerSlot; }
65
67 double GetSecondsPerSlot() const { return mSecondsPerSlot; }
68
70 int GetSetsPerFrame() const { return mSetsPerFrame; }
71
73 int GetSlotsPerFrame() const { return mSlotsPerSet * mSetsPerFrame; }
74
76 int GetSlotsPerSet() const { return mSlotsPerSet; }
77
79
80 UtCallbackListN<void(double, const WsfMessage*, int, WsfJTIDS_SlotGroup*)> MessageSent;
82
83protected:
84 // Copy constructor
86
87private:
89 SlotGroupLayerJTIDS& operator=(const SlotGroupLayerJTIDS& aRhs) = delete;
90
91 bool InitializeSendRequest(double aSimTime, const WsfStringId& aCmdChainId, WsfJTIDS_SlotGroup*& aGroupPtr);
92
93 void HandleMessageSent(double aSimTime, const WsfMessage* aMessagePtr, int aSlotNumber, WsfJTIDS_SlotGroup* aSlotGroup);
94
95 // The amount of time in one time slot
96 double mSecondsPerSlot;
97
98 // The number of bits in one time slot at the standard packing density
99 int mBitsPerSlot;
100
101 // The number of interleaved sets (this must divide evenly in to the number of slots per frame)
102 int mSetsPerFrame;
103
104 // The number of slots per set */
105 int mSlotsPerSet;
106
107 // The time at which this terminal last received a message.
108 // (Used to implement time slot reuse)
109 double mLastReceiveTime;
110
111 std::vector<WsfJTIDS_SlotGroup*> mSlotGroups;
112 std::map<WsfStringId, WsfStringId> mCmdChainToGroup;
113
114 UtCallbackHolder mCallbacks;
115};
116
117
118} // namespace comm
119} // namespace wsf
120
121#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
Definition WsfCommandChain.hpp:36
Definition WsfJTIDS_SlotGroup.hpp:48
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Definition WsfComm.hpp:43
A base class defining the interface for the implementation classes. (Implementor).
Definition WsfCommLayer.hpp:127
Definition WsfCommMessage.hpp:51
bool Receive(double aSimTime, Comm *aXmtrPtr, Message &aMessage, bool &aNotifyNextLayer) override
Definition WsfCommSlotGroupLayerJTIDS.cpp:191
int GetSlotsPerFrame() const
Return the number of slots in a frame (slots/set * sets/frame).
Definition WsfCommSlotGroupLayerJTIDS.hpp:73
double GetSecondsPerSlot() const
Return the number of seconds in a slot.
Definition WsfCommSlotGroupLayerJTIDS.hpp:67
~SlotGroupLayerJTIDS() override
Definition WsfCommSlotGroupLayerJTIDS.cpp:45
int GetSlotsPerSet() const
Return the number of slots per set.
Definition WsfCommSlotGroupLayerJTIDS.hpp:76
int GetSetsPerFrame() const
Return the number of sets per frame.
Definition WsfCommSlotGroupLayerJTIDS.hpp:70
void TurnOff(double aSimTime)
Definition WsfCommSlotGroupLayerJTIDS.cpp:264
bool ProcessInput(UtInput &aInput) override
Definition WsfCommSlotGroupLayerJTIDS.cpp:89
bool ProcessLayerMessage(double aSimTime, layer::Message aMessage, Message *aCommMessagePtr) override
Process a layer event.
Definition WsfCommSlotGroupLayerJTIDS.cpp:256
bool Send(double aSimTime, size_t aLayerIndex, Message &aMessage, bool &aNotifyNextLayer) override
Definition WsfCommSlotGroupLayerJTIDS.cpp:221
bool Initialize(double aSimTime) override
Definition WsfCommSlotGroupLayerJTIDS.cpp:61
UtCallbackListN< void(double, const WsfMessage *, int, WsfJTIDS_SlotGroup *)> MessageSent
Definition WsfCommSlotGroupLayerJTIDS.hpp:80
WsfJTIDS_SlotGroup * FindGroup(WsfStringId aGroupId)
Definition WsfCommSlotGroupLayerJTIDS.cpp:276
int GetBitsPerSlot() const
Return the number of bits per slot at standard packing.
Definition WsfCommSlotGroupLayerJTIDS.hpp:64
SlotGroupLayerJTIDS()
Definition WsfCommSlotGroupLayerJTIDS.cpp:33
wsf::comm::LayerImp * Clone() const override
Definition WsfCommSlotGroupLayerJTIDS.cpp:55
Definition WsfCommLayerMessage.hpp:36
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