WSF
WsfCoverageMeasure.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 2020 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 WSFCOVERAGEMEASURE_HPP
13#define WSFCOVERAGEMEASURE_HPP
14
15#include <string>
16
17#include "UtCallbackHolder.hpp"
18#include "UtCloneablePtr.hpp"
19#include "WsfObject.hpp"
20class UtInput;
21
22#include "wsf_coverage_export.h"
23
25#include "WsfScenario.hpp"
26
27namespace wsf
28{
29namespace coverage
30{
31
32class Coverage;
33class GridAsset;
34
42class WSF_COVERAGE_EXPORT Measure : public WsfObject
43{
44public:
45 explicit Measure(const WsfScenario& aScenario)
46 : mScenario(aScenario)
47 {
48 }
49 Measure(const Measure& aOther) = default;
50 ~Measure() override = default;
51
52 // WsfObject overrides
53 Measure* Clone() const override = 0;
54 bool ProcessInput(UtInput& aInput) override;
55
57 virtual double GetMeasuredValue(const GridAsset& aGridAsset) const = 0;
58
64 virtual std::string GetValueHeader() const = 0;
65
67 virtual double GetDefaultValue() const = 0;
68
69 bool Initialize(Coverage& aCoverage);
70
75 virtual void CollectionStarting(Coverage& aCoverage, double aSimTime) {}
76
77 void CollectionCompleting(Coverage& aCoverage, double aSimTime);
78
79protected:
81 std::size_t GetNumOutput() const { return mOutputs.size(); }
82
84 const MeasureOutput* GetOutput(std::size_t aIndex) const { return mOutputs[aIndex].get(); }
85
87 UtCallbackHolder mCallbacks{};
88
89private:
98 virtual bool InitializeP(Coverage& aCoverage) { return true; }
99
104 virtual void CollectionCompletingP(Coverage& aCoverage, double aSimTime) {}
105
106 const WsfScenario& mScenario;
107 std::vector<ut::CloneablePtr<MeasureOutput>> mOutputs{};
108};
109
110} // namespace coverage
111} // namespace wsf
112
113#endif // WSFCOVERAGEMEASURE_HPP
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfCoverage.hpp:57
Definition WsfCoverageAsset.hpp:37
A class that performs output of the measured data.
Definition WsfCoverageMeasureOutput.hpp:31
virtual double GetMeasuredValue(const GridAsset &aGridAsset) const =0
Return the measured value for a given aGridAsset.
std::size_t GetNumOutput() const
Return the number of output objects attached to this Measure.
Definition WsfCoverageMeasure.hpp:81
Measure(const Measure &aOther)=default
UtCallbackHolder mCallbacks
Holder for callbacks created when this object connects to events on it's coverage.
Definition WsfCoverageMeasure.hpp:87
virtual double GetDefaultValue() const =0
Return the default value of the measure.
bool Initialize(Coverage &aCoverage)
Definition WsfCoverageMeasure.cpp:69
~Measure() override=default
virtual std::string GetValueHeader() const =0
Measure * Clone() const override=0
const MeasureOutput * GetOutput(std::size_t aIndex) const
Return the output object at the given index.
Definition WsfCoverageMeasure.hpp:84
virtual void CollectionStarting(Coverage &aCoverage, double aSimTime)
Definition WsfCoverageMeasure.hpp:75
bool ProcessInput(UtInput &aInput) override
Definition WsfCoverageMeasure.cpp:30
Measure(const WsfScenario &aScenario)
Definition WsfCoverageMeasure.hpp:45
Definition WsfCoverage.cpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved