WSF
WsfInternalLinks.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 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
12#ifndef WSFINTERNALLINKS_HPP
13#define WSFINTERNALLINKS_HPP
14
15#include "wsf_export.h"
16
17#include <cassert>
18#include <vector>
19
20class UtInput;
21class WsfMessage;
22class WsfPlatformPart;
23#include "WsfStringId.hpp"
24
30{
31public:
36
42 bool HasLinks() const { return mHasLinks; }
43
44 bool Initialize(double aSimTime, WsfPlatformPart* aPlatformPartPtr);
45
46 bool ProcessInput(UtInput& aInput);
47
48 void AddRecipient(WsfStringId aRecipientId);
49 bool AddRecipient(WsfPlatformPart* aRecipientPtr);
50
51 bool SetStatus(WsfStringId aRecipientId, bool aActive);
52 bool RemoveLink(WsfStringId aRecipientId);
53
54 void SendMessage(double aSimTime, const WsfMessage& aMessage);
55
56 void SendMessage(double aSimTime, const WsfMessage& aMessage, WsfStringId aRecipientId);
57
60 unsigned int GetRecipientCount() const
61 {
62 assert(mIsInitialized);
63 return static_cast<unsigned int>(mRecipientPtrs.size());
64 }
65
66 struct Addressee
67 {
68 Addressee();
69 Addressee(WsfStringId aNameId);
70 Addressee(const Addressee& aSrc);
71 Addressee& operator=(const Addressee& aRhs);
72 ~Addressee() = default;
73
74 bool Activate(WsfPlatformPart* aPartPtr);
75 bool Deactivate();
76
80 };
81
84 WsfPlatformPart* GetRecipientEntry(unsigned int aEntry) const
85 {
86 assert(mIsInitialized);
87 const Addressee& link = *mRecipientPtrs[aEntry];
88 return (link.mIsActive) ? link.mPartPtr : nullptr;
89 }
90
91protected:
92 void ClearRecipients();
93
94private:
95 bool LinkRecipient(WsfStringId aRecipientId);
96 bool LinkRecipient(WsfPlatformPart* aRecipientPtr);
97
99 WsfPlatformPart* mPlatformPartPtr;
100
102 std::vector<Addressee*> mRecipientPtrs;
103
105 bool mDebugLinks;
106
108 bool mIsInitialized;
109
111 bool mHasLinks;
112};
113
114#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Definition WsfPlatformPart.hpp:61
Copyrights Multiple, All Rights Reserved