WSF
DetectionReport.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 2017 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 DETECTIONREPORT_HPP
13#define DETECTIONREPORT_HPP
14
15#include <iostream>
16#include <map>
17#include <string>
18#include <unordered_set>
19
20#include "post_processor_lib_export.h"
21
22#include "Report.hpp"
23class UtInput;
24
25class POST_PROCESSOR_LIB_EXPORT DetectionReport : public Report
26{
27 public:
28
30 {
31 cUNKNOWN,
32 cALLDETECTIONEVENTS,
33 cDETECTEDBY,
34 cFIRSTDETECTIONS,
35 cTOTALDETECTIONS,
36 cACCESS
37 };
38
39 DetectionReport() = delete;
40 explicit DetectionReport(const Options& aOptions);
41 ~DetectionReport() override = default;
42
43 //Access report structs
45 {
46 DetectionInterval() = default;
47 DetectionInterval(double aStart, double aEnd)
48 : mStart(aStart)
49 , mEnd(aEnd)
50 {
52 }
53 double mStart;
54 double mEnd;
55 double mDuration;
56
57 bool operator<(const DetectionInterval& aRhs) const;
58 };
59
61 {
62 DetectorDetecteeKey(const std::string& aDetector,
63 const std::string& aDetectee,
64 const std::string& aSensorName)
65 : mDetector(aDetector)
66 , mDetectee(aDetectee)
67 , mSensorName(aSensorName) {}
68
69 std::string mDetector;
70 std::string mDetectee;
71 std::string mSensorName;
72
73 bool operator<(const DetectorDetecteeKey& aRhs) const;
74 };
75
77 {
79 const DetectionInterval& aDetectionInterval)
80 : mKey(aKey),
81 mInterval(aDetectionInterval)
82 {
83 }
86
87 bool operator<(const ChangedEvent& aRhs) const;
88 };
89
90 using DetectorDetecteeMap = std::map< DetectorDetecteeKey, DetectionInterval >;
91 using KeyInputs = std::priority_queue< ChangedEvent >;
92
93 bool CreateRequiredData(std::string& aOutputDir) override;
94 bool Filter(std::vector<std::string>& aLine) override;
95 void PrintReportHeader(std::ostream& aStream) override;
96 void PrintReport(std::istream& aInStream, std::ostream& aOutStream) override;
97 bool ProcessInputConfiguration(UtInput& aInput) override;
98
99 private:
100
101 void SetSubReportType(const std::string& aTypeString);
102 std::string GetSubReportTypeStr() const { return GetSubReportTypeStr(mSubReportType); }
103 static std::string GetSubReportTypeStr(DetectionReportType aReportType);
104
105 //Access Report
106 void PrintAccessReport(std::ostream& aStream);
107 bool UpdateAccessReport(std::vector<std::string>& aDataStrVec, double aEvtTime);
108
109 DetectionReportType mSubReportType;
110 std::unordered_set<std::string> mReportOptions;
111 std::map<std::string, std::unordered_set<std::string>> mDetecting;
112 std::unordered_set<std::string> mDetected;
113 DetectorDetecteeMap mDetectorDetecteeMap;
114 KeyInputs mKeyInputs;
115};
116
117#endif
DetectionReport()=delete
~DetectionReport() override=default
DetectionReportType
Definition DetectionReport.hpp:30
std::map< DetectorDetecteeKey, DetectionInterval > DetectorDetecteeMap
Definition DetectionReport.hpp:90
std::priority_queue< ChangedEvent > KeyInputs
Definition DetectionReport.hpp:91
virtual bool ProcessInputConfiguration(UtInput &aInput)
Definition Report.cpp:67
bool PrintReport()
Definition Report.cpp:267
virtual void PrintReportHeader(std::ostream &aStream)
Definition Report.hpp:138
virtual bool Filter(std::vector< std::string > &aLine)
Definition Report.hpp:139
Report()=delete
virtual bool CreateRequiredData(std::string &aOutputDir)
Definition Report.hpp:136
DetectionInterval mInterval
Definition DetectionReport.hpp:85
bool operator<(const ChangedEvent &aRhs) const
Definition DetectionReport.cpp:941
DetectorDetecteeKey mKey
Definition DetectionReport.hpp:84
ChangedEvent(const DetectorDetecteeKey &aKey, const DetectionInterval &aDetectionInterval)
Definition DetectionReport.hpp:78
Definition DetectionReport.hpp:45
bool operator<(const DetectionInterval &aRhs) const
Definition DetectionReport.cpp:929
DetectionInterval(double aStart, double aEnd)
Definition DetectionReport.hpp:47
double mDuration
Definition DetectionReport.hpp:55
double mEnd
Definition DetectionReport.hpp:54
double mStart
Definition DetectionReport.hpp:53
Definition DetectionReport.hpp:61
std::string mDetectee
Definition DetectionReport.hpp:70
std::string mSensorName
Definition DetectionReport.hpp:71
std::string mDetector
Definition DetectionReport.hpp:69
DetectorDetecteeKey(const std::string &aDetector, const std::string &aDetectee, const std::string &aSensorName)
Definition DetectionReport.hpp:62
bool operator<(const DetectorDetecteeKey &aRhs) const
Definition DetectionReport.cpp:913
Definition Options.hpp:21
Copyrights Multiple, All Rights Reserved