Constantin Ziesche | 02817f1 | 2020-08-04 21:40:43 +0200 | [diff] [blame^] | 1 | |
| 2 | #include <BaSyx/submodel/simple/dataspecification/DataSpecificationPhysicalUnit.h> |
| 3 | |
| 4 | namespace basyx { |
| 5 | namespace submodel { |
| 6 | namespace simple { |
| 7 | |
| 8 | DataSpecificationPhysicalUnit::DataSpecificationPhysicalUnit(const std::string &unitName, |
| 9 | const std::string &unitSymbol, const api::ILangStringSet &definition) |
| 10 | : unitName(unitName) |
| 11 | , unitSymbol(unitSymbol) |
| 12 | { |
| 13 | this->setDefinition(definition); |
| 14 | } |
| 15 | |
| 16 | const std::string &DataSpecificationPhysicalUnit::getUnitName() const |
| 17 | { |
| 18 | return this->unitName; |
| 19 | } |
| 20 | |
| 21 | void DataSpecificationPhysicalUnit::setUnitName(const std::string &unitName) |
| 22 | { |
| 23 | this->unitName = unitName; |
| 24 | } |
| 25 | |
| 26 | const std::string &DataSpecificationPhysicalUnit::getUnitSymbol() const |
| 27 | { |
| 28 | return this->unitSymbol; |
| 29 | } |
| 30 | |
| 31 | void DataSpecificationPhysicalUnit::setUnitSymbol(const std::string &unitSymbol) |
| 32 | { |
| 33 | this->unitSymbol = unitSymbol; |
| 34 | } |
| 35 | |
| 36 | LangStringSet & DataSpecificationPhysicalUnit::getDefinition() |
| 37 | { |
| 38 | return this->definition; |
| 39 | } |
| 40 | |
| 41 | void DataSpecificationPhysicalUnit::setDefinition(const api::ILangStringSet &definition) |
| 42 | { |
| 43 | this->definition = LangStringSet(); |
| 44 | for (auto & lang_code : definition.getLanguageCodes()) |
| 45 | { |
| 46 | this->definition.add(lang_code, definition.get(lang_code)); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | const std::string * DataSpecificationPhysicalUnit::getSiNotation() const |
| 51 | { |
| 52 | if (this->siNotation.empty()) |
| 53 | return nullptr; |
| 54 | |
| 55 | return &this->siNotation; |
| 56 | } |
| 57 | |
| 58 | void DataSpecificationPhysicalUnit::setSiNotation(const std::string &siNotation) |
| 59 | { |
| 60 | this->siNotation = siNotation; |
| 61 | } |
| 62 | |
| 63 | const std::string * DataSpecificationPhysicalUnit::getSiName() const |
| 64 | { |
| 65 | if (this->siName.empty()) |
| 66 | return nullptr; |
| 67 | |
| 68 | return &this->siName; |
| 69 | } |
| 70 | |
| 71 | void DataSpecificationPhysicalUnit::setSiName(const std::string &siName) |
| 72 | { |
| 73 | this->siName = siName; |
| 74 | } |
| 75 | |
| 76 | const std::string * DataSpecificationPhysicalUnit::getDinNotation() const |
| 77 | { |
| 78 | if (this->dinNotation.empty()) |
| 79 | return nullptr; |
| 80 | |
| 81 | return &this->dinNotation; |
| 82 | } |
| 83 | |
| 84 | void DataSpecificationPhysicalUnit::setDinNotation(const std::string &dinNotation) |
| 85 | { |
| 86 | this->dinNotation = dinNotation; |
| 87 | } |
| 88 | |
| 89 | const std::string * DataSpecificationPhysicalUnit::getEceName() const |
| 90 | { |
| 91 | if (this->eceName.empty()) |
| 92 | return nullptr; |
| 93 | |
| 94 | return &this->eceName; |
| 95 | } |
| 96 | |
| 97 | void DataSpecificationPhysicalUnit::setEceName(const std::string &eceName) |
| 98 | { |
| 99 | this->eceName = eceName; |
| 100 | } |
| 101 | |
| 102 | const std::string * DataSpecificationPhysicalUnit::getEceCode() const |
| 103 | { |
| 104 | if (this->eceCode.empty()) |
| 105 | return nullptr; |
| 106 | |
| 107 | return &this->eceCode; |
| 108 | } |
| 109 | |
| 110 | void DataSpecificationPhysicalUnit::setEceCode(const std::string &eceCode) |
| 111 | { |
| 112 | this->eceCode = eceCode; |
| 113 | } |
| 114 | |
| 115 | const std::string * DataSpecificationPhysicalUnit::getNistName() const |
| 116 | { |
| 117 | if (this->nistName.empty()) |
| 118 | return nullptr; |
| 119 | |
| 120 | return &this->nistName; |
| 121 | } |
| 122 | |
| 123 | void DataSpecificationPhysicalUnit::setNistName(const std::string &nistName) |
| 124 | { |
| 125 | this->nistName = nistName; |
| 126 | } |
| 127 | |
| 128 | const std::string * DataSpecificationPhysicalUnit::getSourceOfDefinition() const |
| 129 | { |
| 130 | if (this->sourceOfDefinition.empty()) |
| 131 | return nullptr; |
| 132 | |
| 133 | return &this->sourceOfDefinition; |
| 134 | } |
| 135 | |
| 136 | void DataSpecificationPhysicalUnit::setSourceOfDefinition(const std::string &sourceOfDefinition) |
| 137 | { |
| 138 | this->sourceOfDefinition = sourceOfDefinition; |
| 139 | } |
| 140 | |
| 141 | const std::string * DataSpecificationPhysicalUnit::getConversionFactor() const |
| 142 | { |
| 143 | if (this->conversionFactor.empty()) |
| 144 | return nullptr; |
| 145 | |
| 146 | return &this->conversionFactor; |
| 147 | } |
| 148 | |
| 149 | void DataSpecificationPhysicalUnit::setConversionFactor(const std::string &conversionFactor) |
| 150 | { |
| 151 | this->conversionFactor = conversionFactor; |
| 152 | } |
| 153 | |
| 154 | const std::string * DataSpecificationPhysicalUnit::getRegistrationAuthorityId() const |
| 155 | { |
| 156 | if (this->registrationAuthorityId.empty()) |
| 157 | return nullptr; |
| 158 | |
| 159 | return &this->registrationAuthorityId; |
| 160 | } |
| 161 | |
| 162 | void DataSpecificationPhysicalUnit::setRegistrationAuthorityId(const std::string ®istrationAuthorityId) |
| 163 | { |
| 164 | this->registrationAuthorityId = registrationAuthorityId; |
| 165 | } |
| 166 | |
| 167 | const std::string * DataSpecificationPhysicalUnit::getSupplier() const |
| 168 | { |
| 169 | if (this->supplier.empty()) |
| 170 | return nullptr; |
| 171 | |
| 172 | return &this->supplier; |
| 173 | } |
| 174 | |
| 175 | void DataSpecificationPhysicalUnit::setSupplier(const std::string &supplier) |
| 176 | { |
| 177 | this->supplier = supplier; |
| 178 | } |
| 179 | |
| 180 | } |
| 181 | } |
| 182 | } |