1 #define LOG_TAG "android.audio.policy.capengine.configuration" 2 #include "android_audio_policy_capengine_configuration.h" 3 4 #include <assert.h> 5 #ifndef __BIONIC__ 6 #define __assert2(f,n,fun,e) do { fprintf(stderr, "%s:%d: %s: Assertion `%s' failed", (f), (n), (fun), (e)); abort(); } while (false) 7 #endif 8 #define _xsdc_assert(e) do if (!(e)) __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e); while (false) 9 10 namespace android { 11 namespace audio { 12 namespace policy { 13 namespace capengine { 14 namespace configuration { 15 template <class T> 16 constexpr void (*xmlDeleter)(T* t); 17 template <> 18 constexpr auto xmlDeleter<xmlDoc> = xmlFreeDoc; 19 template <> __anon8a341af30102(xmlChar *s) 20 auto xmlDeleter<xmlChar> = [](xmlChar *s) { xmlFree(s); }; 21 22 template <class T> make_xmlUnique(T * t)23 constexpr auto make_xmlUnique(T *t) { 24 auto deleter = [](T *t) { xmlDeleter<T>(t); }; 25 return std::unique_ptr<T, decltype(deleter)>{t, deleter}; 26 } 27 getXmlAttribute(const xmlNode * cur,const char * attribute)28 static std::string getXmlAttribute(const xmlNode *cur, const char *attribute) { 29 auto xmlValue = make_xmlUnique(xmlGetProp(cur, reinterpret_cast<const xmlChar*>(attribute))); 30 if (xmlValue == nullptr) { 31 return ""; 32 } 33 std::string value(reinterpret_cast<const char*>(xmlValue.get())); 34 return value; 35 } 36 readConfigurableDomains(const char * configFile)37 std::optional<ConfigurableDomains> readConfigurableDomains(const char* configFile) { 38 auto doc = make_xmlUnique(xmlParseFile(configFile)); 39 if (doc == nullptr) { 40 return std::nullopt; 41 } 42 xmlNodePtr _child = xmlDocGetRootElement(doc.get()); 43 if (_child == nullptr) { 44 return std::nullopt; 45 } 46 if (xmlXIncludeProcess(doc.get()) < 0) { 47 return std::nullopt; 48 } 49 50 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ConfigurableDomains"))) { 51 ConfigurableDomains _value = ConfigurableDomains::read(_child); 52 return _value; 53 } 54 return std::nullopt; 55 } 56 parseConfigurableDomains(const char * xml)57 std::optional<ConfigurableDomains> parseConfigurableDomains(const char* xml) { 58 auto doc = make_xmlUnique(xmlParseDoc(reinterpret_cast<const xmlChar*>(xml))); 59 if (doc == nullptr) { 60 return std::nullopt; 61 } 62 xmlNodePtr _child = xmlDocGetRootElement(doc.get()); 63 if (_child == nullptr) { 64 return std::nullopt; 65 } 66 if (xmlXIncludeProcess(doc.get()) < 0) { 67 return std::nullopt; 68 } 69 70 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ConfigurableDomains"))) { 71 ConfigurableDomains _value = ConfigurableDomains::read(_child); 72 return _value; 73 } 74 return std::nullopt; 75 } 76 77 BooleanParameterType(ParameterNameEnumType name,std::string value)78 BooleanParameterType::BooleanParameterType(ParameterNameEnumType name, std::string value) : name_(name), value_(value) { 79 } 80 getName() const81 const ParameterNameEnumType& BooleanParameterType::getName() const { 82 return name_; 83 } 84 hasName() const85 bool BooleanParameterType::hasName() const { 86 return true; 87 } 88 getValue() const89 const std::string& BooleanParameterType::getValue() const { 90 _xsdc_assert(hasValue()); 91 return value_.value(); 92 } 93 hasValue() const94 bool BooleanParameterType::hasValue() const { 95 return value_.has_value(); 96 } 97 read(xmlNode * root)98 BooleanParameterType BooleanParameterType::read(xmlNode *root) { 99 std::string _raw; 100 _raw = getXmlAttribute(root, "Name"); 101 ParameterNameEnumType name = ParameterNameEnumType::UNKNOWN; 102 if (_raw != "") { 103 ParameterNameEnumType _value = stringToParameterNameEnumType(_raw); 104 name = _value; 105 } 106 auto xmlValue = make_xmlUnique(xmlNodeListGetString(root->doc, root->xmlChildrenNode, 1)); 107 if (xmlValue == nullptr) { 108 _raw = ""; 109 } else { 110 _raw = reinterpret_cast<const char*>(xmlValue.get()); 111 } 112 std::string &_value = _raw; 113 BooleanParameterType instance(name, _value); 114 return instance; 115 } 116 IntegerParameterType(ParameterNameEnumType name,std::string value)117 IntegerParameterType::IntegerParameterType(ParameterNameEnumType name, std::string value) : name_(name), value_(value) { 118 } 119 getName() const120 const ParameterNameEnumType& IntegerParameterType::getName() const { 121 return name_; 122 } 123 hasName() const124 bool IntegerParameterType::hasName() const { 125 return true; 126 } 127 getValue() const128 const std::string& IntegerParameterType::getValue() const { 129 _xsdc_assert(hasValue()); 130 return value_.value(); 131 } 132 hasValue() const133 bool IntegerParameterType::hasValue() const { 134 return value_.has_value(); 135 } 136 read(xmlNode * root)137 IntegerParameterType IntegerParameterType::read(xmlNode *root) { 138 std::string _raw; 139 _raw = getXmlAttribute(root, "Name"); 140 ParameterNameEnumType name = ParameterNameEnumType::UNKNOWN; 141 if (_raw != "") { 142 ParameterNameEnumType _value = stringToParameterNameEnumType(_raw); 143 name = _value; 144 } 145 auto xmlValue = make_xmlUnique(xmlNodeListGetString(root->doc, root->xmlChildrenNode, 1)); 146 if (xmlValue == nullptr) { 147 _raw = ""; 148 } else { 149 _raw = reinterpret_cast<const char*>(xmlValue.get()); 150 } 151 std::string &_value = _raw; 152 IntegerParameterType instance(name, _value); 153 return instance; 154 } 155 EnumParameterType(ParameterNameEnumType name,std::string value)156 EnumParameterType::EnumParameterType(ParameterNameEnumType name, std::string value) : name_(name), value_(value) { 157 } 158 getName() const159 const ParameterNameEnumType& EnumParameterType::getName() const { 160 return name_; 161 } 162 hasName() const163 bool EnumParameterType::hasName() const { 164 return true; 165 } 166 getValue() const167 const std::string& EnumParameterType::getValue() const { 168 _xsdc_assert(hasValue()); 169 return value_.value(); 170 } 171 hasValue() const172 bool EnumParameterType::hasValue() const { 173 return value_.has_value(); 174 } 175 read(xmlNode * root)176 EnumParameterType EnumParameterType::read(xmlNode *root) { 177 std::string _raw; 178 _raw = getXmlAttribute(root, "Name"); 179 ParameterNameEnumType name = ParameterNameEnumType::UNKNOWN; 180 if (_raw != "") { 181 ParameterNameEnumType _value = stringToParameterNameEnumType(_raw); 182 name = _value; 183 } 184 auto xmlValue = make_xmlUnique(xmlNodeListGetString(root->doc, root->xmlChildrenNode, 1)); 185 if (xmlValue == nullptr) { 186 _raw = ""; 187 } else { 188 _raw = reinterpret_cast<const char*>(xmlValue.get()); 189 } 190 std::string &_value = _raw; 191 EnumParameterType instance(name, _value); 192 return instance; 193 } 194 PointParameterType(ParameterNameEnumType name,std::string value)195 PointParameterType::PointParameterType(ParameterNameEnumType name, std::string value) : name_(name), value_(value) { 196 } 197 getName() const198 const ParameterNameEnumType& PointParameterType::getName() const { 199 return name_; 200 } 201 hasName() const202 bool PointParameterType::hasName() const { 203 return true; 204 } 205 getValue() const206 const std::string& PointParameterType::getValue() const { 207 _xsdc_assert(hasValue()); 208 return value_.value(); 209 } 210 hasValue() const211 bool PointParameterType::hasValue() const { 212 return value_.has_value(); 213 } 214 read(xmlNode * root)215 PointParameterType PointParameterType::read(xmlNode *root) { 216 std::string _raw; 217 _raw = getXmlAttribute(root, "Name"); 218 ParameterNameEnumType name = ParameterNameEnumType::UNKNOWN; 219 if (_raw != "") { 220 ParameterNameEnumType _value = stringToParameterNameEnumType(_raw); 221 name = _value; 222 } 223 auto xmlValue = make_xmlUnique(xmlNodeListGetString(root->doc, root->xmlChildrenNode, 1)); 224 if (xmlValue == nullptr) { 225 _raw = ""; 226 } else { 227 _raw = reinterpret_cast<const char*>(xmlValue.get()); 228 } 229 std::string &_value = _raw; 230 PointParameterType instance(name, _value); 231 return instance; 232 } 233 BitParameterBlockType(std::vector<IntegerParameterType> bitParameter,ParameterNameEnumType name)234 BitParameterBlockType::BitParameterBlockType(std::vector<IntegerParameterType> bitParameter, ParameterNameEnumType name) : bitParameter_(std::move(bitParameter)), name_(name) { 235 } 236 getBitParameter() const237 const std::vector<IntegerParameterType>& BitParameterBlockType::getBitParameter() const { 238 return bitParameter_; 239 } 240 hasBitParameter() const241 bool BitParameterBlockType::hasBitParameter() const { 242 return !(bitParameter_.empty()); 243 } 244 getFirstBitParameter() const245 const IntegerParameterType* BitParameterBlockType::getFirstBitParameter() const { 246 if (bitParameter_.empty()) { 247 return nullptr; 248 } 249 return &bitParameter_[0]; 250 } 251 getName() const252 const ParameterNameEnumType& BitParameterBlockType::getName() const { 253 return name_; 254 } 255 hasName() const256 bool BitParameterBlockType::hasName() const { 257 return true; 258 } 259 read(xmlNode * root)260 BitParameterBlockType BitParameterBlockType::read(xmlNode *root) { 261 std::string _raw; 262 _raw = getXmlAttribute(root, "Name"); 263 ParameterNameEnumType name = ParameterNameEnumType::UNKNOWN; 264 if (_raw != "") { 265 ParameterNameEnumType _value = stringToParameterNameEnumType(_raw); 266 name = _value; 267 } 268 std::vector<IntegerParameterType> bitParameter; 269 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 270 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("BitParameter"))) { 271 IntegerParameterType _value = IntegerParameterType::read(_child); 272 bitParameter.push_back(std::move(_value)); 273 } 274 } 275 BitParameterBlockType instance(bitParameter, name); 276 return instance; 277 } 278 StringParameterType(ParameterNameEnumType name,std::string value)279 StringParameterType::StringParameterType(ParameterNameEnumType name, std::string value) : name_(name), value_(value) { 280 } 281 getName() const282 const ParameterNameEnumType& StringParameterType::getName() const { 283 return name_; 284 } 285 hasName() const286 bool StringParameterType::hasName() const { 287 return true; 288 } 289 getValue() const290 const std::string& StringParameterType::getValue() const { 291 _xsdc_assert(hasValue()); 292 return value_.value(); 293 } 294 hasValue() const295 bool StringParameterType::hasValue() const { 296 return value_.has_value(); 297 } 298 read(xmlNode * root)299 StringParameterType StringParameterType::read(xmlNode *root) { 300 std::string _raw; 301 _raw = getXmlAttribute(root, "Name"); 302 ParameterNameEnumType name = ParameterNameEnumType::UNKNOWN; 303 if (_raw != "") { 304 ParameterNameEnumType _value = stringToParameterNameEnumType(_raw); 305 name = _value; 306 } 307 auto xmlValue = make_xmlUnique(xmlNodeListGetString(root->doc, root->xmlChildrenNode, 1)); 308 if (xmlValue == nullptr) { 309 _raw = ""; 310 } else { 311 _raw = reinterpret_cast<const char*>(xmlValue.get()); 312 } 313 std::string &_value = _raw; 314 StringParameterType instance(name, _value); 315 return instance; 316 } 317 ParameterBlockType(std::vector<BooleanParameterType> booleanParameter_optional,std::vector<IntegerParameterType> integerParameter_optional,std::vector<EnumParameterType> enumParameter_optional,std::vector<PointParameterType> fixedPointParameter_optional,std::vector<PointParameterType> floatingPointParameter_optional,std::vector<BitParameterBlockType> bitParameterBlock_optional,std::vector<StringParameterType> stringParameter_optional,std::vector<ParameterBlockType> parameterBlock_optional,std::string name)318 ParameterBlockType::ParameterBlockType(std::vector<BooleanParameterType> booleanParameter_optional, std::vector<IntegerParameterType> integerParameter_optional, std::vector<EnumParameterType> enumParameter_optional, std::vector<PointParameterType> fixedPointParameter_optional, std::vector<PointParameterType> floatingPointParameter_optional, std::vector<BitParameterBlockType> bitParameterBlock_optional, std::vector<StringParameterType> stringParameter_optional, std::vector<ParameterBlockType> parameterBlock_optional, std::string name) : booleanParameter_optional_(std::move(booleanParameter_optional)), integerParameter_optional_(std::move(integerParameter_optional)), enumParameter_optional_(std::move(enumParameter_optional)), fixedPointParameter_optional_(std::move(fixedPointParameter_optional)), floatingPointParameter_optional_(std::move(floatingPointParameter_optional)), bitParameterBlock_optional_(std::move(bitParameterBlock_optional)), stringParameter_optional_(std::move(stringParameter_optional)), parameterBlock_optional_(std::move(parameterBlock_optional)), name_(std::move(name)) { 319 } 320 getBooleanParameter_optional() const321 const std::vector<BooleanParameterType>& ParameterBlockType::getBooleanParameter_optional() const { 322 return booleanParameter_optional_; 323 } 324 hasBooleanParameter_optional() const325 bool ParameterBlockType::hasBooleanParameter_optional() const { 326 return !(booleanParameter_optional_.empty()); 327 } 328 getFirstBooleanParameter_optional() const329 const BooleanParameterType* ParameterBlockType::getFirstBooleanParameter_optional() const { 330 if (booleanParameter_optional_.empty()) { 331 return nullptr; 332 } 333 return &booleanParameter_optional_[0]; 334 } 335 getIntegerParameter_optional() const336 const std::vector<IntegerParameterType>& ParameterBlockType::getIntegerParameter_optional() const { 337 return integerParameter_optional_; 338 } 339 hasIntegerParameter_optional() const340 bool ParameterBlockType::hasIntegerParameter_optional() const { 341 return !(integerParameter_optional_.empty()); 342 } 343 getFirstIntegerParameter_optional() const344 const IntegerParameterType* ParameterBlockType::getFirstIntegerParameter_optional() const { 345 if (integerParameter_optional_.empty()) { 346 return nullptr; 347 } 348 return &integerParameter_optional_[0]; 349 } 350 getEnumParameter_optional() const351 const std::vector<EnumParameterType>& ParameterBlockType::getEnumParameter_optional() const { 352 return enumParameter_optional_; 353 } 354 hasEnumParameter_optional() const355 bool ParameterBlockType::hasEnumParameter_optional() const { 356 return !(enumParameter_optional_.empty()); 357 } 358 getFirstEnumParameter_optional() const359 const EnumParameterType* ParameterBlockType::getFirstEnumParameter_optional() const { 360 if (enumParameter_optional_.empty()) { 361 return nullptr; 362 } 363 return &enumParameter_optional_[0]; 364 } 365 getFixedPointParameter_optional() const366 const std::vector<PointParameterType>& ParameterBlockType::getFixedPointParameter_optional() const { 367 return fixedPointParameter_optional_; 368 } 369 hasFixedPointParameter_optional() const370 bool ParameterBlockType::hasFixedPointParameter_optional() const { 371 return !(fixedPointParameter_optional_.empty()); 372 } 373 getFirstFixedPointParameter_optional() const374 const PointParameterType* ParameterBlockType::getFirstFixedPointParameter_optional() const { 375 if (fixedPointParameter_optional_.empty()) { 376 return nullptr; 377 } 378 return &fixedPointParameter_optional_[0]; 379 } 380 getFloatingPointParameter_optional() const381 const std::vector<PointParameterType>& ParameterBlockType::getFloatingPointParameter_optional() const { 382 return floatingPointParameter_optional_; 383 } 384 hasFloatingPointParameter_optional() const385 bool ParameterBlockType::hasFloatingPointParameter_optional() const { 386 return !(floatingPointParameter_optional_.empty()); 387 } 388 getFirstFloatingPointParameter_optional() const389 const PointParameterType* ParameterBlockType::getFirstFloatingPointParameter_optional() const { 390 if (floatingPointParameter_optional_.empty()) { 391 return nullptr; 392 } 393 return &floatingPointParameter_optional_[0]; 394 } 395 getBitParameterBlock_optional() const396 const std::vector<BitParameterBlockType>& ParameterBlockType::getBitParameterBlock_optional() const { 397 return bitParameterBlock_optional_; 398 } 399 hasBitParameterBlock_optional() const400 bool ParameterBlockType::hasBitParameterBlock_optional() const { 401 return !(bitParameterBlock_optional_.empty()); 402 } 403 getFirstBitParameterBlock_optional() const404 const BitParameterBlockType* ParameterBlockType::getFirstBitParameterBlock_optional() const { 405 if (bitParameterBlock_optional_.empty()) { 406 return nullptr; 407 } 408 return &bitParameterBlock_optional_[0]; 409 } 410 getStringParameter_optional() const411 const std::vector<StringParameterType>& ParameterBlockType::getStringParameter_optional() const { 412 return stringParameter_optional_; 413 } 414 hasStringParameter_optional() const415 bool ParameterBlockType::hasStringParameter_optional() const { 416 return !(stringParameter_optional_.empty()); 417 } 418 getFirstStringParameter_optional() const419 const StringParameterType* ParameterBlockType::getFirstStringParameter_optional() const { 420 if (stringParameter_optional_.empty()) { 421 return nullptr; 422 } 423 return &stringParameter_optional_[0]; 424 } 425 getParameterBlock_optional() const426 const std::vector<ParameterBlockType>& ParameterBlockType::getParameterBlock_optional() const { 427 return parameterBlock_optional_; 428 } 429 hasParameterBlock_optional() const430 bool ParameterBlockType::hasParameterBlock_optional() const { 431 return !(parameterBlock_optional_.empty()); 432 } 433 getFirstParameterBlock_optional() const434 const ParameterBlockType* ParameterBlockType::getFirstParameterBlock_optional() const { 435 if (parameterBlock_optional_.empty()) { 436 return nullptr; 437 } 438 return ¶meterBlock_optional_[0]; 439 } 440 getName() const441 const std::string& ParameterBlockType::getName() const { 442 return name_; 443 } 444 hasName() const445 bool ParameterBlockType::hasName() const { 446 return true; 447 } 448 read(xmlNode * root)449 ParameterBlockType ParameterBlockType::read(xmlNode *root) { 450 std::string _raw; 451 _raw = getXmlAttribute(root, "Name"); 452 std::string name{}; 453 if (_raw != "") { 454 std::string &_value = _raw; 455 name = _value; 456 } 457 std::vector<BooleanParameterType> booleanParameter_optional; 458 std::vector<IntegerParameterType> integerParameter_optional; 459 std::vector<EnumParameterType> enumParameter_optional; 460 std::vector<PointParameterType> fixedPointParameter_optional; 461 std::vector<PointParameterType> floatingPointParameter_optional; 462 std::vector<BitParameterBlockType> bitParameterBlock_optional; 463 std::vector<StringParameterType> stringParameter_optional; 464 std::vector<ParameterBlockType> parameterBlock_optional; 465 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 466 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("BooleanParameter"))) { 467 BooleanParameterType _value = BooleanParameterType::read(_child); 468 booleanParameter_optional.push_back(std::move(_value)); 469 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("IntegerParameter"))) { 470 IntegerParameterType _value = IntegerParameterType::read(_child); 471 integerParameter_optional.push_back(std::move(_value)); 472 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("EnumParameter"))) { 473 EnumParameterType _value = EnumParameterType::read(_child); 474 enumParameter_optional.push_back(std::move(_value)); 475 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("FixedPointParameter"))) { 476 PointParameterType _value = PointParameterType::read(_child); 477 fixedPointParameter_optional.push_back(std::move(_value)); 478 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("FloatingPointParameter"))) { 479 PointParameterType _value = PointParameterType::read(_child); 480 floatingPointParameter_optional.push_back(std::move(_value)); 481 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("BitParameterBlock"))) { 482 BitParameterBlockType _value = BitParameterBlockType::read(_child); 483 bitParameterBlock_optional.push_back(std::move(_value)); 484 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("StringParameter"))) { 485 StringParameterType _value = StringParameterType::read(_child); 486 stringParameter_optional.push_back(std::move(_value)); 487 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ParameterBlock"))) { 488 ParameterBlockType _value = ParameterBlockType::read(_child); 489 parameterBlock_optional.push_back(std::move(_value)); 490 } 491 } 492 ParameterBlockType instance(booleanParameter_optional, integerParameter_optional, enumParameter_optional, fixedPointParameter_optional, floatingPointParameter_optional, bitParameterBlock_optional, stringParameter_optional, parameterBlock_optional, name); 493 return instance; 494 } 495 SelectionCriterionRuleType(std::string selectionCriterion,MatchesWhenEnum matchesWhen,std::string value)496 SelectionCriterionRuleType::SelectionCriterionRuleType(std::string selectionCriterion, MatchesWhenEnum matchesWhen, std::string value) : selectionCriterion_(std::move(selectionCriterion)), matchesWhen_(matchesWhen), value_(std::move(value)) { 497 } 498 getSelectionCriterion() const499 const std::string& SelectionCriterionRuleType::getSelectionCriterion() const { 500 return selectionCriterion_; 501 } 502 hasSelectionCriterion() const503 bool SelectionCriterionRuleType::hasSelectionCriterion() const { 504 return true; 505 } 506 getMatchesWhen() const507 const MatchesWhenEnum& SelectionCriterionRuleType::getMatchesWhen() const { 508 return matchesWhen_; 509 } 510 hasMatchesWhen() const511 bool SelectionCriterionRuleType::hasMatchesWhen() const { 512 return true; 513 } 514 getValue() const515 const std::string& SelectionCriterionRuleType::getValue() const { 516 return value_; 517 } 518 hasValue() const519 bool SelectionCriterionRuleType::hasValue() const { 520 return true; 521 } 522 read(xmlNode * root)523 SelectionCriterionRuleType SelectionCriterionRuleType::read(xmlNode *root) { 524 std::string _raw; 525 _raw = getXmlAttribute(root, "SelectionCriterion"); 526 std::string selectionCriterion{}; 527 if (_raw != "") { 528 std::string &_value = _raw; 529 selectionCriterion = _value; 530 } 531 _raw = getXmlAttribute(root, "MatchesWhen"); 532 MatchesWhenEnum matchesWhen = MatchesWhenEnum::UNKNOWN; 533 if (_raw != "") { 534 MatchesWhenEnum _value = stringToMatchesWhenEnum(_raw); 535 matchesWhen = _value; 536 } 537 _raw = getXmlAttribute(root, "Value"); 538 std::string value{}; 539 if (_raw != "") { 540 std::string &_value = _raw; 541 value = _value; 542 } 543 SelectionCriterionRuleType instance(selectionCriterion, matchesWhen, value); 544 return instance; 545 } 546 CompoundRuleType(std::vector<CompoundRuleType> compoundRule_optional,std::vector<SelectionCriterionRuleType> selectionCriterionRule_optional,std::optional<TypeEnum> type)547 CompoundRuleType::CompoundRuleType(std::vector<CompoundRuleType> compoundRule_optional, std::vector<SelectionCriterionRuleType> selectionCriterionRule_optional, std::optional<TypeEnum> type) : compoundRule_optional_(std::move(compoundRule_optional)), selectionCriterionRule_optional_(std::move(selectionCriterionRule_optional)), type_(type) { 548 } 549 getCompoundRule_optional() const550 const std::vector<CompoundRuleType>& CompoundRuleType::getCompoundRule_optional() const { 551 return compoundRule_optional_; 552 } 553 hasCompoundRule_optional() const554 bool CompoundRuleType::hasCompoundRule_optional() const { 555 return !(compoundRule_optional_.empty()); 556 } 557 getFirstCompoundRule_optional() const558 const CompoundRuleType* CompoundRuleType::getFirstCompoundRule_optional() const { 559 if (compoundRule_optional_.empty()) { 560 return nullptr; 561 } 562 return &compoundRule_optional_[0]; 563 } 564 getSelectionCriterionRule_optional() const565 const std::vector<SelectionCriterionRuleType>& CompoundRuleType::getSelectionCriterionRule_optional() const { 566 return selectionCriterionRule_optional_; 567 } 568 hasSelectionCriterionRule_optional() const569 bool CompoundRuleType::hasSelectionCriterionRule_optional() const { 570 return !(selectionCriterionRule_optional_.empty()); 571 } 572 getFirstSelectionCriterionRule_optional() const573 const SelectionCriterionRuleType* CompoundRuleType::getFirstSelectionCriterionRule_optional() const { 574 if (selectionCriterionRule_optional_.empty()) { 575 return nullptr; 576 } 577 return &selectionCriterionRule_optional_[0]; 578 } 579 getType() const580 const TypeEnum& CompoundRuleType::getType() const { 581 _xsdc_assert(hasType()); 582 return type_.value(); 583 } 584 hasType() const585 bool CompoundRuleType::hasType() const { 586 return type_.has_value(); 587 } 588 read(xmlNode * root)589 CompoundRuleType CompoundRuleType::read(xmlNode *root) { 590 std::string _raw; 591 _raw = getXmlAttribute(root, "Type"); 592 std::optional<TypeEnum> type = std::nullopt; 593 if (_raw != "") { 594 TypeEnum _value = stringToTypeEnum(_raw); 595 type = _value; 596 } 597 std::vector<CompoundRuleType> compoundRule_optional; 598 std::vector<SelectionCriterionRuleType> selectionCriterionRule_optional; 599 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 600 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("CompoundRule"))) { 601 CompoundRuleType _value = CompoundRuleType::read(_child); 602 compoundRule_optional.push_back(std::move(_value)); 603 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("SelectionCriterionRule"))) { 604 SelectionCriterionRuleType _value = SelectionCriterionRuleType::read(_child); 605 selectionCriterionRule_optional.push_back(std::move(_value)); 606 } 607 } 608 CompoundRuleType instance(compoundRule_optional, selectionCriterionRule_optional, type); 609 return instance; 610 } 611 Configuration(std::vector<CompoundRuleType> compoundRule,std::string name)612 ConfigurationsType::Configuration::Configuration(std::vector<CompoundRuleType> compoundRule, std::string name) : compoundRule_(std::move(compoundRule)), name_(std::move(name)) { 613 } 614 getCompoundRule() const615 const std::vector<CompoundRuleType>& ConfigurationsType::Configuration::getCompoundRule() const { 616 return compoundRule_; 617 } 618 hasCompoundRule() const619 bool ConfigurationsType::Configuration::hasCompoundRule() const { 620 return !(compoundRule_.empty()); 621 } 622 getFirstCompoundRule() const623 const CompoundRuleType* ConfigurationsType::Configuration::getFirstCompoundRule() const { 624 if (compoundRule_.empty()) { 625 return nullptr; 626 } 627 return &compoundRule_[0]; 628 } 629 getName() const630 const std::string& ConfigurationsType::Configuration::getName() const { 631 return name_; 632 } 633 hasName() const634 bool ConfigurationsType::Configuration::hasName() const { 635 return true; 636 } 637 read(xmlNode * root)638 ConfigurationsType::Configuration ConfigurationsType::Configuration::read(xmlNode *root) { 639 std::string _raw; 640 _raw = getXmlAttribute(root, "Name"); 641 std::string name{}; 642 if (_raw != "") { 643 std::string &_value = _raw; 644 name = _value; 645 } 646 std::vector<CompoundRuleType> compoundRule; 647 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 648 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("CompoundRule"))) { 649 CompoundRuleType _value = CompoundRuleType::read(_child); 650 compoundRule.push_back(std::move(_value)); 651 } 652 } 653 ConfigurationsType::Configuration instance(compoundRule, name); 654 return instance; 655 } 656 ConfigurationsType(std::vector<Configuration> configuration)657 ConfigurationsType::ConfigurationsType(std::vector<Configuration> configuration) : configuration_(std::move(configuration)) { 658 } 659 getConfiguration() const660 const std::vector<ConfigurationsType::Configuration>& ConfigurationsType::getConfiguration() const { 661 return configuration_; 662 } 663 hasConfiguration() const664 bool ConfigurationsType::hasConfiguration() const { 665 return !(configuration_.empty()); 666 } 667 getFirstConfiguration() const668 const ConfigurationsType::Configuration* ConfigurationsType::getFirstConfiguration() const { 669 if (configuration_.empty()) { 670 return nullptr; 671 } 672 return &configuration_[0]; 673 } 674 read(xmlNode * root)675 ConfigurationsType ConfigurationsType::read(xmlNode *root) { 676 std::string _raw; 677 std::vector<Configuration> configuration; 678 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 679 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("Configuration"))) { 680 Configuration _value = Configuration::read(_child); 681 configuration.push_back(std::move(_value)); 682 } 683 } 684 ConfigurationsType instance(configuration); 685 return instance; 686 } 687 ComponentType(std::vector<ComponentType> subsystem_optional,std::string name)688 ComponentType::ComponentType(std::vector<ComponentType> subsystem_optional, std::string name) : subsystem_optional_(std::move(subsystem_optional)), name_(std::move(name)) { 689 } 690 getSubsystem_optional() const691 const std::vector<ComponentType>& ComponentType::getSubsystem_optional() const { 692 return subsystem_optional_; 693 } 694 hasSubsystem_optional() const695 bool ComponentType::hasSubsystem_optional() const { 696 return !(subsystem_optional_.empty()); 697 } 698 getFirstSubsystem_optional() const699 const ComponentType* ComponentType::getFirstSubsystem_optional() const { 700 if (subsystem_optional_.empty()) { 701 return nullptr; 702 } 703 return &subsystem_optional_[0]; 704 } 705 getName() const706 const std::string& ComponentType::getName() const { 707 return name_; 708 } 709 hasName() const710 bool ComponentType::hasName() const { 711 return true; 712 } 713 read(xmlNode * root)714 ComponentType ComponentType::read(xmlNode *root) { 715 std::string _raw; 716 _raw = getXmlAttribute(root, "Name"); 717 std::string name{}; 718 if (_raw != "") { 719 std::string &_value = _raw; 720 name = _value; 721 } 722 std::vector<ComponentType> subsystem_optional; 723 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 724 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("Subsystem"))) { 725 ComponentType _value = ComponentType::read(_child); 726 subsystem_optional.push_back(std::move(_value)); 727 } 728 } 729 ComponentType instance(subsystem_optional, name); 730 return instance; 731 } 732 ConfigurableElement(std::string path)733 ConfigurableElementsType::ConfigurableElement::ConfigurableElement(std::string path) : path_(std::move(path)) { 734 } 735 getPath() const736 const std::string& ConfigurableElementsType::ConfigurableElement::getPath() const { 737 return path_; 738 } 739 hasPath() const740 bool ConfigurableElementsType::ConfigurableElement::hasPath() const { 741 return true; 742 } 743 read(xmlNode * root)744 ConfigurableElementsType::ConfigurableElement ConfigurableElementsType::ConfigurableElement::read(xmlNode *root) { 745 std::string _raw; 746 _raw = getXmlAttribute(root, "Path"); 747 std::string path{}; 748 if (_raw != "") { 749 std::string &_value = _raw; 750 path = _value; 751 } 752 ConfigurableElementsType::ConfigurableElement instance(path); 753 return instance; 754 } 755 ConfigurableElementsType(std::vector<ConfigurableElement> configurableElement)756 ConfigurableElementsType::ConfigurableElementsType(std::vector<ConfigurableElement> configurableElement) : configurableElement_(std::move(configurableElement)) { 757 } 758 getConfigurableElement() const759 const std::vector<ConfigurableElementsType::ConfigurableElement>& ConfigurableElementsType::getConfigurableElement() const { 760 return configurableElement_; 761 } 762 hasConfigurableElement() const763 bool ConfigurableElementsType::hasConfigurableElement() const { 764 return !(configurableElement_.empty()); 765 } 766 getFirstConfigurableElement() const767 const ConfigurableElementsType::ConfigurableElement* ConfigurableElementsType::getFirstConfigurableElement() const { 768 if (configurableElement_.empty()) { 769 return nullptr; 770 } 771 return &configurableElement_[0]; 772 } 773 read(xmlNode * root)774 ConfigurableElementsType ConfigurableElementsType::read(xmlNode *root) { 775 std::string _raw; 776 std::vector<ConfigurableElement> configurableElement; 777 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 778 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ConfigurableElement"))) { 779 ConfigurableElement _value = ConfigurableElement::read(_child); 780 configurableElement.push_back(std::move(_value)); 781 } 782 } 783 ConfigurableElementsType instance(configurableElement); 784 return instance; 785 } 786 ConfigurableElementSettingsType(std::vector<BooleanParameterType> booleanParameter_optional,std::vector<IntegerParameterType> integerParameter_optional,std::vector<EnumParameterType> enumParameter_optional,std::vector<PointParameterType> fixedPointParameter_optional,std::vector<PointParameterType> floatingPointParameter_optional,std::vector<IntegerParameterType> bitParameter_optional,std::vector<BitParameterBlockType> bitParameterBlock_optional,std::vector<StringParameterType> stringParameter_optional,std::vector<ParameterBlockType> parameterBlock_optional,std::string path)787 ConfigurableElementSettingsType::ConfigurableElementSettingsType(std::vector<BooleanParameterType> booleanParameter_optional, std::vector<IntegerParameterType> integerParameter_optional, std::vector<EnumParameterType> enumParameter_optional, std::vector<PointParameterType> fixedPointParameter_optional, std::vector<PointParameterType> floatingPointParameter_optional, std::vector<IntegerParameterType> bitParameter_optional, std::vector<BitParameterBlockType> bitParameterBlock_optional, std::vector<StringParameterType> stringParameter_optional, std::vector<ParameterBlockType> parameterBlock_optional, std::string path) : booleanParameter_optional_(std::move(booleanParameter_optional)), integerParameter_optional_(std::move(integerParameter_optional)), enumParameter_optional_(std::move(enumParameter_optional)), fixedPointParameter_optional_(std::move(fixedPointParameter_optional)), floatingPointParameter_optional_(std::move(floatingPointParameter_optional)), bitParameter_optional_(std::move(bitParameter_optional)), bitParameterBlock_optional_(std::move(bitParameterBlock_optional)), stringParameter_optional_(std::move(stringParameter_optional)), parameterBlock_optional_(std::move(parameterBlock_optional)), path_(std::move(path)) { 788 } 789 getBooleanParameter_optional() const790 const std::vector<BooleanParameterType>& ConfigurableElementSettingsType::getBooleanParameter_optional() const { 791 return booleanParameter_optional_; 792 } 793 hasBooleanParameter_optional() const794 bool ConfigurableElementSettingsType::hasBooleanParameter_optional() const { 795 return !(booleanParameter_optional_.empty()); 796 } 797 getFirstBooleanParameter_optional() const798 const BooleanParameterType* ConfigurableElementSettingsType::getFirstBooleanParameter_optional() const { 799 if (booleanParameter_optional_.empty()) { 800 return nullptr; 801 } 802 return &booleanParameter_optional_[0]; 803 } 804 getIntegerParameter_optional() const805 const std::vector<IntegerParameterType>& ConfigurableElementSettingsType::getIntegerParameter_optional() const { 806 return integerParameter_optional_; 807 } 808 hasIntegerParameter_optional() const809 bool ConfigurableElementSettingsType::hasIntegerParameter_optional() const { 810 return !(integerParameter_optional_.empty()); 811 } 812 getFirstIntegerParameter_optional() const813 const IntegerParameterType* ConfigurableElementSettingsType::getFirstIntegerParameter_optional() const { 814 if (integerParameter_optional_.empty()) { 815 return nullptr; 816 } 817 return &integerParameter_optional_[0]; 818 } 819 getEnumParameter_optional() const820 const std::vector<EnumParameterType>& ConfigurableElementSettingsType::getEnumParameter_optional() const { 821 return enumParameter_optional_; 822 } 823 hasEnumParameter_optional() const824 bool ConfigurableElementSettingsType::hasEnumParameter_optional() const { 825 return !(enumParameter_optional_.empty()); 826 } 827 getFirstEnumParameter_optional() const828 const EnumParameterType* ConfigurableElementSettingsType::getFirstEnumParameter_optional() const { 829 if (enumParameter_optional_.empty()) { 830 return nullptr; 831 } 832 return &enumParameter_optional_[0]; 833 } 834 getFixedPointParameter_optional() const835 const std::vector<PointParameterType>& ConfigurableElementSettingsType::getFixedPointParameter_optional() const { 836 return fixedPointParameter_optional_; 837 } 838 hasFixedPointParameter_optional() const839 bool ConfigurableElementSettingsType::hasFixedPointParameter_optional() const { 840 return !(fixedPointParameter_optional_.empty()); 841 } 842 getFirstFixedPointParameter_optional() const843 const PointParameterType* ConfigurableElementSettingsType::getFirstFixedPointParameter_optional() const { 844 if (fixedPointParameter_optional_.empty()) { 845 return nullptr; 846 } 847 return &fixedPointParameter_optional_[0]; 848 } 849 getFloatingPointParameter_optional() const850 const std::vector<PointParameterType>& ConfigurableElementSettingsType::getFloatingPointParameter_optional() const { 851 return floatingPointParameter_optional_; 852 } 853 hasFloatingPointParameter_optional() const854 bool ConfigurableElementSettingsType::hasFloatingPointParameter_optional() const { 855 return !(floatingPointParameter_optional_.empty()); 856 } 857 getFirstFloatingPointParameter_optional() const858 const PointParameterType* ConfigurableElementSettingsType::getFirstFloatingPointParameter_optional() const { 859 if (floatingPointParameter_optional_.empty()) { 860 return nullptr; 861 } 862 return &floatingPointParameter_optional_[0]; 863 } 864 getBitParameter_optional() const865 const std::vector<IntegerParameterType>& ConfigurableElementSettingsType::getBitParameter_optional() const { 866 return bitParameter_optional_; 867 } 868 hasBitParameter_optional() const869 bool ConfigurableElementSettingsType::hasBitParameter_optional() const { 870 return !(bitParameter_optional_.empty()); 871 } 872 getFirstBitParameter_optional() const873 const IntegerParameterType* ConfigurableElementSettingsType::getFirstBitParameter_optional() const { 874 if (bitParameter_optional_.empty()) { 875 return nullptr; 876 } 877 return &bitParameter_optional_[0]; 878 } 879 getBitParameterBlock_optional() const880 const std::vector<BitParameterBlockType>& ConfigurableElementSettingsType::getBitParameterBlock_optional() const { 881 return bitParameterBlock_optional_; 882 } 883 hasBitParameterBlock_optional() const884 bool ConfigurableElementSettingsType::hasBitParameterBlock_optional() const { 885 return !(bitParameterBlock_optional_.empty()); 886 } 887 getFirstBitParameterBlock_optional() const888 const BitParameterBlockType* ConfigurableElementSettingsType::getFirstBitParameterBlock_optional() const { 889 if (bitParameterBlock_optional_.empty()) { 890 return nullptr; 891 } 892 return &bitParameterBlock_optional_[0]; 893 } 894 getStringParameter_optional() const895 const std::vector<StringParameterType>& ConfigurableElementSettingsType::getStringParameter_optional() const { 896 return stringParameter_optional_; 897 } 898 hasStringParameter_optional() const899 bool ConfigurableElementSettingsType::hasStringParameter_optional() const { 900 return !(stringParameter_optional_.empty()); 901 } 902 getFirstStringParameter_optional() const903 const StringParameterType* ConfigurableElementSettingsType::getFirstStringParameter_optional() const { 904 if (stringParameter_optional_.empty()) { 905 return nullptr; 906 } 907 return &stringParameter_optional_[0]; 908 } 909 getParameterBlock_optional() const910 const std::vector<ParameterBlockType>& ConfigurableElementSettingsType::getParameterBlock_optional() const { 911 return parameterBlock_optional_; 912 } 913 hasParameterBlock_optional() const914 bool ConfigurableElementSettingsType::hasParameterBlock_optional() const { 915 return !(parameterBlock_optional_.empty()); 916 } 917 getFirstParameterBlock_optional() const918 const ParameterBlockType* ConfigurableElementSettingsType::getFirstParameterBlock_optional() const { 919 if (parameterBlock_optional_.empty()) { 920 return nullptr; 921 } 922 return ¶meterBlock_optional_[0]; 923 } 924 getPath() const925 const std::string& ConfigurableElementSettingsType::getPath() const { 926 return path_; 927 } 928 hasPath() const929 bool ConfigurableElementSettingsType::hasPath() const { 930 return true; 931 } 932 read(xmlNode * root)933 ConfigurableElementSettingsType ConfigurableElementSettingsType::read(xmlNode *root) { 934 std::string _raw; 935 _raw = getXmlAttribute(root, "Path"); 936 std::string path{}; 937 if (_raw != "") { 938 std::string &_value = _raw; 939 path = _value; 940 } 941 std::vector<BooleanParameterType> booleanParameter_optional; 942 std::vector<IntegerParameterType> integerParameter_optional; 943 std::vector<EnumParameterType> enumParameter_optional; 944 std::vector<PointParameterType> fixedPointParameter_optional; 945 std::vector<PointParameterType> floatingPointParameter_optional; 946 std::vector<IntegerParameterType> bitParameter_optional; 947 std::vector<BitParameterBlockType> bitParameterBlock_optional; 948 std::vector<StringParameterType> stringParameter_optional; 949 std::vector<ParameterBlockType> parameterBlock_optional; 950 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 951 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("BooleanParameter"))) { 952 BooleanParameterType _value = BooleanParameterType::read(_child); 953 booleanParameter_optional.push_back(std::move(_value)); 954 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("IntegerParameter"))) { 955 IntegerParameterType _value = IntegerParameterType::read(_child); 956 integerParameter_optional.push_back(std::move(_value)); 957 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("EnumParameter"))) { 958 EnumParameterType _value = EnumParameterType::read(_child); 959 enumParameter_optional.push_back(std::move(_value)); 960 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("FixedPointParameter"))) { 961 PointParameterType _value = PointParameterType::read(_child); 962 fixedPointParameter_optional.push_back(std::move(_value)); 963 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("FloatingPointParameter"))) { 964 PointParameterType _value = PointParameterType::read(_child); 965 floatingPointParameter_optional.push_back(std::move(_value)); 966 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("BitParameter"))) { 967 IntegerParameterType _value = IntegerParameterType::read(_child); 968 bitParameter_optional.push_back(std::move(_value)); 969 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("BitParameterBlock"))) { 970 BitParameterBlockType _value = BitParameterBlockType::read(_child); 971 bitParameterBlock_optional.push_back(std::move(_value)); 972 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("StringParameter"))) { 973 StringParameterType _value = StringParameterType::read(_child); 974 stringParameter_optional.push_back(std::move(_value)); 975 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ParameterBlock"))) { 976 ParameterBlockType _value = ParameterBlockType::read(_child); 977 parameterBlock_optional.push_back(std::move(_value)); 978 } 979 } 980 ConfigurableElementSettingsType instance(booleanParameter_optional, integerParameter_optional, enumParameter_optional, fixedPointParameter_optional, floatingPointParameter_optional, bitParameter_optional, bitParameterBlock_optional, stringParameter_optional, parameterBlock_optional, path); 981 return instance; 982 } 983 Configuration(std::vector<ConfigurableElementSettingsType> configurableElement,std::string name)984 SettingsType::Configuration::Configuration(std::vector<ConfigurableElementSettingsType> configurableElement, std::string name) : configurableElement_(std::move(configurableElement)), name_(std::move(name)) { 985 } 986 getConfigurableElement() const987 const std::vector<ConfigurableElementSettingsType>& SettingsType::Configuration::getConfigurableElement() const { 988 return configurableElement_; 989 } 990 hasConfigurableElement() const991 bool SettingsType::Configuration::hasConfigurableElement() const { 992 return !(configurableElement_.empty()); 993 } 994 getFirstConfigurableElement() const995 const ConfigurableElementSettingsType* SettingsType::Configuration::getFirstConfigurableElement() const { 996 if (configurableElement_.empty()) { 997 return nullptr; 998 } 999 return &configurableElement_[0]; 1000 } 1001 getName() const1002 const std::string& SettingsType::Configuration::getName() const { 1003 return name_; 1004 } 1005 hasName() const1006 bool SettingsType::Configuration::hasName() const { 1007 return true; 1008 } 1009 read(xmlNode * root)1010 SettingsType::Configuration SettingsType::Configuration::read(xmlNode *root) { 1011 std::string _raw; 1012 _raw = getXmlAttribute(root, "Name"); 1013 std::string name{}; 1014 if (_raw != "") { 1015 std::string &_value = _raw; 1016 name = _value; 1017 } 1018 std::vector<ConfigurableElementSettingsType> configurableElement; 1019 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1020 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ConfigurableElement"))) { 1021 ConfigurableElementSettingsType _value = ConfigurableElementSettingsType::read(_child); 1022 configurableElement.push_back(std::move(_value)); 1023 } 1024 } 1025 SettingsType::Configuration instance(configurableElement, name); 1026 return instance; 1027 } 1028 SettingsType(std::vector<Configuration> configuration)1029 SettingsType::SettingsType(std::vector<Configuration> configuration) : configuration_(std::move(configuration)) { 1030 } 1031 getConfiguration() const1032 const std::vector<SettingsType::Configuration>& SettingsType::getConfiguration() const { 1033 return configuration_; 1034 } 1035 hasConfiguration() const1036 bool SettingsType::hasConfiguration() const { 1037 return !(configuration_.empty()); 1038 } 1039 getFirstConfiguration() const1040 const SettingsType::Configuration* SettingsType::getFirstConfiguration() const { 1041 if (configuration_.empty()) { 1042 return nullptr; 1043 } 1044 return &configuration_[0]; 1045 } 1046 read(xmlNode * root)1047 SettingsType SettingsType::read(xmlNode *root) { 1048 std::string _raw; 1049 std::vector<Configuration> configuration; 1050 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1051 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("Configuration"))) { 1052 Configuration _value = Configuration::read(_child); 1053 configuration.push_back(std::move(_value)); 1054 } 1055 } 1056 SettingsType instance(configuration); 1057 return instance; 1058 } 1059 ConfigurableDomainType(std::vector<ConfigurationsType> configurations,std::vector<ConfigurableElementsType> configurableElements,std::vector<SettingsType> settings,std::string name,std::optional<bool> sequenceAware)1060 ConfigurableDomainType::ConfigurableDomainType(std::vector<ConfigurationsType> configurations, std::vector<ConfigurableElementsType> configurableElements, std::vector<SettingsType> settings, std::string name, std::optional<bool> sequenceAware) : configurations_(std::move(configurations)), configurableElements_(std::move(configurableElements)), settings_(std::move(settings)), name_(std::move(name)), sequenceAware_(sequenceAware) { 1061 } 1062 getConfigurations() const1063 const std::vector<ConfigurationsType>& ConfigurableDomainType::getConfigurations() const { 1064 return configurations_; 1065 } 1066 hasConfigurations() const1067 bool ConfigurableDomainType::hasConfigurations() const { 1068 return !(configurations_.empty()); 1069 } 1070 getFirstConfigurations() const1071 const ConfigurationsType* ConfigurableDomainType::getFirstConfigurations() const { 1072 if (configurations_.empty()) { 1073 return nullptr; 1074 } 1075 return &configurations_[0]; 1076 } 1077 getConfigurableElements() const1078 const std::vector<ConfigurableElementsType>& ConfigurableDomainType::getConfigurableElements() const { 1079 return configurableElements_; 1080 } 1081 hasConfigurableElements() const1082 bool ConfigurableDomainType::hasConfigurableElements() const { 1083 return !(configurableElements_.empty()); 1084 } 1085 getFirstConfigurableElements() const1086 const ConfigurableElementsType* ConfigurableDomainType::getFirstConfigurableElements() const { 1087 if (configurableElements_.empty()) { 1088 return nullptr; 1089 } 1090 return &configurableElements_[0]; 1091 } 1092 getSettings() const1093 const std::vector<SettingsType>& ConfigurableDomainType::getSettings() const { 1094 return settings_; 1095 } 1096 hasSettings() const1097 bool ConfigurableDomainType::hasSettings() const { 1098 return !(settings_.empty()); 1099 } 1100 getFirstSettings() const1101 const SettingsType* ConfigurableDomainType::getFirstSettings() const { 1102 if (settings_.empty()) { 1103 return nullptr; 1104 } 1105 return &settings_[0]; 1106 } 1107 getName() const1108 const std::string& ConfigurableDomainType::getName() const { 1109 return name_; 1110 } 1111 hasName() const1112 bool ConfigurableDomainType::hasName() const { 1113 return true; 1114 } 1115 getSequenceAware() const1116 const bool& ConfigurableDomainType::getSequenceAware() const { 1117 _xsdc_assert(hasSequenceAware()); 1118 return sequenceAware_.value(); 1119 } 1120 hasSequenceAware() const1121 bool ConfigurableDomainType::hasSequenceAware() const { 1122 return sequenceAware_.has_value(); 1123 } 1124 read(xmlNode * root)1125 ConfigurableDomainType ConfigurableDomainType::read(xmlNode *root) { 1126 std::string _raw; 1127 _raw = getXmlAttribute(root, "Name"); 1128 std::string name{}; 1129 if (_raw != "") { 1130 std::string &_value = _raw; 1131 name = _value; 1132 } 1133 _raw = getXmlAttribute(root, "SequenceAware"); 1134 std::optional<bool> sequenceAware = std::nullopt; 1135 if (_raw != "") { 1136 bool _value = _raw == "true"; 1137 sequenceAware = _value; 1138 } 1139 std::vector<ConfigurationsType> configurations; 1140 std::vector<ConfigurableElementsType> configurableElements; 1141 std::vector<SettingsType> settings; 1142 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1143 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("Configurations"))) { 1144 ConfigurationsType _value = ConfigurationsType::read(_child); 1145 configurations.push_back(std::move(_value)); 1146 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ConfigurableElements"))) { 1147 ConfigurableElementsType _value = ConfigurableElementsType::read(_child); 1148 configurableElements.push_back(std::move(_value)); 1149 } else if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("Settings"))) { 1150 SettingsType _value = SettingsType::read(_child); 1151 settings.push_back(std::move(_value)); 1152 } 1153 } 1154 ConfigurableDomainType instance(configurations, configurableElements, settings, name, sequenceAware); 1155 return instance; 1156 } 1157 ConfigurableDomains(std::vector<ConfigurableDomainType> configurableDomain,std::string systemClassName)1158 ConfigurableDomains::ConfigurableDomains(std::vector<ConfigurableDomainType> configurableDomain, std::string systemClassName) : configurableDomain_(std::move(configurableDomain)), systemClassName_(std::move(systemClassName)) { 1159 } 1160 getConfigurableDomain() const1161 const std::vector<ConfigurableDomainType>& ConfigurableDomains::getConfigurableDomain() const { 1162 return configurableDomain_; 1163 } 1164 hasConfigurableDomain() const1165 bool ConfigurableDomains::hasConfigurableDomain() const { 1166 return !(configurableDomain_.empty()); 1167 } 1168 getFirstConfigurableDomain() const1169 const ConfigurableDomainType* ConfigurableDomains::getFirstConfigurableDomain() const { 1170 if (configurableDomain_.empty()) { 1171 return nullptr; 1172 } 1173 return &configurableDomain_[0]; 1174 } 1175 getSystemClassName() const1176 const std::string& ConfigurableDomains::getSystemClassName() const { 1177 return systemClassName_; 1178 } 1179 hasSystemClassName() const1180 bool ConfigurableDomains::hasSystemClassName() const { 1181 return true; 1182 } 1183 read(xmlNode * root)1184 ConfigurableDomains ConfigurableDomains::read(xmlNode *root) { 1185 std::string _raw; 1186 _raw = getXmlAttribute(root, "SystemClassName"); 1187 std::string systemClassName{}; 1188 if (_raw != "") { 1189 std::string &_value = _raw; 1190 systemClassName = _value; 1191 } 1192 std::vector<ConfigurableDomainType> configurableDomain; 1193 for (auto *_child = root->xmlChildrenNode; _child != nullptr; _child = _child->next) { 1194 if (!xmlStrcmp(_child->name, reinterpret_cast<const xmlChar*>("ConfigurableDomain"))) { 1195 ConfigurableDomainType _value = ConfigurableDomainType::read(_child); 1196 configurableDomain.push_back(std::move(_value)); 1197 } 1198 } 1199 ConfigurableDomains instance(configurableDomain, systemClassName); 1200 return instance; 1201 } 1202 } // configuration 1203 } // capengine 1204 } // policy 1205 } // audio 1206 } // android 1207