WSF
WsfEventResult.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 WSFEVENTRESULT_HPP
13#define WSFEVENTRESULT_HPP
14
15
16#include "wsf_export.h"
17
18#include <functional>
19#include <map>
20#include <ostream>
21#include <string.h>
22
23#include "UtAngle.hpp"
24#include "UtTime.hpp"
25
26class WsfMessage;
27#include "WsfStringId.hpp"
28
29namespace wsf
30{
31namespace event
32{
33
35{
36public:
37 using MessagePrintFunction = std::function<void(double, const WsfMessage&)>;
38 using MessagePrintMap = std::map<WsfStringId, MessagePrintFunction>;
39
40#undef GetTimeFormat // Avoid conflict with Windows macro
41 int GetTimeFormat() const { return mTimeFormat; }
42 void SetTimeFormat(int aTimeFormat) { mTimeFormat = aTimeFormat; }
43 int GetLatLonFormat() const { return mLatLonFormat; }
44 void SetLatLonFormat(int aLatLonFormat) { mLatLonFormat = aLatLonFormat; }
45
46 bool PrintLLA_Locations() const { return mPrintLLA_Locations; }
47 void SetPrintLLA_Locations(bool aPrintLLA_Locations) { mPrintLLA_Locations = aPrintLLA_Locations; }
49 void SetPrintSingleLinePerEvent(bool aPrintSingleLinePerEvent)
50 {
51 mPrintSingleLinePerEvent = aPrintSingleLinePerEvent;
52 }
54 void SetPrintTrackInMessage(bool aPrintTrackInMessage) { mPrintTrackInMessage = aPrintTrackInMessage; }
56 void SetPrintTrackCovariance(bool aPrintTrackCovariance) { mPrintTrackCovariance = aPrintTrackCovariance; }
58 void SetPrintTrackResidualCovariance(bool aPrintTrackResidualCovariance)
59 {
60 mPrintTrackResidualCovariance = aPrintTrackResidualCovariance;
61 }
62
63 // These allow the labels to be tweaked so they match 1.10 output.
64 std::string GetSNR_InterferenceLabel() const { return mSNR_InterferenceLabel; }
65 void SetSNR_InterferenceLabel(const std::string& aLabel) { mSNR_InterferenceLabel = aLabel; }
66 std::string GetInterferencePowerLabel() const { return mInterferencePowerLabel; }
67 void SetInterferencePowerLabel(const std::string& aLabel) { mInterferencePowerLabel = aLabel; }
68
69
71 void RegisterMessagePrinter(WsfStringId aMessageType, const MessagePrintFunction& aFunction)
72 {
73 mMessagePrinters[aMessageType] = aFunction;
74 }
75
76protected:
77 // Common
78 int mTimeFormat{UtTime::FmtS + 5 + UtTime::FmtShowPoint + UtTime::FmtNoSuffix}; // ASCII format
79 int mLatLonFormat{UtAngle::FmtDMS + 2}; // ASCII format
80
81 // WsfEventOutput
87
88 // These allow the labels to be tweaked so they match 1.10 output.
89 std::string mSNR_InterferenceLabel{"S/(N+C+I)"};
90 std::string mInterferencePowerLabel{"Interference_Power"};
91
93};
94
96{
97public:
98 ResultBase(double aSimTime, std::string aEventName = "UNSET")
99 : mSimTime(aSimTime)
100 , mEventName(std::move(aEventName))
101 {
102 }
103
104 ResultBase(const ResultBase&) = default;
105 ResultBase& operator=(const ResultBase&) = default;
106 virtual ~ResultBase() = default;
107
108 double GetSimTime() const { return mSimTime; }
109 const std::string& GetName() const { return mEventName; }
110
111protected:
112 double mSimTime;
113 std::string mEventName;
114};
115
117{
118public:
119 Result(double aSimTime, Settings aSettings = Settings{}, std::string aEventName = "UNSET")
120 : ResultBase(aSimTime, std::move(aEventName))
121 , mSettings(std::move(aSettings))
122 {
123 }
124
125 virtual void Print(std::ostream& aStream) const = 0;
126 virtual void Print(std::ostream& aStream, Settings aSettings)
127 {
128 // TODO: Remove member Settings and use dependency injection
129 mSettings = std::move(aSettings);
130 Print(aStream);
131 }
132 virtual void PrintCSV(std::ostream& aStream) const = 0;
133 virtual void PrintCSV(std::ostream& aStream, Settings aSettings)
134 {
135 // TODO: Remove member Settings and use dependency injection
136 mSettings = std::move(aSettings);
137 PrintCSV(aStream);
138 }
139
140protected:
142};
143} // namespace event
144} // namespace wsf
145
146#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 WsfEventResult.hpp:96
double GetSimTime() const
Definition WsfEventResult.hpp:108
std::string mEventName
Definition WsfEventResult.hpp:113
ResultBase & operator=(const ResultBase &)=default
const std::string & GetName() const
Definition WsfEventResult.hpp:109
ResultBase(double aSimTime, std::string aEventName="UNSET")
Definition WsfEventResult.hpp:98
double mSimTime
Definition WsfEventResult.hpp:112
virtual ~ResultBase()=default
ResultBase(const ResultBase &)=default
virtual void PrintCSV(std::ostream &aStream) const =0
virtual void Print(std::ostream &aStream, Settings aSettings)
Definition WsfEventResult.hpp:126
Result(double aSimTime, Settings aSettings=Settings{}, std::string aEventName="UNSET")
Definition WsfEventResult.hpp:119
virtual void Print(std::ostream &aStream) const =0
virtual void PrintCSV(std::ostream &aStream, Settings aSettings)
Definition WsfEventResult.hpp:133
Settings mSettings
Definition WsfEventResult.hpp:141
Definition WsfEventResult.hpp:35
void SetLatLonFormat(int aLatLonFormat)
Definition WsfEventResult.hpp:44
int mTimeFormat
Definition WsfEventResult.hpp:78
bool PrintTrackResidualCovariance() const
Definition WsfEventResult.hpp:57
bool mPrintSingleLinePerEvent
Definition WsfEventResult.hpp:83
int GetLatLonFormat() const
Definition WsfEventResult.hpp:43
bool PrintLLA_Locations() const
Definition WsfEventResult.hpp:46
void SetPrintSingleLinePerEvent(bool aPrintSingleLinePerEvent)
Definition WsfEventResult.hpp:49
int mLatLonFormat
Definition WsfEventResult.hpp:79
bool PrintSingleLinePerEvent() const
Definition WsfEventResult.hpp:48
std::map< WsfStringId, MessagePrintFunction > MessagePrintMap
Definition WsfEventResult.hpp:38
std::string mInterferencePowerLabel
Definition WsfEventResult.hpp:90
std::string GetSNR_InterferenceLabel() const
Definition WsfEventResult.hpp:64
bool mPrintTrackCovariance
Definition WsfEventResult.hpp:85
void SetTimeFormat(int aTimeFormat)
Definition WsfEventResult.hpp:42
bool PrintTrackCovariance() const
Definition WsfEventResult.hpp:55
void SetPrintTrackCovariance(bool aPrintTrackCovariance)
Definition WsfEventResult.hpp:56
void SetPrintLLA_Locations(bool aPrintLLA_Locations)
Definition WsfEventResult.hpp:47
void SetInterferencePowerLabel(const std::string &aLabel)
Definition WsfEventResult.hpp:67
void SetSNR_InterferenceLabel(const std::string &aLabel)
Definition WsfEventResult.hpp:65
std::string mSNR_InterferenceLabel
Definition WsfEventResult.hpp:89
bool mPrintTrackInMessage
Definition WsfEventResult.hpp:84
void SetPrintTrackInMessage(bool aPrintTrackInMessage)
Definition WsfEventResult.hpp:54
bool PrintTrackInMessage() const
Definition WsfEventResult.hpp:53
void RegisterMessagePrinter(WsfStringId aMessageType, const MessagePrintFunction &aFunction)
Definition WsfEventResult.hpp:71
void SetPrintTrackResidualCovariance(bool aPrintTrackResidualCovariance)
Definition WsfEventResult.hpp:58
const MessagePrintMap & GetMessagePrinters() const
Definition WsfEventResult.hpp:70
bool mPrintTrackResidualCovariance
Definition WsfEventResult.hpp:86
int GetTimeFormat() const
Definition WsfEventResult.hpp:41
std::string GetInterferencePowerLabel() const
Definition WsfEventResult.hpp:66
std::function< void(double, const WsfMessage &)> MessagePrintFunction
Definition WsfEventResult.hpp:37
MessagePrintMap mMessagePrinters
Definition WsfEventResult.hpp:92
bool mPrintLLA_Locations
Definition WsfEventResult.hpp:82
Template specialization for wsf::comm::Address. Allows usage of Address in std::unordered_map/set.
Definition WsfCommAddress.hpp:185
Definition WsfXIO_EventResults.cpp:33
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved