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