1 /** 2 * @file QualModelPlugin.h 3 * @brief Definition of QualModelPlugin, the plugin class of 4 * qual package for the Model element. 5 * @author Akiya Jouraku 6 * 7 * <!-------------------------------------------------------------------------- 8 * This file is part of libSBML. Please visit http://sbml.org for more 9 * information about SBML, and the latest version of libSBML. 10 * 11 * Copyright (C) 2020 jointly by the following organizations: 12 * 1. California Institute of Technology, Pasadena, CA, USA 13 * 2. University of Heidelberg, Heidelberg, Germany 14 * 3. University College London, London, UK 15 * 16 * Copyright (C) 2019 jointly by the following organizations: 17 * 1. California Institute of Technology, Pasadena, CA, USA 18 * 2. University of Heidelberg, Heidelberg, Germany 19 * 20 * Copyright (C) 2013-2018 jointly by the following organizations: 21 * 1. California Institute of Technology, Pasadena, CA, USA 22 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 23 * 3. University of Heidelberg, Heidelberg, Germany 24 * 25 * Copyright (C) 2009-2011 jointly by the following organizations: 26 * 1. California Institute of Technology, Pasadena, CA, USA 27 * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK 28 * 29 * Copyright (C) 2006-2008 by the California Institute of Technology, 30 * Pasadena, CA, USA 31 * 32 * Copyright (C) 2002-2005 jointly by the following organizations: 33 * 1. California Institute of Technology, Pasadena, CA, USA 34 * 2. Japan Science and Technology Agency, Japan 35 * 36 * This library is free software; you can redistribute it and/or modify it 37 * under the terms of the GNU Lesser General Public License as published by 38 * the Free Software Foundation. A copy of the license agreement is provided 39 * in the file named "LICENSE.txt" included with this software distribution 40 * and also available online as http://sbml.org/software/libsbml/license.html 41 * ------------------------------------------------------------------------ --> 42 * 43 * @class QualModelPlugin 44 * @sbmlbrief{qual} Extension of Model. 45 * 46 * The extension of SBML Level 3 Core's Model class is relatively 47 * straightforward: the Qualitative Models Package adds two lists, one for 48 * holding qualitativeSpecies (ListOfQualitativeSpecies), and the other for 49 * holding transitions (ListOfTransitions). The Model element may contain at 50 * most one ListOfQualitativeSpecies, which must contain at least one 51 * QualitativeSpecies. It may also contain at most one ListOfTransitions 52 * which must contain at least one Transition. 53 */ 54 55 #ifndef QualModelPlugin_h 56 #define QualModelPlugin_h 57 58 59 #include <sbml/common/extern.h> 60 61 #ifdef __cplusplus 62 63 #include <sbml/extension/SBasePlugin.h> 64 #include <sbml/packages/qual/sbml/QualitativeSpecies.h> 65 #include <sbml/packages/qual/sbml/Transition.h> 66 67 LIBSBML_CPP_NAMESPACE_BEGIN 68 69 class LIBSBML_EXTERN QualModelPlugin : public SBasePlugin 70 { 71 public: 72 73 /** 74 * Creates a new QualModelPlugin object using the given parameters. 75 * 76 * @copydetails doc_what_are_xmlnamespaces 77 * 78 * @copydetails doc_what_are_sbmlnamespaces 79 * 80 * @param uri the URI of the SBML Level 3 package implemented by 81 * this libSBML package extension. 82 * 83 * @param prefix the XML namespace prefix being used for the package. 84 * 85 * @param qualns the namespaces object for the package. 86 */ 87 QualModelPlugin (const std::string &uri, const std::string &prefix, 88 QualPkgNamespaces *qualns); 89 90 91 /** 92 * Copy constructor. Creates a copy of this object. 93 * 94 * @param orig the instance to copy. 95 */ 96 QualModelPlugin(const QualModelPlugin& orig); 97 98 99 /** 100 * Destroy this object. 101 */ 102 virtual ~QualModelPlugin (); 103 104 105 /** 106 * Assignment operator for QualModelPlugin. 107 */ 108 QualModelPlugin& operator=(const QualModelPlugin& orig); 109 110 111 /** 112 * Creates and returns a deep copy of this QualModelPlugin object. 113 * 114 * @return a (deep) copy of this QualModelPlugin object. 115 */ 116 virtual QualModelPlugin* clone () const; 117 118 119 // -------------------------------------------------------- 120 // 121 // overridden virtual functions for reading/writing/checking 122 // elements 123 // 124 // -------------------------------------------------------- 125 126 /** @cond doxygenLibsbmlInternal */ 127 /** 128 * Subclasses must override this method to create, store, and then 129 * return an SBML object corresponding to the next XMLToken in the 130 * XMLInputStream if they have their specific elements. 131 * 132 * @return the SBML object corresponding to next XMLToken in the 133 * XMLInputStream or @c NULL if the token was not recognized. 134 */ 135 virtual SBase* createObject (XMLInputStream& stream); 136 137 138 /** 139 * Subclasses must override this method to write out their contained 140 * SBML objects as XML elements if they have their specific elements. 141 */ 142 virtual void writeElements (XMLOutputStream& stream) const; 143 144 145 /* ------------------------------------------------------------------ 146 * 147 * Additional public functions 148 * 149 * ------------------------------------------------------------------ 150 */ 151 152 153 /** @cond doxygenLibsbmlInternal */ 154 int appendFrom(const Model* model); 155 156 /** @endcond */ 157 158 159 /** 160 * Returns a List of all child SBase objects, including those nested to an 161 * arbitary depth. 162 * 163 * @return a List of pointers to all child objects. 164 */ 165 virtual List* getAllElements(ElementFilter * filter = NULL); 166 167 168 /** 169 * Returns the ListOfQualitativeSpecies in this plugin object. 170 * 171 * @return ListOfQualitativeSpecies object in this plugin object. 172 */ 173 const ListOfQualitativeSpecies* getListOfQualitativeSpecies () const; 174 175 176 /** 177 * Returns the ListOfQualitativeSpecies in this plugin object. 178 * 179 * @return ListOfQualitativeSpecies object in this plugin object. 180 */ 181 ListOfQualitativeSpecies* getListOfQualitativeSpecies (); 182 183 184 /** 185 * Returns the QualitativeSpecies object that belongs to the given index. If the 186 * index is invalid, NULL is returned. 187 * 188 * @param n the index number of the QualitativeSpecies to get. 189 * 190 * @return the nth QualitativeSpecies in the ListOfQualitativeSpecies. 191 * If the index @p n is invalid, @c NULL is returned. 192 */ 193 const QualitativeSpecies* getQualitativeSpecies (unsigned int n) const; 194 195 196 /** 197 * Returns the QualitativeSpecies object that belongs to the given index. If the 198 * index is invalid, NULL is returned. 199 * 200 * @param n the index number of the QualitativeSpecies to get. 201 * 202 * @return the nth QualitativeSpecies in the ListOfQualitativeSpecies. 203 * If the index @p n is invalid, @c NULL is returned. 204 */ 205 QualitativeSpecies* getQualitativeSpecies (unsigned int n); 206 207 208 /** 209 * Returns the qualitativeSpecies object based on its identifier. 210 * 211 * @param sid a string representing the identifier 212 * of the QualitativeSpecies to get. 213 * 214 * @return QualitativeSpecies in the ListOfQualitativeSpecies with the given id 215 * or @c NULL if no such QualitativeSpecies exists. 216 * 217 * @see getQualitativeSpecies(unsigned int n) 218 * @see getListOfQualitativeSpecies() 219 */ 220 QualitativeSpecies* getQualitativeSpecies (const std::string& sid); 221 222 223 /** 224 * Returns the qualitativeSpecies object based on its identifier. 225 * 226 * @param sid a string representing the identifier 227 * of the QualitativeSpecies to get. 228 * 229 * @return QualitativeSpecies in the ListOfQualitativeSpecies with the given id 230 * or @c NULL if no such QualitativeSpecies exists. 231 * 232 * @see getQualitativeSpecies(unsigned int n) 233 * @see getListOfQualitativeSpecies() 234 */ 235 const QualitativeSpecies* getQualitativeSpecies (const std::string& sid) const; 236 237 238 /** 239 * Adds a copy of the given QualitativeSpecies object to the list of qual. 240 * 241 * @param qualitativeSpecies the QualitativeSpecies object to be added to the list of qual. 242 * 243 * @copydetails doc_returns_one_success_code 244 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 245 */ 246 int addQualitativeSpecies (const QualitativeSpecies* qualitativeSpecies); 247 248 249 /** 250 * Creates a new qual object and adds it to the list of qual objects 251 * and returns it. 252 * 253 * @return a newly created QualitativeSpecies object. 254 */ 255 QualitativeSpecies* createQualitativeSpecies(); 256 257 258 /** 259 * Removes the nth QualitativeSpecies object from this plugin object and 260 * returns a pointer to it. 261 * 262 * The caller owns the returned object and is responsible for 263 * deleting it. 264 * 265 * @param n the index of the QualitativeSpecies object to remove. 266 * 267 * @return the QualitativeSpecies object removed. As mentioned above, the 268 * caller owns the returned object. NULL is returned if the 269 * given index is out of range. 270 */ 271 QualitativeSpecies* removeQualitativeSpecies (unsigned int n); 272 273 274 /** 275 * Removes the QualitativeSpecies object with the given id attribute from 276 * this plugin object and returns a pointer to it. 277 * 278 * The caller owns the returned object and is responsible for 279 * deleting it. 280 * 281 * @param sid the id attribute of the QualitativeSpecies object to remove. 282 * 283 * @return the QualitativeSpecies object removed. As mentioned above, the 284 * caller owns the returned object. NULL is returned if the 285 * given index is out of range. 286 */ 287 QualitativeSpecies* removeQualitativeSpecies (const std::string& sid); 288 289 290 /** 291 * Returns the number of QualitativeSpecies object in this plugin object. 292 * 293 * @return the number of QualitativeSpecies object in this plugin object. 294 */ 295 unsigned int getNumQualitativeSpecies() const; 296 297 /** 298 * Returns the ListOfTransitions in this plugin object. 299 * 300 * @return ListOfTransitions object in this plugin object. 301 */ 302 const ListOfTransitions* getListOfTransitions () const; 303 304 305 /** 306 * Returns the ListOfTransitions in this plugin object. 307 * 308 * @return ListOfTransitions object in this plugin object. 309 */ 310 ListOfTransitions* getListOfTransitions (); 311 312 313 /** 314 * Returns the Transition object that belongs to the given index. If the 315 * index is invalid, NULL is returned. 316 * 317 * @param n the index number of the Transition to get. 318 * 319 * @return the nth Transition in the ListOfTransitions. 320 * If the index @p n is invalid, @c NULL is returned. 321 */ 322 const Transition* getTransition (unsigned int n) const; 323 324 325 /** 326 * Returns the Transition object that belongs to the given index. If the 327 * index is invalid, NULL is returned. 328 * 329 * @param n the index number of the Transition to get. 330 * 331 * @return the nth Transition in the ListOfTransitions. 332 * If the index @p n is invalid, @c NULL is returned. 333 */ 334 Transition* getTransition (unsigned int n); 335 336 337 /** 338 * Returns the qualitativeSpecies object based on its identifier. 339 * 340 * @param sid a string representing the identifier 341 * of the Transition to get. 342 * 343 * @return Transition in the ListOfTransitions with the given id 344 * or @c NULL if no such Transition exists. 345 * 346 * @see getTransition(unsigned int n) 347 * @see getListOfTransitions() 348 */ 349 Transition* getTransition (const std::string& sid); 350 351 352 /** 353 * Returns the qualitativeSpecies object based on its identifier. 354 * 355 * @param sid a string representing the identifier 356 * of the Transition to get. 357 * 358 * @return Transition in the ListOfTransitions with the given id 359 * or @c NULL if no such Transition exists. 360 * 361 * @see getTransition(unsigned int n) 362 * @see getListOfTransitions() 363 */ 364 const Transition* getTransition (const std::string& sid) const; 365 366 367 /** 368 * Adds a copy of the given Transition object to the list of qual. 369 * 370 * @param transition the Transition object to be added to the list of qual. 371 * 372 * @copydetails doc_returns_one_success_code 373 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 374 */ 375 int addTransition (const Transition* transition); 376 377 378 /** 379 * Creates a new qual object and adds it to the list of qual objects 380 * and returns it. 381 * 382 * @return a newly created Transition object. 383 */ 384 Transition* createTransition(); 385 386 387 /** 388 * Removes the nth Transition object from this plugin object and 389 * returns a pointer to it. 390 * 391 * The caller owns the returned object and is responsible for 392 * deleting it. 393 * 394 * @param n the index of the Transition object to remove. 395 * 396 * @return the Transition object removed. As mentioned above, the 397 * caller owns the returned object. NULL is returned if the 398 * given index is out of range. 399 */ 400 Transition* removeTransition (unsigned int n); 401 402 403 /** 404 * Removes the Transition object with the given id attribute from 405 * this plugin object and returns a pointer to it. 406 * 407 * The caller owns the returned object and is responsible for 408 * deleting it. 409 * 410 * @param sid the id attribute of the Transition object to remove. 411 * 412 * @return the Transition object removed. As mentioned above, the 413 * caller owns the returned object. NULL is returned if the 414 * given index is out of range. 415 */ 416 Transition* removeTransition (const std::string& sid); 417 418 419 /** 420 * Returns the number of Transition object in this plugin object. 421 * 422 * @return the number of Transition object in this plugin object. 423 */ 424 unsigned int getNumTransitions() const; 425 426 // --------------------------------------------------------- 427 // 428 // virtual functions (internal implementation) which should 429 // be overridden by subclasses. 430 // 431 // --------------------------------------------------------- 432 433 /** @cond doxygenLibsbmlInternal */ 434 /** 435 * Sets the parent SBMLDocument of this plugin object. 436 * 437 * Subclasses which contain one or more SBase derived elements must 438 * override this function. 439 * 440 * @param d the SBMLDocument object to use. 441 * 442 * @see connectToParent 443 * @see enablePackageInternal 444 */ 445 virtual void setSBMLDocument (SBMLDocument* d); 446 /** @endcond */ 447 448 449 /** @cond doxygenLibsbmlInternal */ 450 /** 451 * Sets the *parent* of this SBML object to child SBML objects (if any). 452 * (Creates a child-parent relationship by the parent) 453 * 454 * @see setSBMLDocument 455 * @see enablePackageInternal 456 */ 457 virtual void connectToChild (); 458 /** @endcond */ 459 460 461 /** @cond doxygenLibsbmlInternal */ 462 /** 463 * Sets the parent SBML object of this plugin object to 464 * this object and child elements (if any). 465 * (Creates a child-parent relationship by this plugin object) 466 * 467 * This function is called when this object is created by 468 * the parent element. 469 * Subclasses must override this this function if they have one 470 * or more child elements.Also, SBasePlugin::connectToParent() 471 * must be called in the overridden function. 472 * 473 * @param sbase the SBase object to use. 474 * 475 * @see setSBMLDocument 476 * @see enablePackageInternal 477 */ 478 virtual void connectToParent (SBase *sbase); 479 /** @endcond */ 480 481 482 /** @cond doxygenLibsbmlInternal */ 483 /** 484 * Enables/Disables the given package with child elements in this plugin 485 * object (if any). 486 * (This is an internal implementation invoked from 487 * SBase::enablePackageInternal() function) 488 * 489 * @note Subclasses in which one or more SBase derived elements are 490 * defined must override this function. 491 * 492 * @see setSBMLDocument 493 * @see connectToParent 494 */ 495 virtual void enablePackageInternal(const std::string& pkgURI, 496 const std::string& pkgPrefix, bool flag); 497 /** @endcond */ 498 499 500 /** @cond doxygenLibsbmlInternal */ 501 /** 502 * Accepts the given SBMLVisitor. 503 */ 504 virtual bool accept (SBMLVisitor& v) const; 505 /** @endcond */ 506 507 #ifndef SWIG 508 509 510 511 /** @cond doxygenLibsbmlInternal */ 512 513 /** 514 * Returns the value of the "attributeName" attribute of this QualModelPlugin. 515 * 516 * @param attributeName, the name of the attribute to retrieve. 517 * 518 * @param value, the address of the value to record. 519 * 520 * @copydetails doc_returns_success_code 521 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 522 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 523 */ 524 virtual int getAttribute(const std::string& attributeName, bool& value) 525 const; 526 527 /** @endcond */ 528 529 530 531 /** @cond doxygenLibsbmlInternal */ 532 533 /** 534 * Returns the value of the "attributeName" attribute of this QualModelPlugin. 535 * 536 * @param attributeName, the name of the attribute to retrieve. 537 * 538 * @param value, the address of the value to record. 539 * 540 * @copydetails doc_returns_success_code 541 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 542 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 543 */ 544 virtual int getAttribute(const std::string& attributeName, int& value) const; 545 546 /** @endcond */ 547 548 549 550 /** @cond doxygenLibsbmlInternal */ 551 552 /** 553 * Returns the value of the "attributeName" attribute of this QualModelPlugin. 554 * 555 * @param attributeName, the name of the attribute to retrieve. 556 * 557 * @param value, the address of the value to record. 558 * 559 * @copydetails doc_returns_success_code 560 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 561 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 562 */ 563 virtual int getAttribute(const std::string& attributeName, 564 double& value) const; 565 566 /** @endcond */ 567 568 569 570 /** @cond doxygenLibsbmlInternal */ 571 572 /** 573 * Returns the value of the "attributeName" attribute of this QualModelPlugin. 574 * 575 * @param attributeName, the name of the attribute to retrieve. 576 * 577 * @param value, the address of the value to record. 578 * 579 * @copydetails doc_returns_success_code 580 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 581 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 582 */ 583 virtual int getAttribute(const std::string& attributeName, 584 unsigned int& value) const; 585 586 /** @endcond */ 587 588 589 590 /** @cond doxygenLibsbmlInternal */ 591 592 /** 593 * Returns the value of the "attributeName" attribute of this QualModelPlugin. 594 * 595 * @param attributeName, the name of the attribute to retrieve. 596 * 597 * @param value, the address of the value to record. 598 * 599 * @copydetails doc_returns_success_code 600 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 601 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 602 */ 603 virtual int getAttribute(const std::string& attributeName, 604 std::string& value) const; 605 606 /** @endcond */ 607 608 609 610 /** @cond doxygenLibsbmlInternal */ 611 612 /** 613 * Predicate returning @c true if this QualModelPlugin's attribute 614 * "attributeName" is set. 615 * 616 * @param attributeName, the name of the attribute to query. 617 * 618 * @return @c true if this QualModelPlugin's attribute "attributeName" has 619 * been set, otherwise @c false is returned. 620 */ 621 virtual bool isSetAttribute(const std::string& attributeName) const; 622 623 /** @endcond */ 624 625 626 627 /** @cond doxygenLibsbmlInternal */ 628 629 /** 630 * Sets the value of the "attributeName" attribute of this QualModelPlugin. 631 * 632 * @param attributeName, the name of the attribute to set. 633 * 634 * @param value, the value of the attribute to set. 635 * 636 * @copydetails doc_returns_success_code 637 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 638 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 639 */ 640 virtual int setAttribute(const std::string& attributeName, bool value); 641 642 /** @endcond */ 643 644 645 646 /** @cond doxygenLibsbmlInternal */ 647 648 /** 649 * Sets the value of the "attributeName" attribute of this QualModelPlugin. 650 * 651 * @param attributeName, the name of the attribute to set. 652 * 653 * @param value, the value of the attribute to set. 654 * 655 * @copydetails doc_returns_success_code 656 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 657 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 658 */ 659 virtual int setAttribute(const std::string& attributeName, int value); 660 661 /** @endcond */ 662 663 664 665 /** @cond doxygenLibsbmlInternal */ 666 667 /** 668 * Sets the value of the "attributeName" attribute of this QualModelPlugin. 669 * 670 * @param attributeName, the name of the attribute to set. 671 * 672 * @param value, the value of the attribute to set. 673 * 674 * @copydetails doc_returns_success_code 675 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 676 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 677 */ 678 virtual int setAttribute(const std::string& attributeName, double value); 679 680 /** @endcond */ 681 682 683 684 /** @cond doxygenLibsbmlInternal */ 685 686 /** 687 * Sets the value of the "attributeName" attribute of this QualModelPlugin. 688 * 689 * @param attributeName, the name of the attribute to set. 690 * 691 * @param value, the value of the attribute to set. 692 * 693 * @copydetails doc_returns_success_code 694 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 695 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 696 */ 697 virtual int setAttribute(const std::string& attributeName, 698 unsigned int value); 699 700 /** @endcond */ 701 702 703 704 /** @cond doxygenLibsbmlInternal */ 705 706 /** 707 * Sets the value of the "attributeName" attribute of this QualModelPlugin. 708 * 709 * @param attributeName, the name of the attribute to set. 710 * 711 * @param value, the value of the attribute to set. 712 * 713 * @copydetails doc_returns_success_code 714 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 715 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 716 */ 717 virtual int setAttribute(const std::string& attributeName, 718 const std::string& value); 719 720 /** @endcond */ 721 722 723 724 /** @cond doxygenLibsbmlInternal */ 725 726 /** 727 * Unsets the value of the "attributeName" attribute of this QualModelPlugin. 728 * 729 * @param attributeName, the name of the attribute to query. 730 * 731 * @copydetails doc_returns_success_code 732 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 733 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 734 */ 735 virtual int unsetAttribute(const std::string& attributeName); 736 737 /** @endcond */ 738 739 740 741 /** @cond doxygenLibsbmlInternal */ 742 743 /** 744 * Creates and returns an new "elementName" object in this QualModelPlugin. 745 * 746 * @param elementName, the name of the element to create. 747 * 748 * @return pointer to the element created. 749 */ 750 virtual SBase* createChildObject(const std::string& elementName); 751 752 /** @endcond */ 753 754 755 756 /** @cond doxygenLibsbmlInternal */ 757 758 /** 759 * Adds a new "elementName" object to this QualModelPlugin. 760 * 761 * @param elementName, the name of the element to create. 762 * 763 * @param element, pointer to the element to be added. 764 * 765 * @copydetails doc_returns_success_code 766 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 767 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 768 */ 769 virtual int addChildObject(const std::string& elementName, 770 const SBase* element); 771 772 /** @endcond */ 773 774 775 776 /** @cond doxygenLibsbmlInternal */ 777 778 /** 779 * Removes and returns the new "elementName" object with the given id in this 780 * QualModelPlugin. 781 * 782 * @param elementName, the name of the element to remove. 783 * 784 * @param id, the id of the element to remove. 785 * 786 * @return pointer to the element removed. 787 */ 788 virtual SBase* removeChildObject(const std::string& elementName, 789 const std::string& id); 790 791 /** @endcond */ 792 793 794 795 /** @cond doxygenLibsbmlInternal */ 796 797 /** 798 * Returns the number of "elementName" in this QualModelPlugin. 799 * 800 * @param elementName, the name of the element to get number of. 801 * 802 * @return unsigned int number of elements. 803 */ 804 virtual unsigned int getNumObjects(const std::string& elementName); 805 806 /** @endcond */ 807 808 809 810 /** @cond doxygenLibsbmlInternal */ 811 812 /** 813 * Returns the nth object of "objectName" in this QualModelPlugin. 814 * 815 * @param elementName, the name of the element to get number of. 816 * 817 * @param index, unsigned int the index of the object to retrieve. 818 * 819 * @return pointer to the object. 820 */ 821 virtual SBase* getObject(const std::string& elementName, unsigned int index); 822 823 /** @endcond */ 824 825 826 827 828 #endif /* !SWIG */ 829 830 831 /** 832 * Returns the first child element that has the given @p id in the model-wide 833 * SId namespace, or @c NULL if no such object is found. 834 * 835 * @param id a string representing the id attribute of the object to 836 * retrieve. 837 * 838 * @return a pointer to the SBase element with the given @p id. 839 */ 840 virtual SBase* getElementBySId(const std::string& id); 841 842 843 /** 844 * Returns the first child element that has the given @p metaid, or @c NULL 845 * if no such object is found. 846 * 847 * @param metaid a string representing the metaid attribute of the object to 848 * retrieve. 849 * 850 * @return a pointer to the SBase element with the given @p metaid. 851 */ 852 virtual SBase* getElementByMetaId(const std::string& metaid); 853 854 855 protected: 856 /** @cond doxygenLibsbmlInternal */ 857 /*-- data members --*/ 858 859 ListOfQualitativeSpecies mQualitativeSpecies; 860 ListOfTransitions mTransitions; 861 862 /** @endcond */ 863 }; 864 865 LIBSBML_CPP_NAMESPACE_END 866 867 #endif /* __cplusplus */ 868 869 870 871 872 #ifndef SWIG 873 874 875 876 877 LIBSBML_CPP_NAMESPACE_BEGIN 878 879 880 881 882 BEGIN_C_DECLS 883 884 885 /** 886 * Returns a ListOf_t * containing QualitativeSpecies_t objects from this 887 * QualModelPlugin_t. 888 * 889 * @param qmp the QualModelPlugin_t structure whose ListOfQualitativeSpecies 890 * is sought. 891 * 892 * @return the ListOfQualitativeSpecies from this QualModelPlugin_t as a 893 * ListOf_t *. 894 * 895 * @memberof QualModelPlugin_t 896 */ 897 LIBSBML_EXTERN 898 ListOf_t* 899 QualModelPlugin_getListOfQualitativeSpecies(QualModelPlugin_t* qmp); 900 901 902 /** 903 * Get a QualitativeSpecies_t from the QualModelPlugin_t. 904 * 905 * @param qmp the QualModelPlugin_t structure to search. 906 * 907 * @param n an unsigned int representing the index of the QualitativeSpecies_t 908 * to retrieve. 909 * 910 * @return the nth QualitativeSpecies_t in the ListOfQualitativeSpecies within 911 * this QualModelPlugin. 912 * If the index @p n is invalid, @c NULL is returned. 913 * 914 * @memberof QualModelPlugin_t 915 */ 916 LIBSBML_EXTERN 917 const QualitativeSpecies_t* 918 QualModelPlugin_getQualitativeSpecies(QualModelPlugin_t* qmp, unsigned int n); 919 920 921 /** 922 * Get a QualitativeSpecies_t from the QualModelPlugin_t based on its 923 * identifier. 924 * 925 * @param qmp the QualModelPlugin_t structure to search. 926 * 927 * @param sid a string representing the identifier of the QualitativeSpecies_t 928 * to retrieve. 929 * 930 * @return the QualitativeSpecies_t in the ListOfQualitativeSpecies within this 931 * QualModelPlugin with the given id or @c NULL if no such QualitativeSpecies_t 932 * exists. 933 * 934 * @memberof QualModelPlugin_t 935 */ 936 LIBSBML_EXTERN 937 const QualitativeSpecies_t* 938 QualModelPlugin_getQualitativeSpeciesById(QualModelPlugin_t* qmp, 939 const char *sid); 940 941 942 /** 943 * Get a QualitativeSpecies_t from the QualModelPlugin_t based on the 944 * Compartment to which it refers. 945 * 946 * @param qmp the QualModelPlugin_t structure to search. 947 * 948 * @param sid a string representing the compartment attribute of the 949 * QualitativeSpecies_t object to retrieve. 950 * 951 * @return the first QualitativeSpecies_t in this QualModelPlugin_t based on 952 * the given compartment attribute or @c NULL if no such QualitativeSpecies_t 953 * exists. 954 * 955 * @memberof QualModelPlugin_t 956 */ 957 LIBSBML_EXTERN 958 const QualitativeSpecies_t* 959 QualModelPlugin_getQualitativeSpeciesByCompartment(QualModelPlugin_t* qmp, 960 const char *sid); 961 962 963 /** 964 * Adds a copy of the given QualitativeSpecies_t to this QualModelPlugin_t. 965 * 966 * @param qmp the QualModelPlugin_t structure to which the QualitativeSpecies_t 967 * should be added. 968 * 969 * @param qs the QualitativeSpecies_t object to add. 970 * 971 * @copydetails doc_returns_success_code 972 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 973 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 974 * 975 * @memberof QualModelPlugin_t 976 */ 977 LIBSBML_EXTERN 978 int 979 QualModelPlugin_addQualitativeSpecies(QualModelPlugin_t* qmp, 980 const QualitativeSpecies_t* qs); 981 982 983 /** 984 * Get the number of QualitativeSpecies_t objects in this QualModelPlugin_t. 985 * 986 * @param qmp the QualModelPlugin_t structure to query. 987 * 988 * @return the number of QualitativeSpecies_t objects in this 989 * QualModelPlugin_t. 990 * 991 * @memberof QualModelPlugin_t 992 */ 993 LIBSBML_EXTERN 994 unsigned int 995 QualModelPlugin_getNumQualitativeSpecies(QualModelPlugin_t* qmp); 996 997 998 /** 999 * Creates a new QualitativeSpecies_t object, adds it to this QualModelPlugin_t 1000 * object and returns the QualitativeSpecies_t object created. 1001 * 1002 * @param qmp the QualModelPlugin_t structure to which the QualitativeSpecies_t 1003 * should be added. 1004 * 1005 * @return a new QualitativeSpecies_t object instance. 1006 * 1007 * @memberof QualModelPlugin_t 1008 */ 1009 LIBSBML_EXTERN 1010 QualitativeSpecies_t* 1011 QualModelPlugin_createQualitativeSpecies(QualModelPlugin_t* qmp); 1012 1013 1014 /** 1015 * Removes the nth QualitativeSpecies_t from this QualModelPlugin_t and returns 1016 * a pointer to it. 1017 * 1018 * @param qmp the QualModelPlugin_t structure to search. 1019 * 1020 * @param n an unsigned int representing the index of the QualitativeSpecies_t 1021 * to remove. 1022 * 1023 * @return a pointer to the nth QualitativeSpecies_t in this QualModelPlugin_t. 1024 * 1025 * @memberof QualModelPlugin_t 1026 */ 1027 LIBSBML_EXTERN 1028 QualitativeSpecies_t* 1029 QualModelPlugin_removeQualitativeSpecies(QualModelPlugin_t* qmp, 1030 unsigned int n); 1031 1032 1033 /** 1034 * Removes the QualitativeSpecies_t from this QualModelPlugin_t based on its 1035 * identifier and returns a pointer to it. 1036 * 1037 * @param qmp the QualModelPlugin_t structure to search. 1038 * 1039 * @param sid a string representing the identifier of the QualitativeSpecies_t 1040 * to remove. 1041 * 1042 * @return the QualitativeSpecies_t in this QualModelPlugin_t based on the 1043 * identifier or @c NULL if no such QualitativeSpecies_t exists. 1044 * 1045 * @memberof QualModelPlugin_t 1046 */ 1047 LIBSBML_EXTERN 1048 QualitativeSpecies_t* 1049 QualModelPlugin_removeQualitativeSpeciesById(QualModelPlugin_t* qmp, 1050 const char* sid); 1051 1052 1053 /** 1054 * Returns a ListOf_t * containing Transition_t objects from this 1055 * QualModelPlugin_t. 1056 * 1057 * @param qmp the QualModelPlugin_t structure whose ListOfTransitions is 1058 * sought. 1059 * 1060 * @return the ListOfTransitions from this QualModelPlugin_t as a ListOf_t *. 1061 * 1062 * @memberof QualModelPlugin_t 1063 */ 1064 LIBSBML_EXTERN 1065 ListOf_t* 1066 QualModelPlugin_getListOfTransitions(QualModelPlugin_t* qmp); 1067 1068 1069 /** 1070 * Get a Transition_t from the QualModelPlugin_t. 1071 * 1072 * @param qmp the QualModelPlugin_t structure to search. 1073 * 1074 * @param n an unsigned int representing the index of the Transition_t to 1075 * retrieve. 1076 * 1077 * @return the nth Transition_t in the ListOfTransitions within this 1078 * QualModelPlugin. 1079 * If the index @p n is invalid, @c NULL is returned. 1080 * 1081 * @memberof QualModelPlugin_t 1082 */ 1083 LIBSBML_EXTERN 1084 const Transition_t* 1085 QualModelPlugin_getTransition(QualModelPlugin_t* qmp, unsigned int n); 1086 1087 1088 /** 1089 * Get a Transition_t from the QualModelPlugin_t based on its identifier. 1090 * 1091 * @param qmp the QualModelPlugin_t structure to search. 1092 * 1093 * @param sid a string representing the identifier of the Transition_t to 1094 * retrieve. 1095 * 1096 * @return the Transition_t in the ListOfTransitions within this 1097 * QualModelPlugin with the given id or @c NULL if no such Transition_t exists. 1098 * 1099 * @memberof QualModelPlugin_t 1100 */ 1101 LIBSBML_EXTERN 1102 const Transition_t* 1103 QualModelPlugin_getTransitionById(QualModelPlugin_t* qmp, const char *sid); 1104 1105 1106 /** 1107 * Adds a copy of the given Transition_t to this QualModelPlugin_t. 1108 * 1109 * @param qmp the QualModelPlugin_t structure to which the Transition_t should 1110 * be added. 1111 * 1112 * @param t the Transition_t object to add. 1113 * 1114 * @copydetails doc_returns_success_code 1115 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1116 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1117 * 1118 * @memberof QualModelPlugin_t 1119 */ 1120 LIBSBML_EXTERN 1121 int 1122 QualModelPlugin_addTransition(QualModelPlugin_t* qmp, const Transition_t* t); 1123 1124 1125 /** 1126 * Get the number of Transition_t objects in this QualModelPlugin_t. 1127 * 1128 * @param qmp the QualModelPlugin_t structure to query. 1129 * 1130 * @return the number of Transition_t objects in this QualModelPlugin_t. 1131 * 1132 * @memberof QualModelPlugin_t 1133 */ 1134 LIBSBML_EXTERN 1135 unsigned int 1136 QualModelPlugin_getNumTransitions(QualModelPlugin_t* qmp); 1137 1138 1139 /** 1140 * Creates a new Transition_t object, adds it to this QualModelPlugin_t object 1141 * and returns the Transition_t object created. 1142 * 1143 * @param qmp the QualModelPlugin_t structure to which the Transition_t should 1144 * be added. 1145 * 1146 * @return a new Transition_t object instance. 1147 * 1148 * @memberof QualModelPlugin_t 1149 */ 1150 LIBSBML_EXTERN 1151 Transition_t* 1152 QualModelPlugin_createTransition(QualModelPlugin_t* qmp); 1153 1154 1155 /** 1156 * Removes the nth Transition_t from this QualModelPlugin_t and returns a 1157 * pointer to it. 1158 * 1159 * @param qmp the QualModelPlugin_t structure to search. 1160 * 1161 * @param n an unsigned int representing the index of the Transition_t to 1162 * remove. 1163 * 1164 * @return a pointer to the nth Transition_t in this QualModelPlugin_t. 1165 * 1166 * @memberof QualModelPlugin_t 1167 */ 1168 LIBSBML_EXTERN 1169 Transition_t* 1170 QualModelPlugin_removeTransition(QualModelPlugin_t* qmp, unsigned int n); 1171 1172 1173 /** 1174 * Removes the Transition_t from this QualModelPlugin_t based on its identifier 1175 * and returns a pointer to it. 1176 * 1177 * @param qmp the QualModelPlugin_t structure to search. 1178 * 1179 * @param sid a string representing the identifier of the Transition_t to 1180 * remove. 1181 * 1182 * @return the Transition_t in this QualModelPlugin_t based on the identifier 1183 * or @c NULL if no such Transition_t exists. 1184 * 1185 * @memberof QualModelPlugin_t 1186 */ 1187 LIBSBML_EXTERN 1188 Transition_t* 1189 QualModelPlugin_removeTransitionById(QualModelPlugin_t* qmp, const char* sid); 1190 1191 1192 1193 1194 END_C_DECLS 1195 1196 1197 1198 1199 LIBSBML_CPP_NAMESPACE_END 1200 1201 1202 1203 1204 #endif /* !SWIG */ 1205 1206 1207 1208 1209 #endif /* !QualModelPlugin_H__ */ 1210 1211 1212