src/energyplus/ForwardTranslator/ForwardTranslateOutputJSON.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/OutputJSON.hpp" | ||
| 10 | |||
| 11 | #include <utilities/idd/Output_JSON_FieldEnums.hxx> | ||
| 12 | // #include "../../utilities/idd/IddEnums.hpp" | ||
| 13 | #include <utilities/idd/IddEnums.hxx> | ||
| 14 | |||
| 15 | using namespace openstudio::model; | ||
| 16 | |||
| 17 | namespace openstudio { | ||
| 18 | |||
| 19 | namespace energyplus { | ||
| 20 | |||
| 21 | 5 | boost::optional<IdfObject> ForwardTranslator::translateOutputJSON(model::OutputJSON& modelObject) { | |
| 22 | |||
| 23 |
2/2✓ Branch 1 taken 5 times.
✓ Branch 4 taken 5 times.
|
5 | IdfObject idfObject = createAndRegisterIdfObject(openstudio::IddObjectType::Output_JSON, modelObject); |
| 24 | |||
| 25 | // Option Type: Required String | ||
| 26 |
1/1✓ Branch 1 taken 5 times.
|
5 | std::string optionType = modelObject.optionType(); |
| 27 |
1/1✓ Branch 1 taken 5 times.
|
5 | idfObject.setString(Output_JSONFields::OptionType, optionType); |
| 28 | |||
| 29 | // Output JSON: Optional Boolean | ||
| 30 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 2 times.
|
5 | if (modelObject.outputJSON()) { |
| 31 |
2/2✓ Branch 1 taken 3 times.
✓ Branch 4 taken 3 times.
|
6 | idfObject.setString(Output_JSONFields::OutputJSON, "Yes"); |
| 32 | } else { | ||
| 33 |
2/2✓ Branch 1 taken 2 times.
✓ Branch 4 taken 2 times.
|
4 | idfObject.setString(Output_JSONFields::OutputJSON, "No"); |
| 34 | } | ||
| 35 | |||
| 36 | // Output CBOR: Optional Boolean | ||
| 37 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
|
5 | if (modelObject.outputCBOR()) { |
| 38 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(Output_JSONFields::OutputCBOR, "Yes"); |
| 39 | } else { | ||
| 40 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | idfObject.setString(Output_JSONFields::OutputCBOR, "No"); |
| 41 | } | ||
| 42 | |||
| 43 | // Output MessagePack: Optional Boolean | ||
| 44 |
3/3✓ Branch 1 taken 5 times.
✓ Branch 3 taken 1 time.
✓ Branch 4 taken 4 times.
|
5 | if (modelObject.outputMessagePack()) { |
| 45 |
2/2✓ Branch 1 taken 1 time.
✓ Branch 4 taken 1 time.
|
2 | idfObject.setString(Output_JSONFields::OutputMessagePack, "Yes"); |
| 46 | } else { | ||
| 47 |
2/2✓ Branch 1 taken 4 times.
✓ Branch 4 taken 4 times.
|
8 | idfObject.setString(Output_JSONFields::OutputMessagePack, "No"); |
| 48 | } | ||
| 49 | |||
| 50 |
1/1✓ Branch 1 taken 5 times.
|
10 | return idfObject; |
| 51 | 5 | } // End of translate function | |
| 52 | |||
| 53 | } // end namespace energyplus | ||
| 54 | } // end namespace openstudio | ||
| 55 |