src/alfalfa/AlfalfaConstant.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 ALFALFA_COMPONENT_CONSTANT_HPP | ||
| 7 | #define ALFALFA_COMPONENT_CONSTANT_HPP | ||
| 8 | |||
| 9 | #include "AlfalfaAPI.hpp" | ||
| 10 | |||
| 11 | #include "AlfalfaComponentBase.hpp" | ||
| 12 | |||
| 13 | namespace openstudio { | ||
| 14 | namespace alfalfa { | ||
| 15 | class ALFALFA_API AlfalfaConstant : public AlfalfaComponentBase | ||
| 16 | { | ||
| 17 | public: | ||
| 18 | /** | ||
| 19 | * Create an AlfalfaConstant Component with a set value. | ||
| 20 | */ | ||
| 21 | AlfalfaConstant(double value); | ||
| 22 | |||
| 23 | std::string deriveName() const override; | ||
| 24 | |||
| 25 | Json::Value toJSON() const override; | ||
| 26 | |||
| 27 | 22 | AlfalfaComponentCapability capability() const override { | |
| 28 |
1/1✓ Branch 1 taken 22 times.
|
22 | return AlfalfaComponentCapability::Output; |
| 29 | } | ||
| 30 | |||
| 31 | 11 | AlfalfaComponentType type() const override { | |
| 32 |
1/1✓ Branch 1 taken 11 times.
|
11 | return AlfalfaComponentType::Constant; |
| 33 | } | ||
| 34 | |||
| 35 | 20 | std::unique_ptr<AlfalfaComponentBase> clone() const override { | |
| 36 |
1/1✓ Branch 1 taken 20 times.
|
20 | return std::make_unique<AlfalfaConstant>(*this); |
| 37 | } | ||
| 38 | |||
| 39 | double value() const; | ||
| 40 | |||
| 41 | private: | ||
| 42 | double m_value; | ||
| 43 | }; | ||
| 44 | } // namespace alfalfa | ||
| 45 | } // namespace openstudio | ||
| 46 | |||
| 47 | #endif | ||
| 48 |