GCC Code Coverage Report


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

src/energyplus/ForwardTranslator/ForwardTranslatePythonPluginOutputVariable.cpp
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 #include "../ForwardTranslator.hpp"
7 #include "../../model/Model.hpp"
8
9 #include "../../model/PythonPluginOutputVariable.hpp"
10 #include "../../model/PythonPluginVariable.hpp"
11
12 #include <utilities/idd/PythonPlugin_OutputVariable_FieldEnums.hxx>
13 // #include "../../utilities/idd/IddEnums.hpp"
14 #include <utilities/idd/IddEnums.hxx>
15
16 using namespace openstudio::model;
17
18 namespace openstudio {
19
20 namespace energyplus {
21
22 5 boost::optional<IdfObject> ForwardTranslator::translatePythonPluginOutputVariable(model::PythonPluginOutputVariable& modelObject) {
23 // Instantiate an IdfObject of the class to store the values
24
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 IdfObject idfObject = createRegisterAndNameIdfObject(openstudio::IddObjectType::PythonPlugin_OutputVariable, modelObject);
25
26 // Python Plugin Variable Name: Required String
27
3/3
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
✓ Branch 7 taken 5 times.
5 idfObject.setString(PythonPlugin_OutputVariableFields::PythonPluginVariableName, modelObject.pythonPluginVariable().nameString());
28
29 // Type of Data in Variable: Required String
30
1/1
✓ Branch 1 taken 5 times.
5 std::string typeofDatainVariable = modelObject.typeofDatainVariable();
31
1/1
✓ Branch 1 taken 5 times.
5 idfObject.setString(PythonPlugin_OutputVariableFields::TypeofDatainVariable, typeofDatainVariable);
32
33 // Update Frequency: Required String
34
1/1
✓ Branch 1 taken 5 times.
5 std::string updateFrequency = modelObject.updateFrequency();
35
1/1
✓ Branch 1 taken 5 times.
5 idfObject.setString(PythonPlugin_OutputVariableFields::UpdateFrequency, updateFrequency);
36
37 // Units: boost::optional<std::string>
38
2/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 5 times.
✗ Branch 4 not taken.
10 if (boost::optional<std::string> _units = modelObject.units()) {
39
2/2
✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
5 idfObject.setString(PythonPlugin_OutputVariableFields::Units, _units.get());
40 5 }
41
42 // Resource Type: boost::optional<std::string>
43
3/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
10 if (boost::optional<std::string> _resourceType = modelObject.resourceType()) {
44
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(PythonPlugin_OutputVariableFields::ResourceType, _resourceType.get());
45 5 }
46
47 // Group Type: boost::optional<std::string>
48
3/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
10 if (boost::optional<std::string> _groupType = modelObject.groupType()) {
49
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(PythonPlugin_OutputVariableFields::GroupType, _groupType.get());
50 5 }
51
52 // End-Use Category: boost::optional<std::string>
53
3/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
10 if (boost::optional<std::string> _endUseCategory = modelObject.endUseCategory()) {
54
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(PythonPlugin_OutputVariableFields::EndUseCategory, _endUseCategory.get());
55 5 }
56
57 // End-Use Subcategory: boost::optional<std::string>
58
3/3
✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
10 if (boost::optional<std::string> _endUseSubcategory = modelObject.endUseSubcategory()) {
59
2/2
✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
1 idfObject.setString(PythonPlugin_OutputVariableFields::EndUseSubcategory, _endUseSubcategory.get());
60 5 }
61
62
1/1
✓ Branch 1 taken 5 times.
10 return idfObject;
63 5 } // End of translate function
64
65 } // end namespace energyplus
66 } // end namespace openstudio
67