src/alfalfa/AlfalfaPoint.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_POINT_HPP | ||
| 7 | #define ALFALFA_POINT_HPP | ||
| 8 | |||
| 9 | #include "AlfalfaComponent.hpp" | ||
| 10 | #include "../utilities/core/Optional.hpp" | ||
| 11 | #include "../utilities/core/Logger.hpp" | ||
| 12 | |||
| 13 | #include "AlfalfaAPI.hpp" | ||
| 14 | |||
| 15 | #include <string> | ||
| 16 | #include <json/json.h> | ||
| 17 | |||
| 18 | namespace openstudio { | ||
| 19 | namespace alfalfa { | ||
| 20 | namespace detail { | ||
| 21 | class AlfalfaPoint_Impl; | ||
| 22 | } | ||
| 23 | class ALFALFA_API AlfalfaPoint | ||
| 24 | { | ||
| 25 | public: | ||
| 26 | explicit AlfalfaPoint(const std::string& display_name); | ||
| 27 | |||
| 28 | 545 | virtual ~AlfalfaPoint() = default; | |
| 29 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 30 | 249 | AlfalfaPoint(const AlfalfaPoint& other) = default; | |
| 31 | 214 | AlfalfaPoint(AlfalfaPoint&& other) = default; | |
| 32 | ✗ | AlfalfaPoint& operator=(const AlfalfaPoint&) = default; | |
| 33 | ✗ | AlfalfaPoint& operator=(AlfalfaPoint&&) = default; | |
| 34 | |||
| 35 | // AlfalfaPoint(const AlfalfaPoint& point); | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Set input of point. This component will be written to by the Alfalfa API. | ||
| 39 | */ | ||
| 40 | void setInput(const AlfalfaComponent& component); | ||
| 41 | |||
| 42 | /** | ||
| 43 | * Get input component of point. | ||
| 44 | */ | ||
| 45 | boost::optional<AlfalfaComponent> input() const; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * Set output component of point. This component will be read to report a value to the Alfalfa API. | ||
| 49 | */ | ||
| 50 | void setOutput(const AlfalfaComponent& component); | ||
| 51 | |||
| 52 | /** | ||
| 53 | * Get output component of point. | ||
| 54 | */ | ||
| 55 | boost::optional<AlfalfaComponent> output() const; | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Set the units of the point. | ||
| 59 | */ | ||
| 60 | void setUnits(const std::string& units); | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Get the units of the point. | ||
| 64 | */ | ||
| 65 | boost::optional<std::string> units() const; | ||
| 66 | |||
| 67 | Json::Value toJSON() const; | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Get id of point. By default this will be a version of the display name with spaces removed. | ||
| 71 | */ | ||
| 72 | std::string id() const; | ||
| 73 | |||
| 74 | /** | ||
| 75 | * Set id of point. This is the component which will uniquely identify the point in the API. | ||
| 76 | */ | ||
| 77 | void setId(const std::string& id); | ||
| 78 | |||
| 79 | /** | ||
| 80 | * Get display name of point. | ||
| 81 | */ | ||
| 82 | std::string displayName() const; | ||
| 83 | |||
| 84 | /** | ||
| 85 | * Set display name of point. | ||
| 86 | */ | ||
| 87 | void setDisplayName(const std::string& display_name); | ||
| 88 | |||
| 89 | /** | ||
| 90 | * Get whether a point is marked as optional or not. | ||
| 91 | */ | ||
| 92 | bool isOptional() const; | ||
| 93 | |||
| 94 | /** | ||
| 95 | * Set whether a point is marked as optional or not. | ||
| 96 | * If a point is marked as optional it will allow the model to run even if the point | ||
| 97 | * cannot be instantiated. | ||
| 98 | */ | ||
| 99 | void setOptional(bool optional); | ||
| 100 | |||
| 101 | bool operator==(const AlfalfaPoint& rhs) const; | ||
| 102 | |||
| 103 | private: | ||
| 104 | std::shared_ptr<detail::AlfalfaPoint_Impl> m_impl; | ||
| 105 | }; | ||
| 106 | } // namespace alfalfa | ||
| 107 | } // namespace openstudio | ||
| 108 | |||
| 109 | #endif | ||
| 110 |