GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 1 / 0 / 1
Functions: 100.0% 1 / 0 / 1
Branches: -% 0 / 0 / 0

src/measure/ReportingMeasure.hpp
Line Branch Exec Source
1 /***********************************************************************************************************************
2 * OpenStudio(R), Copyright (c) Alliance for Energy Innovation, LLC.
3 * See also https://openstudio.net/license
4 ***********************************************************************************************************************/
5
6 #ifndef MEASURE_REPORTINGMEASURE_HPP
7 #define MEASURE_REPORTINGMEASURE_HPP
8
9 #include "MeasureAPI.hpp"
10 #include "OSMeasure.hpp"
11
12 #include "../utilities/core/Logger.hpp"
13
14 namespace openstudio {
15
16 class IdfObject;
17
18 namespace model {
19 class Model;
20 }
21
22 namespace measure {
23
24 /** ReportingMeasure is an abstract base class for UserScripts that generate reports. */
25 class MEASURE_API ReportingMeasure : public OSMeasure
26 {
27 public:
28 /** @name Constructors and Destructors */
29 //@{
30
31 84 virtual ~ReportingMeasure() = default;
32
33 //@}
34 /** @name Getters */
35 //@{
36
37 /** Returns the arguments for this script. In interactive applications, an OSRunner presents
38 * these arguments to the user to produce an OSArgumentMap of user_arguments that it then passes
39 * to this script's run method. The same basic steps should happen in applications with non-
40 * interactive scripts, but in that case an entity other than an OSRunner may be in charge of
41 * collecting user arguments. The base class implementation returns an empty vector. */
42 virtual std::vector<OSArgument> arguments(const openstudio::model::Model& model) const;
43
44 /** Returns the outputs for this script. The base class implementation returns an empty vector. */
45 virtual std::vector<OSOutput> outputs() const;
46
47 //@}
48 /** @name Actions */
49 //@{
50
51 /** Run the script with the given runner and user_arguments. The base class implementation calls
52 * runner.prepareForMeasureRun(*this) and should be called at the beginning of derived class
53 * implementations of this method. (In C++, that call looks like
54 * ReportingMeasure::run(runner, user_arguments). In Ruby that call looks like
55 * super(runner, user_arguments). */
56 virtual bool run(OSRunner& runner, const std::map<std::string, OSArgument>& user_arguments) const;
57
58 /** This method is called on all reporting measures immediately before the translation to E+ IDF.
59 * There is an implicit contract that this method should NOT be modifying your model in a way that would produce
60 * different results, meaning it should only add or modify reporting-related elements (eg: OutputTableSummaryReports, OutputControlFiles, etc)
61 * but that is not going to be enforced.
62 * If you mean to modify the model in a significant way, use a ModelMeasure.
63 */
64 virtual bool modelOutputRequests(openstudio::model::Model& model, OSRunner& runner,
65 const std::map<std::string, OSArgument>& user_arguments) const;
66
67 /** This method is called on all reporting measures immediately before the E+
68 * simulation. The code that injects these objects into the IDF checks that
69 * only objects of allowed types are added to prevent changes that impact
70 * energy use. The injector code also prevents duplicate report requests.
71 * The default implementation of this method returns an empty vector.
72 * The runner allows the user to load the last osm/idf and to log messages.
73 * The argument map is available with the arguments for the reporting measure. */
74 virtual std::vector<IdfObject> energyPlusOutputRequests(OSRunner& runner, const std::map<std::string, OSArgument>& user_arguments) const;
75 //@}
76 protected:
77 ReportingMeasure();
78
79 private:
80 REGISTER_LOGGER("openstudio.measure.ReportingMeasure");
81 };
82
83 } // namespace measure
84 } // namespace openstudio
85
86 #endif // MEASURE_REPORTINGMEASURE_HPP
87