WSF
WsfUCI_Component.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 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 WSFUCI_COMPONENT_HPP
13#define WSFUCI_COMPONENT_HPP
14
15#include "wsf_oms_uci_export.h"
16
17#include <string>
18
19#include "uci/base/Accessor.h"
20#include "uci/base/UUID.h"
21#include "uci/factory/CapabilityID_TypeFactory.h"
22#include "uci/type/MessageStateEnum.h"
23#include "uci/type/DateTimeType.h"
24#include "uci/type/MessageType.h"
25
26#include "WsfComponent.hpp"
27class WsfMessage;
28#include "WsfObject.hpp"
29#include "WsfPlatform.hpp"
30#include "WsfPlatformPart.hpp"
31#include "WsfUCI_Interface.hpp"
32
33class WsfScenario;
34class WsfSimulation;
35
36namespace wsf
37{
38
42 {
43 public:
45
46
47 // We must define the component role enum here as it is not a core value
48 static const int cWSF_COMPONENT_UCI = 1234568; // See WsfComponentRoles
50
51 UCI_Component(const WsfScenario& aScenario,
52 int aPartType);
53 UCI_Component(const UCI_Component& aSrc);
54 virtual ~UCI_Component();
55
57
58 double GetUpdateInterval() const override;
59 void SetUpdateInterval(double aUpdateInterval) override;
60
61 virtual std::set<std::string> GetCapabilityUUIDs() const { return std::set<std::string>(); }
62
64
65 WsfStringId GetComponentName() const override { return GetNameId(); }
66 const int* GetComponentRoles() const override;
67
68 void* QueryInterface(int aRole) override;
69 virtual bool InjectConditionally(double aSimTime,
70 WsfPlatform& aPlatform) { return false; }
71 bool Initialize2(double aSimTime) override;
72
73 bool ProcessInput(UtInput& aInput) override;
74
76 bool IsActive() { return (GetInterface() != nullptr); }
77
78 bool RegisterWithInterface(double aSimTime);
80
83
86 virtual void ReceiveUCI_Message(const uci::type::MessageType* aMessagePtr) {};
87
89
90
94
95 bool CanHandleMessage() const { return IsTurnedOn() && IsOperational(); }
96
97 protected:
98 std::string mSubsystemUUID;
99 std::string mSubsystemLabel;
100
101 private:
102 bool mIsInitialized{ false };
103 bool mIsRegistered { false };
104 UCI_Interface* mUCI_InterfacePtr = nullptr;
105 };
106
107} // namespace wsf
108
110
111#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
ParentType * GetComponentParent() const
Definition WsfComponent.hpp:154
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
WsfStringId GetNameId() const
Definition WsfObject.hpp:66
bool IsOperational() const
Definition WsfPlatformPart.hpp:178
WsfPlatformPart(const WsfScenario &aScenario, int aPartType)
Definition WsfPlatformPart.cpp:62
bool IsTurnedOn() const
Definition WsfPlatformPart.hpp:150
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
WsfSimulation * GetSimulation() const
If the platform is a member of a simulation, this is the containing simulation.
Definition WsfPlatform.hpp:323
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfUCI_Component.hpp:42
virtual void ReceiveUCI_Message(const uci::type::MessageType *aMessagePtr)
Definition WsfUCI_Component.hpp:86
virtual ~UCI_Component()
Definition WsfUCI_Component.cpp:42
std::string mSubsystemUUID
Definition WsfUCI_Component.hpp:98
bool RegisterWithInterface(double aSimTime)
Definition WsfUCI_Component.cpp:94
bool Initialize2(double aSimTime) override
Definition WsfUCI_Component.cpp:145
bool IsActive()
Is this interface active (i.e., it has a valid corresponding UCI interface; otherwise it does nothing...
Definition WsfUCI_Component.hpp:76
double GetUpdateInterval() const override
Definition WsfUCI_Component.cpp:48
virtual bool InjectConditionally(double aSimTime, WsfPlatform &aPlatform)
Definition WsfUCI_Component.hpp:69
const int * GetComponentRoles() const override
Definition WsfUCI_Component.cpp:68
WsfSimulation & GetSimulation() const
Convenience Methods.
Definition WsfUCI_Component.hpp:92
void SetUpdateInterval(double aUpdateInterval) override
Definition WsfUCI_Component.cpp:53
bool CanHandleMessage() const
Definition WsfUCI_Component.hpp:95
virtual std::set< std::string > GetCapabilityUUIDs() const
Definition WsfUCI_Component.hpp:61
static const int cWSF_COMPONENT_UCI
Definition WsfUCI_Component.hpp:48
void RegisterCapabilitiesWithInterface()
Definition WsfUCI_Component.cpp:124
UCI_Interface * GetInterface()
Definition WsfUCI_Component.cpp:59
UCI_Component(const WsfScenario &aScenario, int aPartType)
Definition WsfUCI_Component.cpp:28
void * QueryInterface(int aRole) override
Definition WsfUCI_Component.cpp:78
bool ProcessInput(UtInput &aInput) override
Definition WsfUCI_Component.cpp:151
void DeregisterCapabilitiesWithInterface()
Definition WsfUCI_Component.cpp:134
std::string mSubsystemLabel
Definition WsfUCI_Component.hpp:99
WsfStringId GetComponentName() const override
Definition WsfUCI_Component.hpp:65
void DeregisterWithInterface()
Definition WsfUCI_Component.cpp:111
The OMS / UCI Interface Object to the UCI middleware.
Definition WsfUCI_Interface.hpp:118
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved