1 /** 2 * @file SedListOfSetValues.h 3 * @brief Definition of the SedListOfSetValues class. 4 * @author DEVISER 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSEDML. Please visit http://sed-ml.org for more 8 * information about SED-ML. The latest version of libSEDML can be found on 9 * github: https://github.com/fbergmann/libSEDML/ 10 * 11 12 * Copyright (c) 2013-2019, Frank T. Bergmann 13 * All rights reserved. 14 * 15 16 * Redistribution and use in source and binary forms, with or without 17 * modification, are permitted provided that the following conditions are met: 18 * 19 20 * 1. Redistributions of source code must retain the above copyright notice, 21 * this 22 * list of conditions and the following disclaimer. 23 * 2. Redistributions in binary form must reproduce the above copyright notice, 24 * this list of conditions and the following disclaimer in the documentation 25 * and/or other materials provided with the distribution. 26 * 27 * This library is free software; you can redistribute it and/or modify it 28 * under the terms of the GNU Lesser General Public License as published by the 29 * Free Software Foundation. A copy of the license agreement is provided in the 30 * file named "LICENSE.txt" included with this software distribution and also 31 * available online as http://sbml.org/software/libsbml/license.html 32 * ------------------------------------------------------------------------ --> 33 * 34 * @class SedListOfSetValues 35 * @sbmlbrief{sedml} TODO:Definition of the SedListOfSetValues class. 36 */ 37 38 39 #ifndef SedListOfSetValues_H__ 40 #define SedListOfSetValues_H__ 41 42 43 #include <sedml/common/extern.h> 44 #include <sedml/common/sedmlfwd.h> 45 46 47 #ifdef __cplusplus 48 49 50 #include <string> 51 52 53 #include <sedml/SedListOf.h> 54 #include <sedml/SedSetValue.h> 55 #include <sbml/common/libsbml-namespace.h> 56 57 58 LIBSEDML_CPP_NAMESPACE_BEGIN 59 60 61 class LIBSEDML_EXTERN SedListOfSetValues : public SedListOf 62 { 63 64 public: 65 66 /** 67 * Creates a new SedListOfSetValues using the given SED-ML Level and @ p 68 * version values. 69 * 70 * @param level an unsigned int, the SED-ML Level to assign to this 71 * SedListOfSetValues. 72 * 73 * @param version an unsigned int, the SED-ML Version to assign to this 74 * SedListOfSetValues. 75 * 76 * @copydetails doc_note_setting_lv_pkg 77 */ 78 SedListOfSetValues(unsigned int level = SEDML_DEFAULT_LEVEL, 79 unsigned int version = SEDML_DEFAULT_VERSION); 80 81 82 /** 83 * Creates a new SedListOfSetValues using the given SedNamespaces object @p 84 * sedmlns. 85 * 86 * @param sedmlns the SedNamespaces object. 87 * 88 * @copydetails doc_note_setting_lv_pkg 89 */ 90 SedListOfSetValues(SedNamespaces *sedmlns); 91 92 93 /** 94 * Copy constructor for SedListOfSetValues. 95 * 96 * @param orig the SedListOfSetValues instance to copy. 97 */ 98 SedListOfSetValues(const SedListOfSetValues& orig); 99 100 101 /** 102 * Assignment operator for SedListOfSetValues. 103 * 104 * @param rhs the SedListOfSetValues object whose values are to be used as 105 * the basis of the assignment. 106 */ 107 SedListOfSetValues& operator=(const SedListOfSetValues& rhs); 108 109 110 /** 111 * Creates and returns a deep copy of this SedListOfSetValues object. 112 * 113 * @return a (deep) copy of this SedListOfSetValues object. 114 */ 115 virtual SedListOfSetValues* clone() const; 116 117 118 /** 119 * Destructor for SedListOfSetValues. 120 */ 121 virtual ~SedListOfSetValues(); 122 123 124 /** 125 * Get a SedSetValue from the SedListOfSetValues. 126 * 127 * @param n an unsigned int representing the index of the SedSetValue to 128 * retrieve. 129 * 130 * @return the nth SedSetValue in this SedListOfSetValues or @c NULL if no 131 * such object exists. 132 * 133 * @copydetails doc_returned_unowned_pointer 134 * 135 * @see addTaskChange(const SedSetValue* object) 136 * @see createSetValue() 137 * @see get(const std::string& sid) 138 * @see getNumTaskChanges() 139 * @see remove(const std::string& sid) 140 * @see remove(unsigned int n) 141 */ 142 virtual SedSetValue* get(unsigned int n); 143 144 145 /** 146 * Get a SedSetValue from the SedListOfSetValues. 147 * 148 * @param n an unsigned int representing the index of the SedSetValue to 149 * retrieve. 150 * 151 * @return the nth SedSetValue in this SedListOfSetValues or @c NULL if no 152 * such object exists. 153 * 154 * @copydetails doc_returned_unowned_pointer 155 * 156 * @see addTaskChange(const SedSetValue* object) 157 * @see createSetValue() 158 * @see get(const std::string& sid) 159 * @see getNumTaskChanges() 160 * @see remove(const std::string& sid) 161 * @see remove(unsigned int n) 162 */ 163 virtual const SedSetValue* get(unsigned int n) const; 164 165 166 /** 167 * Get a SedSetValue from the SedListOfSetValues based on its identifier. 168 * 169 * @param sid a string representing the identifier of the SedSetValue to 170 * retrieve. 171 * 172 * @return the SedSetValue in this SedListOfSetValues with the given @p sid 173 * or @c NULL if no such SedSetValue exists. 174 * 175 * @copydetails doc_returned_unowned_pointer 176 * 177 * @see addTaskChange(const SedSetValue* object) 178 * @see createSetValue() 179 * @see get(unsigned int n) 180 * @see getNumTaskChanges() 181 * @see remove(const std::string& sid) 182 * @see remove(unsigned int n) 183 */ 184 virtual SedSetValue* get(const std::string& sid); 185 186 187 /** 188 * Get a SedSetValue from the SedListOfSetValues based on its identifier. 189 * 190 * @param sid a string representing the identifier of the SedSetValue to 191 * retrieve. 192 * 193 * @return the SedSetValue in this SedListOfSetValues with the given @p sid 194 * or @c NULL if no such SedSetValue exists. 195 * 196 * @copydetails doc_returned_unowned_pointer 197 * 198 * @see addTaskChange(const SedSetValue* object) 199 * @see createSetValue() 200 * @see get(unsigned int n) 201 * @see getNumTaskChanges() 202 * @see remove(const std::string& sid) 203 * @see remove(unsigned int n) 204 */ 205 virtual const SedSetValue* get(const std::string& sid) const; 206 207 208 /** 209 * Removes the nth SedSetValue from this SedListOfSetValues and returns a 210 * pointer to it. 211 * 212 * @param n an unsigned int representing the index of the SedSetValue to 213 * remove. 214 * 215 * @return a pointer to the nth SedSetValue in this SedListOfSetValues. 216 * 217 * @copydetails doc_warning_returns_owned_pointer 218 * 219 * @see addTaskChange(const SedSetValue* object) 220 * @see createSetValue() 221 * @see get(const std::string& sid) 222 * @see get(unsigned int n) 223 * @see getNumTaskChanges() 224 * @see remove(const std::string& sid) 225 */ 226 virtual SedSetValue* remove(unsigned int n); 227 228 229 /** 230 * Removes the SedSetValue from this SedListOfSetValues based on its 231 * identifier and returns a pointer to it. 232 * 233 * @param sid a string representing the identifier of the SedSetValue to 234 * remove. 235 * 236 * @return the SedSetValue in this SedListOfSetValues based on the identifier 237 * or NULL if no such SedSetValue exists. 238 * 239 * @copydetails doc_warning_returns_owned_pointer 240 * 241 * @see addTaskChange(const SedSetValue* object) 242 * @see createSetValue() 243 * @see get(const std::string& sid) 244 * @see get(unsigned int n) 245 * @see getNumTaskChanges() 246 * @see remove(unsigned int n) 247 */ 248 virtual SedSetValue* remove(const std::string& sid); 249 250 251 /** 252 * Adds a copy of the given SedSetValue to this SedListOfSetValues. 253 * 254 * @param ssv the SedSetValue object to add. 255 * 256 * @copydetails doc_returns_success_code 257 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 258 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 259 * @li @sedmlconstant{LIBSEDML_INVALID_OBJECT, OperationReturnValues_t} 260 * @li @sedmlconstant{LIBSEDML_LEVEL_MISMATCH, OperationReturnValues_t} 261 * @li @sedmlconstant{LIBSEDML_VERSION_MISMATCH, OperationReturnValues_t} 262 * @li @sedmlconstant{LIBSEDML_PKG_VERSION_MISMATCH, OperationReturnValues_t} 263 * @li @sedmlconstant{LIBSEDML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} 264 * 265 * @copydetails doc_note_object_is_copied 266 * 267 * @see createSetValue() 268 * @see get(const std::string& sid) 269 * @see get(unsigned int n) 270 * @see getNumTaskChanges() 271 * @see remove(const std::string& sid) 272 * @see remove(unsigned int n) 273 */ 274 int addTaskChange(const SedSetValue* ssv); 275 276 277 /** 278 * Get the number of SedSetValue objects in this SedListOfSetValues. 279 * 280 * @return the number of SedSetValue objects in this SedListOfSetValues. 281 * 282 * @see addTaskChange(const SedSetValue* object) 283 * @see createSetValue() 284 * @see get(const std::string& sid) 285 * @see get(unsigned int n) 286 * @see remove(const std::string& sid) 287 * @see remove(unsigned int n) 288 */ 289 unsigned int getNumTaskChanges() const; 290 291 292 /** 293 * Creates a new SedSetValue object, adds it to this SedListOfSetValues 294 * object and returns the SedSetValue object created. 295 * 296 * @return a new SedSetValue object instance. 297 * 298 * @copydetails doc_returned_unowned_pointer 299 * 300 * @see addTaskChange(const SedSetValue* object) 301 * @see get(const std::string& sid) 302 * @see get(unsigned int n) 303 * @see getNumTaskChanges() 304 * @see remove(const std::string& sid) 305 * @see remove(unsigned int n) 306 */ 307 SedSetValue* createSetValue(); 308 309 310 /** 311 * Get a SedSetValue from the SedListOfSetValues based on the ModelReference 312 * to which it refers. 313 * 314 * @param sid a string representing the "modelReference" attribute of the 315 * SedSetValue object to retrieve. 316 * 317 * @return the first SedSetValue in this SedListOfSetValues based on the 318 * given modelReference attribute or NULL if no such SedSetValue exists. 319 * 320 * @copydetails doc_returned_unowned_pointer 321 */ 322 const SedSetValue* getByModelReference(const std::string& sid) const; 323 324 325 /** 326 * Get a SedSetValue from the SedListOfSetValues based on the ModelReference 327 * to which it refers. 328 * 329 * @param sid a string representing the "modelReference" attribute of the 330 * SedSetValue object to retrieve. 331 * 332 * @return the first SedSetValue in this SedListOfSetValues based on the 333 * given modelReference attribute or NULL if no such SedSetValue exists. 334 * 335 * @copydetails doc_returned_unowned_pointer 336 */ 337 SedSetValue* getByModelReference(const std::string& sid); 338 339 340 /** 341 * Get a SedSetValue from the SedListOfSetValues based on the Range to which 342 * it refers. 343 * 344 * @param sid a string representing the "range" attribute of the SedSetValue 345 * object to retrieve. 346 * 347 * @return the first SedSetValue in this SedListOfSetValues based on the 348 * given range attribute or NULL if no such SedSetValue exists. 349 * 350 * @copydetails doc_returned_unowned_pointer 351 */ 352 const SedSetValue* getByRange(const std::string& sid) const; 353 354 355 /** 356 * Get a SedSetValue from the SedListOfSetValues based on the Range to which 357 * it refers. 358 * 359 * @param sid a string representing the "range" attribute of the SedSetValue 360 * object to retrieve. 361 * 362 * @return the first SedSetValue in this SedListOfSetValues based on the 363 * given range attribute or NULL if no such SedSetValue exists. 364 * 365 * @copydetails doc_returned_unowned_pointer 366 */ 367 SedSetValue* getByRange(const std::string& sid); 368 369 370 /** 371 * Returns the XML element name of this SedListOfSetValues object. 372 * 373 * For SedListOfSetValues, the XML element name is always 374 * @c "listOfChanges". 375 * 376 * @return the name of this element, i.e. @c "listOfChanges". 377 */ 378 virtual const std::string& getElementName() const; 379 380 381 /** 382 * Returns the libSEDML type code for this SedListOfSetValues object. 383 * 384 * @copydetails doc_what_are_typecodes 385 * 386 * @return the SED-ML type code for this object: 387 * @sedmlconstant{SEDML_LIST_OF, SedTypeCode_t}. 388 * 389 * @copydetails doc_warning_typecodes_not_unique 390 */ 391 virtual int getTypeCode() const; 392 393 394 /** 395 * Returns the libSEDML type code for the SED-ML objects contained in this 396 * SedListOfSetValues object. 397 * 398 * @copydetails doc_what_are_typecodes 399 * 400 * @return the SED-ML typecode for the objects contained in this 401 * SedListOfSetValues: 402 * @sedmlconstant{SEDML_TASK_SETVALUE, SedTypeCode_t}. 403 * 404 * @copydetails doc_warning_typecodes_not_unique 405 * 406 * @see getElementName() 407 */ 408 virtual int getItemTypeCode() const; 409 410 411 412 413 #ifndef SWIG 414 415 416 417 418 #endif /* !SWIG */ 419 420 421 protected: 422 423 424 /** @cond doxygenLibSEDMLInternal */ 425 426 /** 427 * Creates a new SedSetValue in this SedListOfSetValues 428 */ 429 virtual SedBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& 430 stream); 431 432 /** @endcond */ 433 434 435 }; 436 437 438 439 LIBSEDML_CPP_NAMESPACE_END 440 441 442 443 444 #endif /* __cplusplus */ 445 446 447 448 449 #ifndef SWIG 450 451 452 453 454 LIBSEDML_CPP_NAMESPACE_BEGIN 455 456 457 458 459 BEGIN_C_DECLS 460 461 462 /** 463 * Get a SedSetValue_t from the SedListOf_t. 464 * 465 * @param slo the SedListOf_t structure to search. 466 * 467 * @param n an unsigned int representing the index of the SedSetValue_t to 468 * retrieve. 469 * 470 * @return the nth SedSetValue_t in this SedListOf_t or @c NULL if no such 471 * object exists. 472 * 473 * @copydetails doc_returned_unowned_pointer 474 * 475 * @memberof SedListOfSetValues_t 476 */ 477 LIBSEDML_EXTERN 478 SedSetValue_t* 479 SedListOfSetValues_getTaskChange(SedListOf_t* slo, unsigned int n); 480 481 482 /** 483 * Get a SedSetValue_t from the SedListOf_t based on its identifier. 484 * 485 * @param slo the SedListOf_t structure to search. 486 * 487 * @param sid a string representing the identifier of the SedSetValue_t to 488 * retrieve. 489 * 490 * @return the SedSetValue_t in this SedListOf_t with the given @p sid or 491 * @c NULL if no such SedSetValue_t exists. 492 * 493 * @copydetails doc_returned_unowned_pointer 494 * 495 * @memberof SedListOfSetValues_t 496 */ 497 LIBSEDML_EXTERN 498 SedSetValue_t* 499 SedListOfSetValues_getById(SedListOf_t* slo, const char *sid); 500 501 502 /** 503 * Removes the nth SedSetValue_t from this SedListOf_t and returns a pointer to 504 * it. 505 * 506 * @param slo the SedListOf_t structure to search. 507 * 508 * @param n an unsigned int representing the index of the SedSetValue_t to 509 * remove. 510 * 511 * @return a pointer to the nth SedSetValue_t in this SedListOf_t. 512 * 513 * @copydetails doc_warning_returns_owned_pointer 514 * 515 * @memberof SedListOfSetValues_t 516 */ 517 LIBSEDML_EXTERN 518 SedSetValue_t* 519 SedListOfSetValues_remove(SedListOf_t* slo, unsigned int n); 520 521 522 /** 523 * Removes the SedSetValue_t from this SedListOf_t based on its identifier and 524 * returns a pointer to it. 525 * 526 * @param slo the SedListOf_t structure to search. 527 * 528 * @param sid a string representing the identifier of the SedSetValue_t to 529 * remove. 530 * 531 * @return the SedSetValue_t in this SedListOf_t based on the identifier or 532 * NULL if no such SedSetValue_t exists. 533 * 534 * @copydetails doc_warning_returns_owned_pointer 535 * 536 * @memberof SedListOfSetValues_t 537 */ 538 LIBSEDML_EXTERN 539 SedSetValue_t* 540 SedListOfSetValues_removeById(SedListOf_t* slo, const char* sid); 541 542 543 544 545 END_C_DECLS 546 547 548 549 550 LIBSEDML_CPP_NAMESPACE_END 551 552 553 554 555 #endif /* !SWIG */ 556 557 558 559 560 #endif /* !SedListOfSetValues_H__ */ 561 562 563