1 /** 2 * @file SampledFieldGeometry.h 3 * @brief Definition of the SampledFieldGeometry class. 4 * @author SBMLTeam 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSBML. Please visit http://sbml.org for more 8 * information about SBML, and the latest version of libSBML. 9 * 10 * Copyright (C) 2020 jointly by the following organizations: 11 * 1. California Institute of Technology, Pasadena, CA, USA 12 * 2. University of Heidelberg, Heidelberg, Germany 13 * 3. University College London, London, UK 14 * 15 * Copyright (C) 2019 jointly by the following organizations: 16 * 1. California Institute of Technology, Pasadena, CA, USA 17 * 2. University of Heidelberg, Heidelberg, Germany 18 * 19 * Copyright (C) 2013-2018 jointly by the following organizations: 20 * 1. California Institute of Technology, Pasadena, CA, USA 21 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 22 * 3. University of Heidelberg, Heidelberg, Germany 23 * 24 * Copyright (C) 2009-2013 jointly by the following organizations: 25 * 1. California Institute of Technology, Pasadena, CA, USA 26 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 27 * 28 * Copyright (C) 2006-2008 by the California Institute of Technology, 29 * Pasadena, CA, USA 30 * 31 * Copyright (C) 2002-2005 jointly by the following organizations: 32 * 1. California Institute of Technology, Pasadena, CA, USA 33 * 2. Japan Science and Technology Agency, Japan 34 * 35 * This library is free software; you can redistribute it and/or modify it 36 * under the terms of the GNU Lesser General Public License as published by the 37 * Free Software Foundation. A copy of the license agreement is provided in the 38 * file named "LICENSE.txt" included with this software distribution and also 39 * available online as http://sbml.org/software/libsbml/license.html 40 * ------------------------------------------------------------------------ --> 41 * 42 * @class SampledFieldGeometry 43 * @sbmlbrief{spatial} TODO:Definition of the SampledFieldGeometry class. 44 */ 45 46 47 #ifndef SampledFieldGeometry_H__ 48 #define SampledFieldGeometry_H__ 49 50 51 #include <sbml/common/extern.h> 52 #include <sbml/common/sbmlfwd.h> 53 #include <sbml/packages/spatial/common/spatialfwd.h> 54 55 56 #ifdef __cplusplus 57 58 59 #include <string> 60 61 62 #include <sbml/packages/spatial/sbml/GeometryDefinition.h> 63 #include <sbml/packages/spatial/extension/SpatialExtension.h> 64 #include <sbml/packages/spatial/sbml/ListOfSampledVolumes.h> 65 66 67 LIBSBML_CPP_NAMESPACE_BEGIN 68 69 70 class LIBSBML_EXTERN SampledFieldGeometry : public GeometryDefinition 71 { 72 protected: 73 74 /** @cond doxygenLibsbmlInternal */ 75 76 ListOfSampledVolumes mSampledVolumes; 77 std::string mSampledField; 78 79 /** @endcond */ 80 81 public: 82 83 /** 84 * Creates a new SampledFieldGeometry using the given SBML Level, Version and 85 * “spatial” package version. 86 * 87 * @param level an unsigned int, the SBML Level to assign to this 88 * SampledFieldGeometry. 89 * 90 * @param version an unsigned int, the SBML Version to assign to this 91 * SampledFieldGeometry. 92 * 93 * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to 94 * this SampledFieldGeometry. 95 * 96 * @copydetails doc_note_setting_lv_pkg 97 */ 98 SampledFieldGeometry(unsigned int level = 99 SpatialExtension::getDefaultLevel(), 100 unsigned int version = 101 SpatialExtension::getDefaultVersion(), 102 unsigned int pkgVersion = 103 SpatialExtension::getDefaultPackageVersion()); 104 105 106 /** 107 * Creates a new SampledFieldGeometry using the given SpatialPkgNamespaces 108 * object. 109 * 110 * @copydetails doc_what_are_sbml_package_namespaces 111 * 112 * @param spatialns the SpatialPkgNamespaces object. 113 * 114 * @copydetails doc_note_setting_lv_pkg 115 */ 116 SampledFieldGeometry(SpatialPkgNamespaces *spatialns); 117 118 119 /** 120 * Copy constructor for SampledFieldGeometry. 121 * 122 * @param orig the SampledFieldGeometry instance to copy. 123 */ 124 SampledFieldGeometry(const SampledFieldGeometry& orig); 125 126 127 /** 128 * Assignment operator for SampledFieldGeometry. 129 * 130 * @param rhs the SampledFieldGeometry object whose values are to be used as 131 * the basis of the assignment. 132 */ 133 SampledFieldGeometry& operator=(const SampledFieldGeometry& rhs); 134 135 136 /** 137 * Creates and returns a deep copy of this SampledFieldGeometry object. 138 * 139 * @return a (deep) copy of this SampledFieldGeometry object. 140 */ 141 virtual SampledFieldGeometry* clone() const; 142 143 144 /** 145 * Destructor for SampledFieldGeometry. 146 */ 147 virtual ~SampledFieldGeometry(); 148 149 150 /** 151 * Returns the value of the "sampledField" attribute of this 152 * SampledFieldGeometry. 153 * 154 * @return the value of the "sampledField" attribute of this 155 * SampledFieldGeometry as a string. 156 */ 157 const std::string& getSampledField() const; 158 159 160 /** 161 * Predicate returning @c true if this SampledFieldGeometry's "sampledField" 162 * attribute is set. 163 * 164 * @return @c true if this SampledFieldGeometry's "sampledField" attribute 165 * has been set, otherwise @c false is returned. 166 */ 167 bool isSetSampledField() const; 168 169 170 /** 171 * Sets the value of the "sampledField" attribute of this 172 * SampledFieldGeometry. 173 * 174 * @param sampledField std::string& value of the "sampledField" attribute to 175 * be set. 176 * 177 * @copydetails doc_returns_success_code 178 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 179 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, 180 * OperationReturnValues_t} 181 */ 182 int setSampledField(const std::string& sampledField); 183 184 185 /** 186 * Unsets the value of the "sampledField" attribute of this 187 * SampledFieldGeometry. 188 * 189 * @copydetails doc_returns_success_code 190 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 191 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 192 */ 193 int unsetSampledField(); 194 195 196 /** 197 * Returns the ListOfSampledVolumes from this SampledFieldGeometry. 198 * 199 * @return the ListOfSampledVolumes from this SampledFieldGeometry. 200 * 201 * @copydetails doc_returned_unowned_pointer 202 * 203 * @see addSampledVolume(const SampledVolume* object) 204 * @see createSampledVolume() 205 * @see getSampledVolume(const std::string& sid) 206 * @see getSampledVolume(unsigned int n) 207 * @see getNumSampledVolumes() 208 * @see removeSampledVolume(const std::string& sid) 209 * @see removeSampledVolume(unsigned int n) 210 */ 211 const ListOfSampledVolumes* getListOfSampledVolumes() const; 212 213 214 /** 215 * Returns the ListOfSampledVolumes from this SampledFieldGeometry. 216 * 217 * @return the ListOfSampledVolumes from this SampledFieldGeometry. 218 * 219 * @copydetails doc_returned_unowned_pointer 220 * 221 * @see addSampledVolume(const SampledVolume* object) 222 * @see createSampledVolume() 223 * @see getSampledVolume(const std::string& sid) 224 * @see getSampledVolume(unsigned int n) 225 * @see getNumSampledVolumes() 226 * @see removeSampledVolume(const std::string& sid) 227 * @see removeSampledVolume(unsigned int n) 228 */ 229 ListOfSampledVolumes* getListOfSampledVolumes(); 230 231 232 /** 233 * Get a SampledVolume from the SampledFieldGeometry. 234 * 235 * @param n an unsigned int representing the index of the SampledVolume to 236 * retrieve. 237 * 238 * @return the nth SampledVolume in the ListOfSampledVolumes within this 239 * SampledFieldGeometry. 240 * 241 * @copydetails doc_returned_unowned_pointer 242 * 243 * @see addSampledVolume(const SampledVolume* object) 244 * @see createSampledVolume() 245 * @see getSampledVolume(const std::string& sid) 246 * @see getNumSampledVolumes() 247 * @see removeSampledVolume(const std::string& sid) 248 * @see removeSampledVolume(unsigned int n) 249 */ 250 SampledVolume* getSampledVolume(unsigned int n); 251 252 253 /** 254 * Get a SampledVolume from the SampledFieldGeometry. 255 * 256 * @param n an unsigned int representing the index of the SampledVolume to 257 * retrieve. 258 * 259 * @return the nth SampledVolume in the ListOfSampledVolumes within this 260 * SampledFieldGeometry. 261 * 262 * @copydetails doc_returned_unowned_pointer 263 * 264 * @see addSampledVolume(const SampledVolume* object) 265 * @see createSampledVolume() 266 * @see getSampledVolume(const std::string& sid) 267 * @see getNumSampledVolumes() 268 * @see removeSampledVolume(const std::string& sid) 269 * @see removeSampledVolume(unsigned int n) 270 */ 271 const SampledVolume* getSampledVolume(unsigned int n) const; 272 273 274 /** 275 * Get a SampledVolume from the SampledFieldGeometry based on its identifier. 276 * 277 * @param sid a string representing the identifier of the SampledVolume to 278 * retrieve. 279 * 280 * @return the SampledVolume in the ListOfSampledVolumes within this 281 * SampledFieldGeometry with the given @p sid or @c NULL if no such 282 * SampledVolume exists. 283 * 284 * @copydetails doc_returned_unowned_pointer 285 * 286 * @see addSampledVolume(const SampledVolume* object) 287 * @see createSampledVolume() 288 * @see getSampledVolume(unsigned int n) 289 * @see getNumSampledVolumes() 290 * @see removeSampledVolume(const std::string& sid) 291 * @see removeSampledVolume(unsigned int n) 292 */ 293 SampledVolume* getSampledVolume(const std::string& sid); 294 295 296 /** 297 * Get a SampledVolume from the SampledFieldGeometry based on its identifier. 298 * 299 * @param sid a string representing the identifier of the SampledVolume to 300 * retrieve. 301 * 302 * @return the SampledVolume in the ListOfSampledVolumes within this 303 * SampledFieldGeometry with the given @p sid or @c NULL if no such 304 * SampledVolume exists. 305 * 306 * @copydetails doc_returned_unowned_pointer 307 * 308 * @see addSampledVolume(const SampledVolume* object) 309 * @see createSampledVolume() 310 * @see getSampledVolume(unsigned int n) 311 * @see getNumSampledVolumes() 312 * @see removeSampledVolume(const std::string& sid) 313 * @see removeSampledVolume(unsigned int n) 314 */ 315 const SampledVolume* getSampledVolume(const std::string& sid) const; 316 317 318 /** 319 * Get a SampledVolume from the SampledFieldGeometry based on the DomainType 320 * to which it refers. 321 * 322 * @param sid a string representing the "domainType" attribute of the 323 * SampledVolume object to retrieve. 324 * 325 * @return the first SampledVolume in this SampledFieldGeometry based on the 326 * given domainType attribute or NULL if no such SampledVolume exists. 327 * 328 * @copydetails doc_returned_unowned_pointer 329 */ 330 const SampledVolume* getSampledVolumeByDomainType(const std::string& sid) 331 const; 332 333 334 /** 335 * Get a SampledVolume from the SampledFieldGeometry based on the DomainType 336 * to which it refers. 337 * 338 * @param sid a string representing the "domainType" attribute of the 339 * SampledVolume object to retrieve. 340 * 341 * @return the first SampledVolume in this SampledFieldGeometry based on the 342 * given domainType attribute or NULL if no such SampledVolume exists. 343 * 344 * @copydetails doc_returned_unowned_pointer 345 */ 346 SampledVolume* getSampledVolumeByDomainType(const std::string& sid); 347 348 349 /** 350 * Adds a copy of the given SampledVolume to this SampledFieldGeometry. 351 * 352 * @param sv the SampledVolume object to add. 353 * 354 * @copydetails doc_returns_success_code 355 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 356 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 357 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 358 * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} 359 * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} 360 * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} 361 * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} 362 * 363 * @copydetails doc_note_object_is_copied 364 * 365 * @see createSampledVolume() 366 * @see getSampledVolume(const std::string& sid) 367 * @see getSampledVolume(unsigned int n) 368 * @see getNumSampledVolumes() 369 * @see removeSampledVolume(const std::string& sid) 370 * @see removeSampledVolume(unsigned int n) 371 */ 372 int addSampledVolume(const SampledVolume* sv); 373 374 375 /** 376 * Get the number of SampledVolume objects in this SampledFieldGeometry. 377 * 378 * @return the number of SampledVolume objects in this SampledFieldGeometry. 379 * 380 * @see addSampledVolume(const SampledVolume* object) 381 * @see createSampledVolume() 382 * @see getSampledVolume(const std::string& sid) 383 * @see getSampledVolume(unsigned int n) 384 * @see removeSampledVolume(const std::string& sid) 385 * @see removeSampledVolume(unsigned int n) 386 */ 387 unsigned int getNumSampledVolumes() const; 388 389 390 /** 391 * Creates a new SampledVolume object, adds it to this SampledFieldGeometry 392 * object and returns the SampledVolume object created. 393 * 394 * @return a new SampledVolume object instance. 395 * 396 * @copydetails doc_returned_unowned_pointer 397 * 398 * @see addSampledVolume(const SampledVolume* object) 399 * @see getSampledVolume(const std::string& sid) 400 * @see getSampledVolume(unsigned int n) 401 * @see getNumSampledVolumes() 402 * @see removeSampledVolume(const std::string& sid) 403 * @see removeSampledVolume(unsigned int n) 404 */ 405 SampledVolume* createSampledVolume(); 406 407 408 /** 409 * Removes the nth SampledVolume from this SampledFieldGeometry and returns a 410 * pointer to it. 411 * 412 * @param n an unsigned int representing the index of the SampledVolume to 413 * remove. 414 * 415 * @return a pointer to the nth SampledVolume in this SampledFieldGeometry. 416 * 417 * @copydetails doc_returned_owned_pointer 418 * 419 * @see addSampledVolume(const SampledVolume* object) 420 * @see createSampledVolume() 421 * @see getSampledVolume(const std::string& sid) 422 * @see getSampledVolume(unsigned int n) 423 * @see getNumSampledVolumes() 424 * @see removeSampledVolume(const std::string& sid) 425 */ 426 SampledVolume* removeSampledVolume(unsigned int n); 427 428 429 /** 430 * Removes the SampledVolume from this SampledFieldGeometry based on its 431 * identifier and returns a pointer to it. 432 * 433 * @param sid a string representing the identifier of the SampledVolume to 434 * remove. 435 * 436 * @return the SampledVolume in this SampledFieldGeometry based on the 437 * identifier or NULL if no such SampledVolume exists. 438 * 439 * @copydetails doc_returned_owned_pointer 440 * 441 * @see addSampledVolume(const SampledVolume* object) 442 * @see createSampledVolume() 443 * @see getSampledVolume(const std::string& sid) 444 * @see getSampledVolume(unsigned int n) 445 * @see getNumSampledVolumes() 446 * @see removeSampledVolume(unsigned int n) 447 */ 448 SampledVolume* removeSampledVolume(const std::string& sid); 449 450 451 /** 452 * @copydoc doc_renamesidref_common 453 */ 454 virtual void renameSIdRefs(const std::string& oldid, 455 const std::string& newid); 456 457 458 /** 459 * Returns the XML element name of this SampledFieldGeometry object. 460 * 461 * For SampledFieldGeometry, the XML element name is always 462 * @c "sampledFieldGeometry". 463 * 464 * @return the name of this element, i.e. @c "sampledFieldGeometry". 465 */ 466 virtual const std::string& getElementName() const; 467 468 469 /** 470 * Returns the libSBML type code for this SampledFieldGeometry object. 471 * 472 * @copydetails doc_what_are_typecodes 473 * 474 * @return the SBML type code for this object: 475 * @sbmlconstant{SBML_SPATIAL_SAMPLEDFIELDGEOMETRY, SBMLSpatialTypeCode_t}. 476 * 477 * @copydetails doc_warning_typecodes_not_unique 478 * 479 * @see getElementName() 480 * @see getPackageName() 481 */ 482 virtual int getTypeCode() const; 483 484 485 /** 486 * Predicate returning @c true if all the required attributes for this 487 * SampledFieldGeometry object have been set. 488 * 489 * @return @c true to indicate that all the required attributes of this 490 * SampledFieldGeometry have been set, otherwise @c false is returned. 491 * 492 * 493 * @note The required attributes for the SampledFieldGeometry object are: 494 * @li "sampledField" 495 */ 496 virtual bool hasRequiredAttributes() const; 497 498 499 /** 500 * Predicate returning @c true if all the required elements for this 501 * SampledFieldGeometry object have been set. 502 * 503 * @return @c true to indicate that all the required elements of this 504 * SampledFieldGeometry have been set, otherwise @c false is returned. 505 * 506 * 507 * @note The required elements for the SampledFieldGeometry object are: 508 */ 509 virtual bool hasRequiredElements() const; 510 511 512 513 /** @cond doxygenLibsbmlInternal */ 514 515 /** 516 * Write any contained elements 517 */ 518 virtual void writeElements(XMLOutputStream& stream) const; 519 520 /** @endcond */ 521 522 523 524 /** @cond doxygenLibsbmlInternal */ 525 526 /** 527 * Accepts the given SBMLVisitor 528 */ 529 virtual bool accept(SBMLVisitor& v) const; 530 531 /** @endcond */ 532 533 534 535 /** @cond doxygenLibsbmlInternal */ 536 537 /** 538 * Sets the parent SBMLDocument 539 */ 540 virtual void setSBMLDocument(SBMLDocument* d); 541 542 /** @endcond */ 543 544 545 546 /** @cond doxygenLibsbmlInternal */ 547 548 /** 549 * Connects to child elements 550 */ 551 virtual void connectToChild(); 552 553 /** @endcond */ 554 555 556 557 /** @cond doxygenLibsbmlInternal */ 558 559 /** 560 * Enables/disables the given package with this element 561 */ 562 virtual void enablePackageInternal(const std::string& pkgURI, 563 const std::string& pkgPrefix, 564 bool flag); 565 566 /** @endcond */ 567 568 569 570 /** @cond doxygenLibsbmlInternal */ 571 572 /** 573 * Updates the namespaces when setLevelVersion is used 574 */ 575 virtual void updateSBMLNamespace(const std::string& package, 576 unsigned int level, 577 unsigned int version); 578 579 /** @endcond */ 580 581 582 583 584 #ifndef SWIG 585 586 587 588 /** @cond doxygenLibsbmlInternal */ 589 590 /** 591 * Gets the value of the "attributeName" attribute of this 592 * SampledFieldGeometry. 593 * 594 * @param attributeName, the name of the attribute to retrieve. 595 * 596 * @param value, the address of the value to record. 597 * 598 * @copydetails doc_returns_success_code 599 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 600 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 601 */ 602 virtual int getAttribute(const std::string& attributeName, bool& value) 603 const; 604 605 /** @endcond */ 606 607 608 609 /** @cond doxygenLibsbmlInternal */ 610 611 /** 612 * Gets the value of the "attributeName" attribute of this 613 * SampledFieldGeometry. 614 * 615 * @param attributeName, the name of the attribute to retrieve. 616 * 617 * @param value, the address of the value to record. 618 * 619 * @copydetails doc_returns_success_code 620 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 621 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 622 */ 623 virtual int getAttribute(const std::string& attributeName, int& value) const; 624 625 /** @endcond */ 626 627 628 629 /** @cond doxygenLibsbmlInternal */ 630 631 /** 632 * Gets the value of the "attributeName" attribute of this 633 * SampledFieldGeometry. 634 * 635 * @param attributeName, the name of the attribute to retrieve. 636 * 637 * @param value, the address of the value to record. 638 * 639 * @copydetails doc_returns_success_code 640 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 641 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 642 */ 643 virtual int getAttribute(const std::string& attributeName, 644 double& value) const; 645 646 /** @endcond */ 647 648 649 650 /** @cond doxygenLibsbmlInternal */ 651 652 /** 653 * Gets the value of the "attributeName" attribute of this 654 * SampledFieldGeometry. 655 * 656 * @param attributeName, the name of the attribute to retrieve. 657 * 658 * @param value, the address of the value to record. 659 * 660 * @copydetails doc_returns_success_code 661 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 662 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 663 */ 664 virtual int getAttribute(const std::string& attributeName, 665 unsigned int& value) const; 666 667 /** @endcond */ 668 669 670 671 /** @cond doxygenLibsbmlInternal */ 672 673 /** 674 * Gets the value of the "attributeName" attribute of this 675 * SampledFieldGeometry. 676 * 677 * @param attributeName, the name of the attribute to retrieve. 678 * 679 * @param value, the address of the value to record. 680 * 681 * @copydetails doc_returns_success_code 682 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 683 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 684 */ 685 virtual int getAttribute(const std::string& attributeName, 686 std::string& value) const; 687 688 /** @endcond */ 689 690 691 692 /** @cond doxygenLibsbmlInternal */ 693 694 /** 695 * Predicate returning @c true if this SampledFieldGeometry's attribute 696 * "attributeName" is set. 697 * 698 * @param attributeName, the name of the attribute to query. 699 * 700 * @return @c true if this SampledFieldGeometry's attribute "attributeName" 701 * has been set, otherwise @c false is returned. 702 */ 703 virtual bool isSetAttribute(const std::string& attributeName) const; 704 705 /** @endcond */ 706 707 708 709 /** @cond doxygenLibsbmlInternal */ 710 711 /** 712 * Sets the value of the "attributeName" attribute of this 713 * SampledFieldGeometry. 714 * 715 * @param attributeName, the name of the attribute to set. 716 * 717 * @param value, the value of the attribute to set. 718 * 719 * @copydetails doc_returns_success_code 720 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 721 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 722 */ 723 virtual int setAttribute(const std::string& attributeName, bool value); 724 725 /** @endcond */ 726 727 728 729 /** @cond doxygenLibsbmlInternal */ 730 731 /** 732 * Sets the value of the "attributeName" attribute of this 733 * SampledFieldGeometry. 734 * 735 * @param attributeName, the name of the attribute to set. 736 * 737 * @param value, the value of the attribute to set. 738 * 739 * @copydetails doc_returns_success_code 740 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 741 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 742 */ 743 virtual int setAttribute(const std::string& attributeName, int value); 744 745 /** @endcond */ 746 747 748 749 /** @cond doxygenLibsbmlInternal */ 750 751 /** 752 * Sets the value of the "attributeName" attribute of this 753 * SampledFieldGeometry. 754 * 755 * @param attributeName, the name of the attribute to set. 756 * 757 * @param value, the value of the attribute to set. 758 * 759 * @copydetails doc_returns_success_code 760 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 761 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 762 */ 763 virtual int setAttribute(const std::string& attributeName, double value); 764 765 /** @endcond */ 766 767 768 769 /** @cond doxygenLibsbmlInternal */ 770 771 /** 772 * Sets the value of the "attributeName" attribute of this 773 * SampledFieldGeometry. 774 * 775 * @param attributeName, the name of the attribute to set. 776 * 777 * @param value, the value of the attribute to set. 778 * 779 * @copydetails doc_returns_success_code 780 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 781 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 782 */ 783 virtual int setAttribute(const std::string& attributeName, 784 unsigned int value); 785 786 /** @endcond */ 787 788 789 790 /** @cond doxygenLibsbmlInternal */ 791 792 /** 793 * Sets the value of the "attributeName" attribute of this 794 * SampledFieldGeometry. 795 * 796 * @param attributeName, the name of the attribute to set. 797 * 798 * @param value, the value of the attribute to set. 799 * 800 * @copydetails doc_returns_success_code 801 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 802 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 803 */ 804 virtual int setAttribute(const std::string& attributeName, 805 const std::string& value); 806 807 /** @endcond */ 808 809 810 811 /** @cond doxygenLibsbmlInternal */ 812 813 /** 814 * Unsets the value of the "attributeName" attribute of this 815 * SampledFieldGeometry. 816 * 817 * @param attributeName, the name of the attribute to query. 818 * 819 * @copydetails doc_returns_success_code 820 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 821 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 822 */ 823 virtual int unsetAttribute(const std::string& attributeName); 824 825 /** @endcond */ 826 827 828 829 /** @cond doxygenLibsbmlInternal */ 830 831 /** 832 * Creates and returns an new "elementName" object in this 833 * SampledFieldGeometry. 834 * 835 * @param elementName, the name of the element to create. 836 * 837 * @return pointer to the element created. 838 */ 839 virtual SBase* createChildObject(const std::string& elementName); 840 841 /** @endcond */ 842 843 844 845 /** @cond doxygenLibsbmlInternal */ 846 847 /** 848 * Adds a new "elementName" object to this SampledFieldGeometry. 849 * 850 * @param elementName, the name of the element to create. 851 * 852 * @param element, pointer to the element to be added. 853 * 854 * @copydetails doc_returns_success_code 855 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 856 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 857 */ 858 virtual int addChildObject(const std::string& elementName, 859 const SBase* element); 860 861 /** @endcond */ 862 863 864 865 /** @cond doxygenLibsbmlInternal */ 866 867 /** 868 * Removes and returns the new "elementName" object with the given id in this 869 * SampledFieldGeometry. 870 * 871 * @param elementName, the name of the element to remove. 872 * 873 * @param id, the id of the element to remove. 874 * 875 * @return pointer to the element removed. 876 */ 877 virtual SBase* removeChildObject(const std::string& elementName, 878 const std::string& id); 879 880 /** @endcond */ 881 882 883 884 /** @cond doxygenLibsbmlInternal */ 885 886 /** 887 * Returns the number of "elementName" in this SampledFieldGeometry. 888 * 889 * @param elementName, the name of the element to get number of. 890 * 891 * @return unsigned int number of elements. 892 */ 893 virtual unsigned int getNumObjects(const std::string& elementName); 894 895 /** @endcond */ 896 897 898 899 /** @cond doxygenLibsbmlInternal */ 900 901 /** 902 * Returns the nth object of "objectName" in this SampledFieldGeometry. 903 * 904 * @param elementName, the name of the element to get number of. 905 * 906 * @param index, unsigned int the index of the object to retrieve. 907 * 908 * @return pointer to the object. 909 */ 910 virtual SBase* getObject(const std::string& elementName, unsigned int index); 911 912 /** @endcond */ 913 914 915 916 917 #endif /* !SWIG */ 918 919 920 /** 921 * Returns the first child element that has the given @p id in the model-wide 922 * SId namespace, or @c NULL if no such object is found. 923 * 924 * @param id a string representing the id attribute of the object to 925 * retrieve. 926 * 927 * @return a pointer to the SBase element with the given @p id. If no such 928 * object is found, this method returns @c NULL. 929 */ 930 virtual SBase* getElementBySId(const std::string& id); 931 932 933 /** 934 * Returns the first child element that has the given @p metaid, or @c NULL 935 * if no such object is found. 936 * 937 * @param metaid a string representing the metaid attribute of the object to 938 * retrieve. 939 * 940 * @return a pointer to the SBase element with the given @p metaid. If no 941 * such object is found this method returns @c NULL. 942 */ 943 virtual SBase* getElementByMetaId(const std::string& metaid); 944 945 946 /** 947 * Returns a List of all child SBase objects, including those nested to an 948 * arbitrary depth. 949 * 950 * @param filter an ElementFilter that may impose restrictions on the objects 951 * to be retrieved. 952 * 953 * @return a List* pointer of pointers to all SBase child objects with any 954 * restriction imposed. 955 */ 956 virtual List* getAllElements(ElementFilter * filter = NULL); 957 958 959 protected: 960 961 962 /** @cond doxygenLibsbmlInternal */ 963 964 /** 965 * Creates a new object from the next XMLToken on the XMLInputStream 966 */ 967 virtual SBase* createObject(XMLInputStream& stream); 968 969 /** @endcond */ 970 971 972 973 /** @cond doxygenLibsbmlInternal */ 974 975 /** 976 * Adds the expected attributes for this element 977 */ 978 virtual void addExpectedAttributes(ExpectedAttributes& attributes); 979 980 /** @endcond */ 981 982 983 984 /** @cond doxygenLibsbmlInternal */ 985 986 /** 987 * Reads the expected attributes into the member data variables 988 */ 989 virtual void readAttributes(const XMLAttributes& attributes, 990 const ExpectedAttributes& expectedAttributes); 991 992 /** @endcond */ 993 994 995 996 /** @cond doxygenLibsbmlInternal */ 997 998 /** 999 * Writes the attributes to the stream 1000 */ 1001 virtual void writeAttributes(XMLOutputStream& stream) const; 1002 1003 /** @endcond */ 1004 1005 1006 }; 1007 1008 1009 1010 LIBSBML_CPP_NAMESPACE_END 1011 1012 1013 1014 1015 #endif /* __cplusplus */ 1016 1017 1018 1019 1020 #ifndef SWIG 1021 1022 1023 1024 1025 LIBSBML_CPP_NAMESPACE_BEGIN 1026 1027 1028 1029 1030 BEGIN_C_DECLS 1031 1032 1033 /** 1034 * Creates a new SampledFieldGeometry_t using the given SBML Level, Version and 1035 * “spatial” package version. 1036 * 1037 * @param level an unsigned int, the SBML Level to assign to this 1038 * SampledFieldGeometry_t. 1039 * 1040 * @param version an unsigned int, the SBML Version to assign to this 1041 * SampledFieldGeometry_t. 1042 * 1043 * @param pkgVersion an unsigned int, the SBML Spatial Version to assign to 1044 * this SampledFieldGeometry_t. 1045 * 1046 * @copydetails doc_note_setting_lv_pkg 1047 * 1048 * @copydetails doc_returned_owned_pointer 1049 * 1050 * @memberof SampledFieldGeometry_t 1051 */ 1052 LIBSBML_EXTERN 1053 SampledFieldGeometry_t * 1054 SampledFieldGeometry_create(unsigned int level, 1055 unsigned int version, 1056 unsigned int pkgVersion); 1057 1058 1059 /** 1060 * Creates and returns a deep copy of this SampledFieldGeometry_t object. 1061 * 1062 * @param sfg the SampledFieldGeometry_t structure. 1063 * 1064 * @return a (deep) copy of this SampledFieldGeometry_t object. 1065 * 1066 * @copydetails doc_returned_owned_pointer 1067 * 1068 * @memberof SampledFieldGeometry_t 1069 */ 1070 LIBSBML_EXTERN 1071 SampledFieldGeometry_t* 1072 SampledFieldGeometry_clone(const SampledFieldGeometry_t* sfg); 1073 1074 1075 /** 1076 * Frees this SampledFieldGeometry_t object. 1077 * 1078 * @param sfg the SampledFieldGeometry_t structure. 1079 * 1080 * @memberof SampledFieldGeometry_t 1081 */ 1082 LIBSBML_EXTERN 1083 void 1084 SampledFieldGeometry_free(SampledFieldGeometry_t* sfg); 1085 1086 1087 /** 1088 * Returns the value of the "sampledField" attribute of this 1089 * SampledFieldGeometry_t. 1090 * 1091 * @param sfg the SampledFieldGeometry_t structure whose sampledField is 1092 * sought. 1093 * 1094 * @return the value of the "sampledField" attribute of this 1095 * SampledFieldGeometry_t as a pointer to a string. 1096 * 1097 * @copydetails doc_returned_owned_char 1098 * 1099 * @memberof SampledFieldGeometry_t 1100 */ 1101 LIBSBML_EXTERN 1102 char * 1103 SampledFieldGeometry_getSampledField(const SampledFieldGeometry_t * sfg); 1104 1105 1106 /** 1107 * Predicate returning @c 1 (true) if this SampledFieldGeometry_t's 1108 * "sampledField" attribute is set. 1109 * 1110 * @param sfg the SampledFieldGeometry_t structure. 1111 * 1112 * @return @c 1 (true) if this SampledFieldGeometry_t's "sampledField" 1113 * attribute has been set, otherwise @c 0 (false) is returned. 1114 * 1115 * @memberof SampledFieldGeometry_t 1116 */ 1117 LIBSBML_EXTERN 1118 int 1119 SampledFieldGeometry_isSetSampledField(const SampledFieldGeometry_t * sfg); 1120 1121 1122 /** 1123 * Sets the value of the "sampledField" attribute of this 1124 * SampledFieldGeometry_t. 1125 * 1126 * @param sfg the SampledFieldGeometry_t structure. 1127 * 1128 * @param sampledField const char * value of the "sampledField" attribute to be 1129 * set. 1130 * 1131 * @copydetails doc_returns_success_code 1132 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1133 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 1134 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1135 * 1136 * @memberof SampledFieldGeometry_t 1137 */ 1138 LIBSBML_EXTERN 1139 int 1140 SampledFieldGeometry_setSampledField(SampledFieldGeometry_t * sfg, 1141 const char * sampledField); 1142 1143 1144 /** 1145 * Unsets the value of the "sampledField" attribute of this 1146 * SampledFieldGeometry_t. 1147 * 1148 * @param sfg the SampledFieldGeometry_t structure. 1149 * 1150 * @copydetails doc_returns_success_code 1151 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1152 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1153 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1154 * 1155 * @memberof SampledFieldGeometry_t 1156 */ 1157 LIBSBML_EXTERN 1158 int 1159 SampledFieldGeometry_unsetSampledField(SampledFieldGeometry_t * sfg); 1160 1161 1162 /** 1163 * Returns a ListOf_t * containing SampledVolume_t objects from this 1164 * SampledFieldGeometry_t. 1165 * 1166 * @param sfg the SampledFieldGeometry_t structure whose ListOfSampledVolumes 1167 * is sought. 1168 * 1169 * @return the ListOfSampledVolumes from this SampledFieldGeometry_t as a 1170 * ListOf_t *. 1171 * 1172 * @copydetails doc_returned_unowned_pointer 1173 * 1174 * @see SampledFieldGeometry_addSampledVolume() 1175 * @see SampledFieldGeometry_createSampledVolume() 1176 * @see SampledFieldGeometry_getSampledVolumeById() 1177 * @see SampledFieldGeometry_getSampledVolume() 1178 * @see SampledFieldGeometry_getNumSampledVolumes() 1179 * @see SampledFieldGeometry_removeSampledVolumeById() 1180 * @see SampledFieldGeometry_removeSampledVolume() 1181 * 1182 * @memberof SampledFieldGeometry_t 1183 */ 1184 LIBSBML_EXTERN 1185 ListOf_t* 1186 SampledFieldGeometry_getListOfSampledVolumes(SampledFieldGeometry_t* sfg); 1187 1188 1189 /** 1190 * Get a SampledVolume_t from the SampledFieldGeometry_t. 1191 * 1192 * @param sfg the SampledFieldGeometry_t structure to search. 1193 * 1194 * @param n an unsigned int representing the index of the SampledVolume_t to 1195 * retrieve. 1196 * 1197 * @return the nth SampledVolume_t in the ListOfSampledVolumes within this 1198 * SampledFieldGeometry. 1199 * 1200 * @copydetails doc_returned_unowned_pointer 1201 * 1202 * @memberof SampledFieldGeometry_t 1203 */ 1204 LIBSBML_EXTERN 1205 SampledVolume_t* 1206 SampledFieldGeometry_getSampledVolume(SampledFieldGeometry_t* sfg, 1207 unsigned int n); 1208 1209 1210 /** 1211 * Get a SampledVolume_t from the SampledFieldGeometry_t based on its 1212 * identifier. 1213 * 1214 * @param sfg the SampledFieldGeometry_t structure to search. 1215 * 1216 * @param sid a string representing the identifier of the SampledVolume_t to 1217 * retrieve. 1218 * 1219 * @return the SampledVolume_t in the ListOfSampledVolumes within this 1220 * SampledFieldGeometry with the given @p sid or @c NULL if no such 1221 * SampledVolume_t exists. 1222 * 1223 * @copydetails doc_returned_unowned_pointer 1224 * 1225 * @memberof SampledFieldGeometry_t 1226 */ 1227 LIBSBML_EXTERN 1228 SampledVolume_t* 1229 SampledFieldGeometry_getSampledVolumeById(SampledFieldGeometry_t* sfg, 1230 const char *sid); 1231 1232 1233 /** 1234 * Get a SampledVolume_t from the SampledFieldGeometry_t based on the 1235 * DomainType to which it refers. 1236 * 1237 * @param sfg the SampledFieldGeometry_t structure to search. 1238 * 1239 * @param sid a string representing the "domainType" attribute of the 1240 * SampledVolume_t object to retrieve. 1241 * 1242 * @return the first SampledVolume_t in this SampledFieldGeometry_t based on 1243 * the given domainType attribute or NULL if no such SampledVolume_t exists. 1244 * 1245 * @copydetails doc_returned_unowned_pointer 1246 * 1247 * @memberof SampledFieldGeometry_t 1248 */ 1249 LIBSBML_EXTERN 1250 SampledVolume_t* 1251 SampledFieldGeometry_getSampledVolumeByDomainType(SampledFieldGeometry_t* sfg, 1252 const char *sid); 1253 1254 1255 /** 1256 * Adds a copy of the given SampledVolume_t to this SampledFieldGeometry_t. 1257 * 1258 * @param sfg the SampledFieldGeometry_t structure to which the SampledVolume_t 1259 * should be added. 1260 * 1261 * @param sv the SampledVolume_t object to add. 1262 * 1263 * @copydetails doc_returns_success_code 1264 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1265 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1266 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 1267 * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t} 1268 * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t} 1269 * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t} 1270 * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t} 1271 * 1272 * @memberof SampledFieldGeometry_t 1273 */ 1274 LIBSBML_EXTERN 1275 int 1276 SampledFieldGeometry_addSampledVolume(SampledFieldGeometry_t* sfg, 1277 const SampledVolume_t* sv); 1278 1279 1280 /** 1281 * Get the number of SampledVolume_t objects in this SampledFieldGeometry_t. 1282 * 1283 * @param sfg the SampledFieldGeometry_t structure to query. 1284 * 1285 * @return the number of SampledVolume_t objects in this 1286 * SampledFieldGeometry_t. 1287 * 1288 * @memberof SampledFieldGeometry_t 1289 */ 1290 LIBSBML_EXTERN 1291 unsigned int 1292 SampledFieldGeometry_getNumSampledVolumes(SampledFieldGeometry_t* sfg); 1293 1294 1295 /** 1296 * Creates a new SampledVolume_t object, adds it to this SampledFieldGeometry_t 1297 * object and returns the SampledVolume_t object created. 1298 * 1299 * @param sfg the SampledFieldGeometry_t structure to which the SampledVolume_t 1300 * should be added. 1301 * 1302 * @return a new SampledVolume_t object instance. 1303 * 1304 * @copydetails doc_returned_unowned_pointer 1305 * 1306 * @memberof SampledFieldGeometry_t 1307 */ 1308 LIBSBML_EXTERN 1309 SampledVolume_t* 1310 SampledFieldGeometry_createSampledVolume(SampledFieldGeometry_t* sfg); 1311 1312 1313 /** 1314 * Removes the nth SampledVolume_t from this SampledFieldGeometry_t and returns 1315 * a pointer to it. 1316 * 1317 * @param sfg the SampledFieldGeometry_t structure to search. 1318 * 1319 * @param n an unsigned int representing the index of the SampledVolume_t to 1320 * remove. 1321 * 1322 * @return a pointer to the nth SampledVolume_t in this SampledFieldGeometry_t. 1323 * 1324 * @copydetails doc_returned_owned_pointer 1325 * 1326 * @memberof SampledFieldGeometry_t 1327 */ 1328 LIBSBML_EXTERN 1329 SampledVolume_t* 1330 SampledFieldGeometry_removeSampledVolume(SampledFieldGeometry_t* sfg, 1331 unsigned int n); 1332 1333 1334 /** 1335 * Removes the SampledVolume_t from this SampledFieldGeometry_t based on its 1336 * identifier and returns a pointer to it. 1337 * 1338 * @param sfg the SampledFieldGeometry_t structure to search. 1339 * 1340 * @param sid a string representing the identifier of the SampledVolume_t to 1341 * remove. 1342 * 1343 * @return the SampledVolume_t in this SampledFieldGeometry_t based on the 1344 * identifier or NULL if no such SampledVolume_t exists. 1345 * 1346 * @copydetails doc_returned_owned_pointer 1347 * 1348 * @memberof SampledFieldGeometry_t 1349 */ 1350 LIBSBML_EXTERN 1351 SampledVolume_t* 1352 SampledFieldGeometry_removeSampledVolumeById(SampledFieldGeometry_t* sfg, 1353 const char* sid); 1354 1355 1356 /** 1357 * Predicate returning @c 1 (true) if all the required attributes for this 1358 * SampledFieldGeometry_t object have been set. 1359 * 1360 * @param sfg the SampledFieldGeometry_t structure. 1361 * 1362 * @return @c 1 (true) to indicate that all the required attributes of this 1363 * SampledFieldGeometry_t have been set, otherwise @c 0 (false) is returned. 1364 * 1365 * 1366 * @note The required attributes for the SampledFieldGeometry_t object are: 1367 * @li "sampledField" 1368 * 1369 * @memberof SampledFieldGeometry_t 1370 */ 1371 LIBSBML_EXTERN 1372 int 1373 SampledFieldGeometry_hasRequiredAttributes(const SampledFieldGeometry_t * sfg); 1374 1375 1376 /** 1377 * Predicate returning @c 1 (true) if all the required elements for this 1378 * SampledFieldGeometry_t object have been set. 1379 * 1380 * @param sfg the SampledFieldGeometry_t structure. 1381 * 1382 * @return @c 1 (true) to indicate that all the required elements of this 1383 * SampledFieldGeometry_t have been set, otherwise @c 0 (false) is returned. 1384 * 1385 * 1386 * @note The required elements for the SampledFieldGeometry_t object are: 1387 * 1388 * @memberof SampledFieldGeometry_t 1389 */ 1390 LIBSBML_EXTERN 1391 int 1392 SampledFieldGeometry_hasRequiredElements(const SampledFieldGeometry_t * sfg); 1393 1394 1395 1396 1397 END_C_DECLS 1398 1399 1400 1401 1402 LIBSBML_CPP_NAMESPACE_END 1403 1404 1405 1406 1407 #endif /* !SWIG */ 1408 1409 1410 1411 1412 #endif /* !SampledFieldGeometry_H__ */ 1413 1414 1415