Thomas Psota | 7e562b6 | 2020-04-30 15:11:32 +0200 | [diff] [blame] | 1 | #include <BaSyx/submodel/simple/qualifier/Referable.h> |
| 2 | #include <BaSyx/submodel/simple/reference/Reference.h> |
| 3 | |
| 4 | using namespace basyx::submodel::simple; |
| 5 | using namespace basyx::submodel::api; |
| 6 | |
| 7 | Referable::Referable(const std::string & idShort, const Referable * parent) |
| 8 | : idShort(idShort) |
| 9 | , parent(parent) |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 10 | {} |
| 11 | |
| 12 | Referable::Referable(const IReferable &other) |
| 13 | : idShort(other.getIdShort()) |
| 14 | , category(*other.getCategory()) |
| 15 | , description(other.getDescription()) |
| 16 | , parent(other.getParent()) |
| 17 | {}; |
Thomas Psota | 7e562b6 | 2020-04-30 15:11:32 +0200 | [diff] [blame] | 18 | |
| 19 | const std::string & Referable::getIdShort() const |
| 20 | { |
| 21 | return this->idShort; |
| 22 | } |
| 23 | |
| 24 | const std::string * const Referable::getCategory() const |
| 25 | { |
| 26 | if (this->category.empty()) |
| 27 | return nullptr; |
| 28 | |
| 29 | return &this->category; |
| 30 | } |
| 31 | |
| 32 | LangStringSet & Referable::getDescription() |
| 33 | { |
| 34 | return this->description; |
| 35 | } |
| 36 | |
| 37 | const LangStringSet & Referable::getDescription() const |
| 38 | { |
| 39 | return this->description; |
| 40 | } |
| 41 | |
| 42 | void Referable::setIdShort(const std::string & idShort) |
| 43 | { |
| 44 | this->idShort = idShort; |
| 45 | } |
| 46 | |
| 47 | void Referable::setCategory(const std::string & category) |
| 48 | { |
| 49 | this->category = category; |
| 50 | } |
| 51 | |
| 52 | const IReferable * const Referable::getParent() const |
| 53 | { |
| 54 | return this->parent; |
| 55 | }; |
| 56 | |
| 57 | bool Referable::hasParent() const noexcept |
| 58 | { |
| 59 | return this->parent != nullptr; |
| 60 | }; |
| 61 | |
| 62 | bool Referable::hasDescription() const noexcept |
| 63 | { |
| 64 | return !this->description.empty(); |
| 65 | }; |
| 66 | |
| 67 | bool Referable::hasCategory() const noexcept |
| 68 | { |
| 69 | return !this->category.empty(); |
Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 70 | } |