src/utilities/bcl/BCLComponent.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 UTILITIES_BCL_BCLCOMPONENT_HPP | ||
| 7 | #define UTILITIES_BCL_BCLCOMPONENT_HPP | ||
| 8 | |||
| 9 | #include "../core/Optional.hpp" | ||
| 10 | #include "../core/Logger.hpp" | ||
| 11 | #include "../core/Path.hpp" | ||
| 12 | #include "../core/UUID.hpp" | ||
| 13 | #include "../data/Attribute.hpp" | ||
| 14 | #include "../UtilitiesAPI.hpp" | ||
| 15 | |||
| 16 | #include <vector> | ||
| 17 | |||
| 18 | // Add more methods for editing components, opening local component constructor | ||
| 19 | |||
| 20 | namespace openstudio { | ||
| 21 | |||
| 22 | class UTILITIES_API BCLComponent | ||
| 23 | { | ||
| 24 | |||
| 25 | public: | ||
| 26 | /** @name Constructors */ | ||
| 27 | //@{ | ||
| 28 | |||
| 29 | /// Default constructor for a new component | ||
| 30 | BCLComponent(); | ||
| 31 | |||
| 32 | /// Constructor for downloaded components, path is to directory containing "component.xml" file | ||
| 33 | BCLComponent(const openstudio::path& dir); | ||
| 34 | |||
| 35 | // Note JM 2018-11-14: SHOULD BE REMOVED | ||
| 36 | // DLM: TODO, this should really take an openstudio::path, other parts of this class should be converted to path as well | ||
| 37 | /// Constructor for downloaded components, path is to directory containing "component.xml" file | ||
| 38 | // BCLComponent(const std::string& dir); | ||
| 39 | |||
| 40 | //@} | ||
| 41 | /** @name Destructor */ | ||
| 42 | //@{ | ||
| 43 | |||
| 44 | /// Virtual destructor | ||
| 45 | 29 | virtual ~BCLComponent() = default; | |
| 46 | |||
| 47 | //@} | ||
| 48 | /** @name Getters */ | ||
| 49 | //@{ | ||
| 50 | |||
| 51 | openstudio::path directory() const; | ||
| 52 | |||
| 53 | std::string uid() const; | ||
| 54 | |||
| 55 | std::string versionId() const; | ||
| 56 | |||
| 57 | std::string name() const; | ||
| 58 | |||
| 59 | std::string description() const; | ||
| 60 | |||
| 61 | // TODO: JM 2018-11-14 | ||
| 62 | // These should probably be a std::vector<openstudio::path> too | ||
| 63 | std::vector<std::string> files() const; | ||
| 64 | |||
| 65 | std::vector<std::string> files(const std::string& filetype) const; | ||
| 66 | |||
| 67 | std::vector<std::string> filetypes() const; | ||
| 68 | |||
| 69 | std::vector<Attribute> attributes() const; | ||
| 70 | |||
| 71 | //@} | ||
| 72 | /** @name Setters */ | ||
| 73 | //@{ | ||
| 74 | |||
| 75 | void setName(const std::string& name); | ||
| 76 | |||
| 77 | //@} | ||
| 78 | /** @name Operators */ | ||
| 79 | //@{ | ||
| 80 | |||
| 81 | /// Equality test - Compares the uids and versionIds of two separate components | ||
| 82 | bool operator==(const BCLComponent& other) const; | ||
| 83 | |||
| 84 | /// Negation of ==. | ||
| 85 | bool operator!=(const BCLComponent& other) const; | ||
| 86 | |||
| 87 | /// Less than | ||
| 88 | bool operator<(const BCLComponent& other) const; | ||
| 89 | |||
| 90 | //@} | ||
| 91 | private: | ||
| 92 | − | REGISTER_LOGGER("openstudio.BCLComponent"); | |
| 93 | |||
| 94 | openstudio::path m_directory; | ||
| 95 | std::string m_name; | ||
| 96 | std::string m_uid; | ||
| 97 | std::string m_versionId; | ||
| 98 | std::string m_description; | ||
| 99 | std::vector<std::string> m_files; | ||
| 100 | std::vector<std::string> m_filetypes; | ||
| 101 | std::vector<Attribute> m_attributes; | ||
| 102 | }; | ||
| 103 | |||
| 104 | /** \relates BCLComponent */ | ||
| 105 | using OptionalBCLComponent = boost::optional<BCLComponent>; | ||
| 106 | |||
| 107 | /** \relates BCLComponent */ | ||
| 108 | using BCLComponentVector = std::vector<BCLComponent>; | ||
| 109 | |||
| 110 | } // namespace openstudio | ||
| 111 | |||
| 112 | #endif // UTILITIES_BCL_BCLCOMPONENT_HPP | ||
| 113 |