src/model/Connection.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 MODEL_CONNECTION_HPP | ||
| 7 | #define MODEL_CONNECTION_HPP | ||
| 8 | |||
| 9 | #include "ModelAPI.hpp" | ||
| 10 | #include "../utilities/core/Logger.hpp" | ||
| 11 | #include "ModelObject.hpp" | ||
| 12 | |||
| 13 | namespace openstudio { | ||
| 14 | namespace model { | ||
| 15 | |||
| 16 | namespace detail { | ||
| 17 | class Connection_Impl; | ||
| 18 | } // namespace detail | ||
| 19 | |||
| 20 | class MODEL_API Connection : public ModelObject | ||
| 21 | { | ||
| 22 | public: | ||
| 23 | // constructor | ||
| 24 | explicit Connection(const Model& model); | ||
| 25 | |||
| 26 | 435546 | virtual ~Connection() override = default; | |
| 27 | // Default the copy and move operators because the virtual dtor is explicit | ||
| 28 | Connection(const Connection& other) = default; | ||
| 29 | 8212 | Connection(Connection&& other) = default; | |
| 30 | Connection& operator=(const Connection&) = default; | ||
| 31 | ✗ | Connection& operator=(Connection&&) = default; | |
| 32 | |||
| 33 | boost::optional<ModelObject> sourceObject() const; | ||
| 34 | |||
| 35 | boost::optional<unsigned> sourceObjectPort() const; | ||
| 36 | |||
| 37 | boost::optional<ModelObject> targetObject() const; | ||
| 38 | |||
| 39 | boost::optional<unsigned> targetObjectPort() const; | ||
| 40 | |||
| 41 | bool setSourceObject(const ModelObject& object); | ||
| 42 | |||
| 43 | bool setSourceObjectPort(unsigned port); | ||
| 44 | |||
| 45 | bool setTargetObject(const ModelObject& object); | ||
| 46 | |||
| 47 | bool setTargetObjectPort(unsigned port); | ||
| 48 | |||
| 49 | static IddObjectType iddObjectType(); | ||
| 50 | |||
| 51 | protected: | ||
| 52 | using ImplType = detail::Connection_Impl; | ||
| 53 | |||
| 54 | friend class Model; | ||
| 55 | friend class openstudio::IdfObject; | ||
| 56 | friend class detail::ModelObject_Impl; | ||
| 57 | |||
| 58 | // constructor | ||
| 59 | explicit Connection(std::shared_ptr<detail::Connection_Impl> impl); | ||
| 60 | |||
| 61 | private: | ||
| 62 | REGISTER_LOGGER("openstudio.model.Connection"); | ||
| 63 | }; | ||
| 64 | |||
| 65 | /** \relates Connection */ | ||
| 66 | using OptionalConnection = boost::optional<Connection>; | ||
| 67 | |||
| 68 | /** \relates Connection */ | ||
| 69 | using ConnectionVector = std::vector<Connection>; | ||
| 70 | |||
| 71 | } // namespace model | ||
| 72 | } // namespace openstudio | ||
| 73 | |||
| 74 | #endif // MODEL_CONNECTION_HPP | ||
| 75 |