1 /** 2 * @file Unit.h 3 * @brief Definitions of Unit and ListOfUnits. 4 * @author Ben Bornstein 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 37 * the Free Software Foundation. A copy of the license agreement is provided 38 * in the file named "LICENSE.txt" included with this software distribution 39 * and also available online as http://sbml.org/software/libsbml/license.html 40 * ---------------------------------------------------------------------- --> 41 * 42 * @class Unit 43 * @sbmlbrief{core} A single unit referenced in an SBML <em>unit definition</em>. 44 * 45 * The SBML unit definition facility uses two classes of objects, 46 * UnitDefinition and Unit. The approach to defining units in %SBML is 47 * compositional; for example, <em>meter second<sup> –2</sup></em> is 48 * constructed by combining a Unit object representing <em>meter</em> with 49 * another Unit object representing <em>second<sup> –2</sup></em>. 50 * The combination is wrapped inside a UnitDefinition, which provides for 51 * assigning an identifier and optional name to the combination. The 52 * identifier can then be referenced from elsewhere in a model. Thus, the 53 * UnitDefinition class is the container, and Unit instances are placed 54 * inside UnitDefinition instances. 55 * 56 * A Unit has four attributes named "kind", "exponent", "scale" 57 * and "multiplier". It represents a (possibly transformed) reference to a 58 * base unit. The attribute "kind" on Unit indicates the chosen base unit. 59 * Its value must be one of the text strings listed below; this list 60 * corresponds to SBML Level 3: 61 * 62 * @copydetails doc_base_units 63 * 64 * A few small differences exist between the Level 3 list of base 65 * units and the list defined in other Level/Version combinations of SBML. 66 * Specifically, Levels of SBML before Level 3 do not define 67 * @c avogadro; conversely, Level 2 Version 1 defines @c Celsius, 68 * and Level 1 defines @c celsius, @c meter, and @c liter, none of 69 * which are available in Level 3. In libSBML, each of the predefined 70 * base unit names is represented by an enumeration value @if clike in 71 * #UnitKind_t@else whose name begins with the characters 72 * <code>UNIT_KIND_</code>@endif, discussed in a separate section below. 73 * 74 * The attribute named "exponent" on Unit represents an exponent on the 75 * unit. In SBML Level 2, the attribute is optional and has a default 76 * value of @c 1 (one); in SBML Level 3, the attribute is mandatory 77 * and there is no default value. A Unit also has an attribute 78 * called "scale"; its value must be an integer exponent for a power-of-ten 79 * multiplier used to set the scale of the unit. For example, a unit 80 * having a "kind" value of @c gram and a "scale" value of @c -3 signifies 81 * 10<sup> –3</sup> \f$\times\f$ gram, or milligrams. In SBML 82 * Level 2, the attribute is optional and has a default value of @c 0 83 * (zero), because 10<sup> 0</sup> = 1; in SBML Level 3, the attribute 84 * is mandatory and has no default value. Lastly, the attribute named 85 * "multiplier" can be used to multiply the unit by a real-numbered factor; 86 * this enables the definition of units that are not power-of-ten multiples 87 * of SI units. For instance, a multiplier of 0.3048 could be used to 88 * define @c foot as a measure of length in terms of a @c metre. The 89 * "multiplier" attribute is optional in SBML Level 2, where it has a 90 * default value of @c 1 (one); in SBML Level 3, the attribute is 91 * mandatory and has no default value. 92 * 93 * @if clike 94 * <h3><a class="anchor" name="UnitKind_t">UnitKind_t</a></h3> 95 * @else 96 * <h3><a class="anchor" name="UnitKind_t">%Unit identification codes</a></h3> 97 * @endif@~ 98 * 99 * As discussed above, SBML defines a set of base units which serves as the 100 * starting point for new unit definitions. This set of base units 101 * consists of the SI units and a small number of additional convenience 102 * units. 103 * 104 * @if clike Until SBML Level 2 Version 3, there 105 * existed a data type in the SBML specifications called @c UnitKind, 106 * enumerating the possible SBML base units. Although SBML Level 2 107 * Version 3 removed this type from the language specification, 108 * libSBML maintains the corresponding enumeration type #UnitKind_t as a 109 * convenience and as a way to provide backward compatibility to previous 110 * SBML Level/Version specifications. (The removal in SBML Level 2 111 * Version 3 of the enumeration @c UnitKind was also accompanied by 112 * the redefinition of the data type @c UnitSId to include the previous 113 * @c UnitKind values as reserved symbols in the @c UnitSId space. This 114 * change has no net effect on permissible models, their representation or 115 * their syntax. The purpose of the change in the SBML specification was 116 * simply to clean up an inconsistency about the contexts in which these 117 * values were usable.) 118 * @endif@if java In SBML Level 2 Versions before 119 * Version 3, there existed an enumeration of units called 120 * @c UnitKind. In Version 3, this enumeration was removed and the 121 * identifier class @c UnitSId redefined to include the previous 122 * @c UnitKind values as reserved symbols. This change has no net effect on 123 * permissible models, their representation or their syntax. The purpose 124 * of the change in the SBML specification was simply to clean up an 125 * inconsistency about the contexts in which these values were usable. 126 * However, libSBML maintains UnitKind in the form of of a set of static 127 * integer constants whose names begin with the characters 128 * <code>UNIT_KIND_</code>. These constants are defined in the class 129 * <code><a href="libsbmlConstants.html">libsbmlConstants</a></code>. 130 * @endif@if python In SBML Level 2 Versions before 131 * Version 3, there existed an enumeration of units called 132 * @c UnitKind. In Version 3, this enumeration was removed and the 133 * identifier class @c UnitSId redefined to include the previous 134 * @c UnitKind values as reserved symbols. This change has no net effect on 135 * permissible models, their representation or their syntax. The purpose 136 * of the change in the SBML specification was simply to clean up an 137 * inconsistency about the contexts in which these values were usable. 138 * However, libSBML maintains UnitKind in the form of of a set of static 139 * integer constants whose names begin with the characters 140 * <code>UNIT_KIND_</code>. These constants are defined in the class 141 * @link libsbml libsbml@endlink. 142 * @endif@~ 143 * 144 * As a consequence of the fact that libSBML supports models in all Levels 145 * and Versions of SBML, libSBML's set of @c UNIT_KIND_ values is a union 146 * of all the possible base unit names defined in the different SBML 147 * specifications. However, not every base unit is allowed in every 148 * Level+Version combination of SBML. Note in particular the following 149 * exceptions: 150 * <ul> 151 * <li> The alternate spelling @c "meter" is included in 152 * addition to the official SI spelling @c "metre". This spelling is only 153 * permitted in SBML Level 1 models. 154 * 155 * <li> The alternate spelling @c "liter" is included in addition to the 156 * official SI spelling @c "litre". This spelling is only permitted in 157 * SBML Level 1 models. 158 * 159 * <li> The unit @c "Celsius" is included because of its presence in 160 * specifications of SBML prior to SBML Level 2 Version 2. 161 * 162 * <li> The unit @c avogadro was introduced in SBML Level 3, and 163 * is only permitted for use in SBML Level 3 models. 164 * </ul> 165 * 166 * @if clike The table below lists the symbols defined in the 167 * @c UnitKind_t enumeration, and their 168 * meanings. @else The table below lists the unit 169 * constants defined in libSBML, and their meanings. @endif@~ 170 * 171 * @htmlinclude unitkind-table.html 172 * 173 * <!-- ------------------------------------------------------------------- --> 174 * @class ListOfUnits 175 * @sbmlbrief{core} A list of Unit objects. 176 * 177 * ListOfUnits is entirely contained within UnitDefinition. 178 * 179 * @copydetails doc_what_is_listof 180 */ 181 182 /** 183 * <!-- ~ ~ ~ ~ ~ Start of common documentation strings ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 184 * The following text is used as common documentation blocks copied multiple 185 * times elsewhere in this file. The use of @class is a hack needed because 186 * Doxygen's @copydetails command has limited functionality. Symbols 187 * beginning with "doc_" are marked as ignored in our Doxygen configuration. 188 * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ --> 189 * 190 * @class doc_warning_unit_offset_only_l2v1 191 * 192 * @warning <span class="warning">The "offset" attribute is only available in 193 * SBML Level 2 Version 1. This attribute is not present in SBML 194 * Level 2 Version 2 or above. When producing SBML models using 195 * these later specifications, modelers and software tools need to account 196 * for units with offsets explicitly. The %SBML specification document 197 * offers a number of suggestions for how to achieve this. LibSBML methods 198 * such as this one related to "offset" are retained for compatibility with 199 * earlier versions of SBML Level 2, but their use is strongly 200 * discouraged.</span> 201 * 202 */ 203 204 #ifndef Unit_h 205 #define Unit_h 206 207 #include <math.h> 208 209 #include <sbml/common/common.h> 210 #include <sbml/common/extern.h> 211 #include <sbml/common/sbmlfwd.h> 212 #include <sbml/UnitKind.h> 213 214 215 #ifdef __cplusplus 216 217 218 #include <string> 219 #include <cstring> 220 221 #include <sbml/SBase.h> 222 #include <sbml/ListOf.h> 223 #include <sbml/common/operationReturnValues.h> 224 225 LIBSBML_CPP_NAMESPACE_BEGIN 226 227 class SBMLVisitor; 228 229 230 class LIBSBML_EXTERN Unit : public SBase 231 { 232 public: 233 234 /** 235 * Creates a new Unit using the given SBML @p level and @p version 236 * values. 237 * 238 * @param level an unsigned int, the SBML Level to assign to this Unit. 239 * 240 * @param version an unsigned int, the SBML Version to assign to this 241 * Unit. 242 * 243 * @copydetails doc_throw_exception_lv 244 * 245 * @copydetails doc_note_setting_lv 246 */ 247 Unit (unsigned int level, unsigned int version); 248 249 250 /** 251 * Creates a new Unit using the given SBMLNamespaces object 252 * @p sbmlns. 253 * 254 * @copydetails doc_what_are_sbmlnamespaces 255 * 256 * @param sbmlns an SBMLNamespaces object. 257 * 258 * @copydetails doc_throw_exception_namespace 259 * 260 * @copydetails doc_note_setting_lv 261 */ 262 Unit (SBMLNamespaces* sbmlns); 263 264 265 /** 266 * Destroys this Unit. 267 */ 268 virtual ~Unit (); 269 270 271 /** 272 * Copy constructor; creates a copy of this Unit. 273 * 274 * @param orig the object to copy. 275 */ 276 Unit(const Unit& orig); 277 278 279 /** 280 * Assignment operator. 281 * 282 * @param rhs the object whose values are used as the basis of the 283 * assignment. 284 */ 285 Unit& operator=(const Unit& rhs); 286 287 288 /** @cond doxygenLibsbmlInternal */ 289 /** 290 * Accepts the given SBMLVisitor for this instance of Unit. 291 * 292 * @param v the SBMLVisitor instance to be used. 293 * 294 * @return the result of calling <code>v.visit()</code>, which indicates 295 * whether the Visitor would like to visit the next Unit in the list 296 * of units within which this Unit is embedded (i.e., in the ListOfUnits 297 * located in the enclosing UnitDefinition instance). 298 */ 299 virtual bool accept (SBMLVisitor& v) const; 300 /** @endcond */ 301 302 303 /** 304 * Creates and returns a deep copy of this Unit object. 305 * 306 * @return the (deep) copy of this Unit object. 307 */ 308 virtual Unit* clone () const; 309 310 311 /** 312 * Initializes the fields of this Unit object to "typical" default 313 * values. 314 * 315 * The SBML Unit component has slightly different aspects and default 316 * attribute values in different SBML Levels and Versions. This method 317 * sets the values to certain common defaults, based mostly on what they 318 * are in SBML Level 2. Specifically: 319 * <ul> 320 * <li> Sets attribute "exponent" to @c 1 321 * <li> Sets attribute "scale" to @c 0 322 * <li> Sets attribute "multiplier" to @c 1.0 323 * </ul> 324 * 325 * The "kind" attribute is left unchanged. 326 */ 327 void initDefaults (); 328 329 330 /** 331 * Returns the "kind" of Unit this is. 332 * 333 * @if clike 334 * @return the value of the "kind" attribute of this Unit as a 335 * value from the <a class="el" href="#UnitKind_t">UnitKind_t</a> enumeration. 336 * @endif@if java 337 * @return the value of the "kind" attribute of this Unit as a 338 * value from the set of constants whose names begin 339 * with <code>UNIT_KIND_</code> defined in the class 340 * <code><a href="libsbmlConstants.html">libsbmlConstants</a></code>. 341 * @endif@if python 342 * @return the value of the "kind" attribute of this Unit as a 343 * value from the set of constants whose names begin 344 * with <code>UNIT_KIND_</code> defined in the class 345 * @link libsbml libsbml@endlink. 346 * @endif@~ 347 */ 348 UnitKind_t getKind () const; 349 350 351 /** 352 * Returns the value of the "exponent" attribute of this unit. 353 * 354 * @return the "exponent" value of this Unit, as an integer. 355 */ 356 int getExponent () const; 357 358 359 /** 360 * Returns the value of the "exponent" attribute of this unit. 361 * 362 * @return the "exponent" value of this Unit, as a double. 363 */ 364 double getExponentAsDouble () const; 365 366 367 /** 368 * Returns the value of the "scale" attribute of this unit. 369 * 370 * @return the "scale" value of this Unit, as an integer. 371 */ 372 int getScale () const; 373 374 375 /** 376 * Returns the value of the "multiplier" attribute of this Unit. 377 * 378 * @return the "multiplier" value of this Unit, as a double. 379 */ 380 double getMultiplier () const; 381 382 383 /** 384 * Returns the value of the "offset" attribute of this Unit. 385 * 386 * @return the "offset" value of this Unit, as a double. 387 * 388 * @copydetails doc_warning_unit_offset_only_l2v1 389 */ 390 double getOffset () const; 391 392 393 /** 394 * Predicate for testing whether this Unit is of the kind @c ampere. 395 * 396 * @return @c true if the kind of this Unit is @c ampere, @c false 397 * otherwise. 398 */ 399 bool isAmpere () const; 400 401 402 /** 403 * Predicate for testing whether this Unit is of the kind @c avogadro. 404 * 405 * @return @c true if the kind of this Unit is @c avogadro, @c false 406 * otherwise. 407 * 408 * @note The unit @c avogadro was introduced in SBML Level 3, and 409 * is only permitted for use in SBML Level 3 models. 410 */ 411 bool isAvogadro () const; 412 413 414 /** 415 * Predicate for testing whether this Unit is of the kind @c becquerel 416 * 417 * @return @c true if the kind of this Unit is @c becquerel, @c false 418 * otherwise. 419 */ 420 bool isBecquerel () const; 421 422 423 /** 424 * Predicate for testing whether this Unit is of the kind @c candela 425 * 426 * @return @c true if the kind of this Unit is @c candela, @c false 427 * otherwise. 428 */ 429 bool isCandela () const; 430 431 432 /** 433 * Predicate for testing whether this Unit is of the kind @c Celsius 434 * 435 * @return @c true if the kind of this Unit is @c Celsius, @c false 436 * otherwise. 437 * 438 * @warning <span class="warning">The predefined unit @c Celsius was 439 * removed from the list of predefined units in SBML Level 2 440 * Version 2 at the same time that the "offset" attribute was removed 441 * from Unit definitions. LibSBML methods such as this one related to 442 * @c Celsius are retained in order to support SBML Level 2 443 * Version 1, but their use is strongly discouraged.</span> 444 */ 445 bool isCelsius () const; 446 447 448 /** 449 * Predicate for testing whether this Unit is of the kind @c coulomb 450 * 451 * @return @c true if the kind of this Unit is @c coulomb, @c false 452 * otherwise. 453 */ 454 bool isCoulomb () const; 455 456 457 /** 458 * Predicate for testing whether this Unit is of the kind 459 * @c dimensionless. 460 * 461 * @return @c true if the kind of this Unit is @c dimensionless, @c false 462 * otherwise. 463 */ 464 bool isDimensionless () const; 465 466 467 /** 468 * Predicate for testing whether this Unit is of the kind @c farad 469 * 470 * @return @c true if the kind of this Unit is @c farad, @c false 471 * otherwise. 472 */ 473 bool isFarad () const; 474 475 476 /** 477 * Predicate for testing whether this Unit is of the kind @c gram 478 * 479 * @return @c true if the kind of this Unit is @c gram, @c false 480 * otherwise. 481 */ 482 bool isGram () const; 483 484 485 /** 486 * Predicate for testing whether this Unit is of the kind @c gray 487 * 488 * @return @c true if the kind of this Unit is @c gray, @c false 489 * otherwise. 490 */ 491 bool isGray () const; 492 493 494 /** 495 * Predicate for testing whether this Unit is of the kind @c henry 496 * 497 * @return @c true if the kind of this Unit is @c henry, @c false 498 * otherwise. 499 */ 500 bool isHenry () const; 501 502 503 /** 504 * Predicate for testing whether this Unit is of the kind @c hertz 505 * 506 * @return @c true if the kind of this Unit is @c hertz, @c false 507 * otherwise. 508 */ 509 bool isHertz () const; 510 511 512 /** 513 * Predicate for testing whether this Unit is of the kind @c item 514 * 515 * @return @c true if the kind of this Unit is @c item, @c false 516 * otherwise. 517 */ 518 bool isItem () const; 519 520 521 /** 522 * Predicate for testing whether this Unit is of the kind @c joule 523 * 524 * @return @c true if the kind of this Unit is @c joule, @c false 525 * otherwise. 526 */ 527 bool isJoule () const; 528 529 530 /** 531 * Predicate for testing whether this Unit is of the kind @c katal 532 * 533 * @return @c true if the kind of this Unit is @c katal, @c false 534 * otherwise. 535 */ 536 bool isKatal () const; 537 538 539 /** 540 * Predicate for testing whether this Unit is of the kind @c kelvin 541 * 542 * @return @c true if the kind of this Unit is @c kelvin, @c false 543 * otherwise. 544 */ 545 bool isKelvin () const; 546 547 548 /** 549 * Predicate for testing whether this Unit is of the kind @c kilogram 550 * 551 * @return @c true if the kind of this Unit is @c kilogram, @c false 552 * otherwise. 553 */ 554 bool isKilogram () const; 555 556 557 /** 558 * Predicate for testing whether this Unit is of the kind @c litre 559 * 560 * @return @c true if the kind of this Unit is @c litre or 'liter', 561 * @c false otherwise. 562 */ 563 bool isLitre () const; 564 565 566 /** 567 * Predicate for testing whether this Unit is of the kind @c lumen 568 * 569 * @return @c true if the kind of this Unit is @c lumen, @c false 570 * otherwise. 571 */ 572 bool isLumen () const; 573 574 575 /** 576 * Predicate for testing whether this Unit is of the kind @c lux 577 * 578 * @return @c true if the kind of this Unit is @c lux, @c false 579 * otherwise. 580 */ 581 bool isLux () const; 582 583 584 /** 585 * Predicate for testing whether this Unit is of the kind @c metre 586 * 587 * @return @c true if the kind of this Unit is @c metre or 'meter', 588 * @c false 589 * otherwise. 590 */ 591 bool isMetre () const; 592 593 594 /** 595 * Predicate for testing whether this Unit is of the kind @c mole 596 * 597 * @return @c true if the kind of this Unit is @c mole, @c false 598 * otherwise. 599 */ 600 bool isMole () const; 601 602 603 /** 604 * Predicate for testing whether this Unit is of the kind @c newton 605 * 606 * @return @c true if the kind of this Unit is @c newton, @c false 607 * otherwise. 608 */ 609 bool isNewton () const; 610 611 612 /** 613 * Predicate for testing whether this Unit is of the kind @c ohm 614 * 615 * @return @c true if the kind of this Unit is @c ohm, @c false 616 * otherwise. 617 */ 618 bool isOhm () const; 619 620 621 /** 622 * Predicate for testing whether this Unit is of the kind @c pascal 623 * 624 * @return @c true if the kind of this Unit is @c pascal, @c false 625 * otherwise. 626 */ 627 bool isPascal () const; 628 629 630 /** 631 * Predicate for testing whether this Unit is of the kind @c radian 632 * 633 * @return @c true if the kind of this Unit is @c radian, @c false 634 * otherwise. 635 */ 636 bool isRadian () const; 637 638 639 /** 640 * Predicate for testing whether this Unit is of the kind @c second 641 * 642 * @return @c true if the kind of this Unit is @c second, @c false 643 * otherwise. 644 */ 645 bool isSecond () const; 646 647 648 /** 649 * Predicate for testing whether this Unit is of the kind @c siemens 650 * 651 * @return @c true if the kind of this Unit is @c siemens, @c false 652 * otherwise. 653 */ 654 bool isSiemens () const; 655 656 657 /** 658 * Predicate for testing whether this Unit is of the kind @c sievert 659 * 660 * @return @c true if the kind of this Unit is @c sievert, @c false 661 * otherwise. 662 */ 663 bool isSievert () const; 664 665 666 /** 667 * Predicate for testing whether this Unit is of the kind @c steradian 668 * 669 * @return @c true if the kind of this Unit is @c steradian, @c false 670 * otherwise. 671 */ 672 bool isSteradian () const; 673 674 675 /** 676 * Predicate for testing whether this Unit is of the kind @c tesla 677 * 678 * @return @c true if the kind of this Unit is @c tesla, @c false 679 * otherwise. 680 */ 681 bool isTesla () const; 682 683 684 /** 685 * Predicate for testing whether this Unit is of the kind @c volt 686 * 687 * @return @c true if the kind of this Unit is @c volt, @c false 688 * otherwise. 689 */ 690 bool isVolt () const; 691 692 693 /** 694 * Predicate for testing whether this Unit is of the kind @c watt 695 * 696 * @return @c true if the kind of this Unit is @c watt, @c false 697 * otherwise. 698 */ 699 bool isWatt () const; 700 701 702 /** 703 * Predicate for testing whether this Unit is of the kind @c weber 704 * 705 * @return @c true if the kind of this Unit is @c weber, @c false 706 * otherwise. 707 */ 708 bool isWeber () const; 709 710 711 /** 712 * Predicate to test whether the "kind" attribute of this Unit is set. 713 * 714 * @return @c true if the "kind" attribute of this Unit is set, 715 * @c false otherwise. 716 */ 717 bool isSetKind () const; 718 719 720 /** 721 * Predicate to test whether the "exponent" attribute of this Unit 722 * is set. 723 * 724 * @return @c true if the "exponent" attribute of this Unit is set, 725 * @c false otherwise. 726 */ 727 bool isSetExponent () const; 728 729 730 /** 731 * Predicate to test whether the "scale" attribute of this Unit 732 * is set. 733 * 734 * @return @c true if the "scale" attribute of this Unit is set, 735 * @c false otherwise. 736 */ 737 bool isSetScale () const; 738 739 740 /** 741 * Predicate to test whether the "multiplier" attribute of this Unit 742 * is set. 743 * 744 * @return @c true if the "multiplier" attribute of this Unit is set, 745 * @c false otherwise. 746 */ 747 bool isSetMultiplier () const; 748 749 750 /** 751 * Predicate to test whether the "offset" attribute of this Unit 752 * is set. 753 * 754 * @return @c true if the "offset" attribute of this Unit is set, 755 * @c false otherwise. 756 * 757 * @copydetails doc_warning_unit_offset_only_l2v1 758 */ 759 bool isSetOffset () const; 760 761 762 /** 763 * Sets the "kind" attribute value of this Unit. 764 * 765 * @if clike 766 * @param kind a value from the <a class="el" 767 * href="#UnitKind_t">UnitKind_t</a> enumeration. 768 * @endif@if java 769 * @param kind a unit identifier chosen from the set of constants whose 770 * names begin with <code>UNIT_KIND_</code> in <code><a 771 * href="libsbmlConstants.html">libsbmlConstants</a></code>. 772 * @endif@if python 773 * @param kind a unit identifier chosen from the set of constants whose 774 * names begin with <code>UNIT_KIND_</code> in @link libsbml libsbml@endlink. 775 * @endif@~ 776 * 777 * @copydetails doc_returns_success_code 778 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 779 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 780 */ 781 int setKind (UnitKind_t kind); 782 783 784 /** 785 * Sets the "exponent" attribute value of this Unit. 786 * 787 * @param value the integer to which the attribute "exponent" should be set. 788 * 789 * @copydetails doc_returns_success_code 790 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 791 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 792 */ 793 int setExponent (int value); 794 795 796 /** 797 * Sets the "exponent" attribute value of this Unit. 798 * 799 * @param value the double to which the attribute "exponent" should be set. 800 * 801 * @copydetails doc_returns_success_code 802 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 803 */ 804 int setExponent (double value); 805 806 807 /** 808 * Sets the "scale" attribute value of this Unit. 809 * 810 * @param value the integer to which the attribute "scale" should be set. 811 * 812 * @copydetails doc_returns_success_code 813 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 814 */ 815 int setScale (int value); 816 817 818 /** 819 * Sets the "multipler" attribute value of this Unit. 820 * 821 * @param value the floating-point value to which the attribute 822 * "multiplier" should be set. 823 * 824 * @copydetails doc_returns_success_code 825 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 826 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 827 */ 828 int setMultiplier (double value); 829 830 831 /** 832 * Sets the "offset" attribute value of this Unit. 833 * 834 * @param value the floating point value to which the attribute "offset" 835 * should set. 836 * 837 * @copydetails doc_returns_success_code 838 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 839 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 840 * 841 * @copydetails doc_warning_unit_offset_only_l2v1 842 */ 843 int setOffset (double value); 844 845 846 /** 847 * Unsets the "kind" attribute value of this Unit. 848 * 849 * @copydetails doc_returns_success_code 850 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 851 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 852 */ 853 int unsetKind (); 854 855 856 /** 857 * Unsets the "exponent" attribute value of this Unit. 858 * 859 * @copydetails doc_returns_success_code 860 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 861 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 862 */ 863 int unsetExponent (); 864 865 866 /** 867 * Unsets the "scale" attribute value of this Unit. 868 * 869 * @copydetails doc_returns_success_code 870 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 871 */ 872 int unsetScale (); 873 874 875 /** 876 * Unsets the "multipler" attribute value of this Unit. 877 * 878 * @copydetails doc_returns_success_code 879 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 880 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 881 */ 882 int unsetMultiplier (); 883 884 885 /** 886 * Unsets the "offset" attribute value of this Unit. 887 * 888 * @copydetails doc_returns_success_code 889 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 890 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 891 * 892 * @copydetails doc_warning_unit_offset_only_l2v1 893 */ 894 int unsetOffset (); 895 896 897 /** 898 * Returns the libSBML type code of this object instance. 899 * 900 * @copydetails doc_what_are_typecodes 901 * 902 * @return the SBML type code for this object: 903 * @sbmlconstant{SBML_UNIT, SBMLTypeCode_t} (default). 904 * 905 * @copydetails doc_warning_typecodes_not_unique 906 * 907 * @see getPackageName() 908 * @see getElementName() 909 */ 910 virtual int getTypeCode () const; 911 912 913 /** 914 * Returns the XML element name of this object, which for Unit, is 915 * always @c "unit". 916 * 917 * @return the name of this element, i.e., @c "unit". 918 */ 919 virtual const std::string& getElementName () const; 920 921 922 /** @cond doxygenLibsbmlInternal */ 923 /** 924 * Subclasses should override this method to write out their contained 925 * SBML objects as XML elements. Be sure to call your parent's 926 * implementation of this method as well. 927 */ 928 virtual void writeElements (XMLOutputStream& stream) const; 929 /** @endcond */ 930 931 932 /** 933 * Predicate to test whether a given string is the name of a built-in SBML 934 * unit, depending on the SBML level, since new predefined units were added 935 * between level 2 versions 1 and 2, and then all predefined units were removed 936 * again in SBML Level 3. 937 * 938 * @param name a string to be tested against the built-in unit names. 939 * @param level the level of SBML one is checking. 940 * 941 * @return @c true if @p name is one of @c "substance", @c "volume", 942 * or @c "time" and the @p level is @c 1; or if @p name is one of 943 * @c "substance", @c "volume", @c "area", @c "length", or @c "time" and 944 * the @p level is @c 2; @c false otherwise (including all values when 945 * @p level is @c 3). 946 * 947 * 948 * @copydetails doc_note_static_methods 949 */ 950 static bool isBuiltIn (const std::string& name, unsigned int level); 951 952 953 /** 954 * Predicate to test whether a given string is the name of a valid 955 * base unit in SBML (such as @c "gram" or @c "mole"). 956 * 957 * This method exists because prior to SBML Level 2 Version 3, 958 * an enumeration called @c UnitKind was defined by SBML. This enumeration 959 * was removed in SBML Level 2 Version 3 and its values were 960 * folded into the space of values of a type called @c UnitSId. This method 961 * therefore has less significance in SBML Level 2 Version 3 962 * and Level 2 Version 4, but remains for backward 963 * compatibility and support for reading models in older Versions of 964 * Level 2. 965 * 966 * @param name a string to be tested. 967 * 968 * @param level an unsigned int representing the SBML specification 969 * Level. 970 * 971 * @param version an unsigned int representing the SBML specification 972 * Version. 973 * 974 * @return @c true if name is a valid SBML UnitKind, @c false otherwise. 975 * 976 * @note The allowed unit names differ between SBML Levels 1 977 * and 2 and again slightly between Level 2 Versions 1 978 * and 2. 979 * 980 * @copydetails doc_note_static_methods 981 */ 982 static bool isUnitKind (const std::string& name, 983 unsigned int level, unsigned int version); 984 985 986 /** 987 * Predicate returning @c true if two 988 * Unit objects are identical. 989 * 990 * Two Unit objects are considered to be @em identical if they match in 991 * all attributes. (Contrast this to the method areEquivalent(@if java 992 * Unit u1, %Unit u2@endif), which compares Unit objects only with respect 993 * to certain attributes.) 994 * 995 * @param unit1 the first Unit object to compare. 996 * @param unit2 the second Unit object to compare. 997 * 998 * @return @c true if all the attributes of unit1 are identical 999 * to the attributes of unit2, @c false otherwise. 1000 * 1001 * @copydetails doc_note_static_methods 1002 * 1003 * @see @if clike areEquivalent() @else Unit::areEquivalent(Unit u1, %Unit u2) @endif@~ 1004 */ 1005 static bool areIdentical(Unit * unit1, Unit * unit2); 1006 1007 1008 /** 1009 * Predicate returning @c true if 1010 * Unit objects are equivalent. 1011 * 1012 * Two Unit objects are considered to be @em equivalent either if (1) both 1013 * have a "kind" attribute value of @c dimensionless, or (2) their "kind", 1014 * "exponent" and (for SBML Level 2 Version 1) "offset" 1015 * attribute values are equal. (Contrast this to the method 1016 * areIdentical(@if java Unit, %Unit@endif), which compares Unit objects with respect to all 1017 * attributes, not just the "kind" and "exponent".) 1018 * 1019 * @param unit1 the first Unit object to compare. 1020 * @param unit2 the second Unit object to compare. 1021 * 1022 * @return @c true if the "kind" and "exponent" attributes of unit1 are 1023 * identical to the kind and exponent attributes of unit2, or if the kind 1024 * attributes of both are @c dimensionless; @c false otherwise. 1025 * 1026 * @copydetails doc_note_static_methods 1027 * 1028 * @see @if clike areIdentical() @else Unit::areIdentical(Unit u1, %Unit u2) @endif@~ 1029 */ 1030 static bool areEquivalent(Unit * unit1, Unit * unit2); 1031 1032 1033 /** 1034 * Manipulates the attributes of the Unit to express the unit with the 1035 * value of the scale attribute reduced to zero. 1036 * 1037 * For example, 1 millimetre can be expressed as a Unit with kind= 1038 * @c "metre" multiplier=@c "1" scale=@c "-3" exponent=@c "1". It can also be 1039 * expressed as a Unit with kind=@c "metre" 1040 * multiplier=<code>"0.001"</code> scale=@c "0" exponent=@c "1". 1041 * 1042 * @param unit the Unit object to manipulate. 1043 * 1044 * @copydetails doc_returns_one_success_code 1045 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1046 * 1047 * @copydetails doc_note_static_methods 1048 * 1049 * @see @if clike convertToSI() @else Unit::convertToSI(Unit u) @endif@~ 1050 * @see @if clike merge() @else Unit::merge(Unit u1, Unit u2) @endif@~ 1051 */ 1052 static int removeScale(Unit * unit); 1053 1054 1055 /** 1056 * Merges two Unit objects with the same "kind" attribute value into a 1057 * single Unit. 1058 * 1059 * For example, the following, 1060 * @verbatim 1061 <unit kind="metre" exponent="2"/> 1062 <unit kind="metre" exponent="1"/> 1063 @endverbatim 1064 * would be merged to become 1065 * @verbatim 1066 <unit kind="metre" exponent="3"/> 1067 @endverbatim 1068 * 1069 * @param unit1 the first Unit object; the result of the operation is 1070 * left as a new version of this unit, modified in-place. Not modified if 1071 * the two units have different kinds. 1072 * 1073 * @param unit2 the second Unit object to merge with the first. 1074 * 1075 * @copydetails doc_note_static_methods 1076 * 1077 * @see @if clike convertToSI() @else Unit::convertToSI(Unit u) @endif@~ 1078 * @see @if clike removeScale() @else Unit::removeScale(Unit u) @endif@~ 1079 */ 1080 static void merge(Unit * unit1, Unit * unit2); 1081 1082 1083 /** 1084 * Returns a UnitDefinition object containing the given @p unit converted 1085 * to the appropriate SI unit. 1086 * 1087 * This method exists because some units can be expressed in terms of 1088 * others when the same physical dimension is involved. For example, one 1089 * hertz is identical to 1 sec<sup>-1</sup>, one litre is equivalent 1090 * to 1 cubic decametre, and so on. 1091 * 1092 * @param unit the Unit object to convert to SI. 1093 * 1094 * @return a UnitDefinition object containing the SI unit. 1095 * 1096 * @copydetails doc_note_static_methods 1097 * 1098 * @see @if clike merge() @else Unit::merge(Unit u1, Unit u2) @endif@~ 1099 */ 1100 static UnitDefinition * convertToSI(const Unit * unit); 1101 1102 1103 /** 1104 * Predicate returning @c true if 1105 * all the required attributes for this Unit object 1106 * have been set. 1107 * 1108 * The required attributes for a Unit object are: 1109 * @li "kind" 1110 * @li "exponent" (required in SBML Level 3; optional in Level 2) 1111 * @li "multiplier" (required in SBML Level 3; optional in Level 2) 1112 * @li "scale" (required in SBML Level 3; optional in Level 2) 1113 * 1114 * @return @c true if the required attributes have been set, @c false 1115 * otherwise. 1116 */ 1117 virtual bool hasRequiredAttributes() const ; 1118 1119 1120 1121 1122 1123 1124 #ifndef SWIG 1125 1126 1127 1128 /** @cond doxygenLibsbmlInternal */ 1129 1130 /** 1131 * Returns the value of the "attributeName" attribute of this Unit. 1132 * 1133 * @param attributeName, the name of the attribute to retrieve. 1134 * 1135 * @param value, the address of the value to record. 1136 * 1137 * @copydetails doc_returns_success_code 1138 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1139 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1140 */ 1141 virtual int getAttribute(const std::string& attributeName, bool& value) 1142 const; 1143 1144 /** @endcond */ 1145 1146 1147 1148 /** @cond doxygenLibsbmlInternal */ 1149 1150 /** 1151 * Returns the value of the "attributeName" attribute of this Unit. 1152 * 1153 * @param attributeName, the name of the attribute to retrieve. 1154 * 1155 * @param value, the address of the value to record. 1156 * 1157 * @copydetails doc_returns_success_code 1158 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1159 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1160 */ 1161 virtual int getAttribute(const std::string& attributeName, int& value) const; 1162 1163 /** @endcond */ 1164 1165 1166 1167 /** @cond doxygenLibsbmlInternal */ 1168 1169 /** 1170 * Returns the value of the "attributeName" attribute of this Unit. 1171 * 1172 * @param attributeName, the name of the attribute to retrieve. 1173 * 1174 * @param value, the address of the value to record. 1175 * 1176 * @copydetails doc_returns_success_code 1177 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1178 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1179 */ 1180 virtual int getAttribute(const std::string& attributeName, 1181 double& value) const; 1182 1183 /** @endcond */ 1184 1185 1186 1187 /** @cond doxygenLibsbmlInternal */ 1188 1189 /** 1190 * Returns the value of the "attributeName" attribute of this Unit. 1191 * 1192 * @param attributeName, the name of the attribute to retrieve. 1193 * 1194 * @param value, the address of the value to record. 1195 * 1196 * @copydetails doc_returns_success_code 1197 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1198 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1199 */ 1200 virtual int getAttribute(const std::string& attributeName, 1201 unsigned int& value) const; 1202 1203 /** @endcond */ 1204 1205 1206 1207 /** @cond doxygenLibsbmlInternal */ 1208 1209 /** 1210 * Returns the value of the "attributeName" attribute of this Unit. 1211 * 1212 * @param attributeName, the name of the attribute to retrieve. 1213 * 1214 * @param value, the address of the value to record. 1215 * 1216 * @copydetails doc_returns_success_code 1217 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1218 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1219 */ 1220 virtual int getAttribute(const std::string& attributeName, 1221 std::string& value) const; 1222 1223 /** @endcond */ 1224 1225 1226 1227 /** @cond doxygenLibsbmlInternal */ 1228 1229 /** 1230 * Returns the value of the "attributeName" attribute of this Unit. 1231 * 1232 * @param attributeName, the name of the attribute to retrieve. 1233 * 1234 * @param value, the address of the value to record. 1235 * 1236 * @copydetails doc_returns_success_code 1237 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1238 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1239 */ 1240 //virtual int getAttribute(const std::string& attributeName, 1241 // const char* value) const; 1242 1243 /** @endcond */ 1244 1245 1246 1247 /** @cond doxygenLibsbmlInternal */ 1248 1249 /** 1250 * Predicate returning @c true if this Unit's attribute "attributeName" is 1251 * set. 1252 * 1253 * @param attributeName, the name of the attribute to query. 1254 * 1255 * @return @c true if this Unit's attribute "attributeName" has been set, 1256 * otherwise @c false is returned. 1257 */ 1258 virtual bool isSetAttribute(const std::string& attributeName) const; 1259 1260 /** @endcond */ 1261 1262 1263 1264 /** @cond doxygenLibsbmlInternal */ 1265 1266 /** 1267 * Sets the value of the "attributeName" attribute of this Unit. 1268 * 1269 * @param attributeName, the name of the attribute to set. 1270 * 1271 * @param value, the value of the attribute to set. 1272 * 1273 * @copydetails doc_returns_success_code 1274 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1275 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1276 */ 1277 virtual int setAttribute(const std::string& attributeName, bool value); 1278 1279 /** @endcond */ 1280 1281 1282 1283 /** @cond doxygenLibsbmlInternal */ 1284 1285 /** 1286 * Sets the value of the "attributeName" attribute of this Unit. 1287 * 1288 * @param attributeName, the name of the attribute to set. 1289 * 1290 * @param value, the value of the attribute to set. 1291 * 1292 * @copydetails doc_returns_success_code 1293 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1294 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1295 */ 1296 virtual int setAttribute(const std::string& attributeName, int value); 1297 1298 /** @endcond */ 1299 1300 1301 1302 /** @cond doxygenLibsbmlInternal */ 1303 1304 /** 1305 * Sets the value of the "attributeName" attribute of this Unit. 1306 * 1307 * @param attributeName, the name of the attribute to set. 1308 * 1309 * @param value, the value of the attribute to set. 1310 * 1311 * @copydetails doc_returns_success_code 1312 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1313 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1314 */ 1315 virtual int setAttribute(const std::string& attributeName, double value); 1316 1317 /** @endcond */ 1318 1319 1320 1321 /** @cond doxygenLibsbmlInternal */ 1322 1323 /** 1324 * Sets the value of the "attributeName" attribute of this Unit. 1325 * 1326 * @param attributeName, the name of the attribute to set. 1327 * 1328 * @param value, the value of the attribute to set. 1329 * 1330 * @copydetails doc_returns_success_code 1331 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1332 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1333 */ 1334 virtual int setAttribute(const std::string& attributeName, 1335 unsigned int value); 1336 1337 /** @endcond */ 1338 1339 1340 1341 /** @cond doxygenLibsbmlInternal */ 1342 1343 /** 1344 * Sets the value of the "attributeName" attribute of this Unit. 1345 * 1346 * @param attributeName, the name of the attribute to set. 1347 * 1348 * @param value, the value of the attribute to set. 1349 * 1350 * @copydetails doc_returns_success_code 1351 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1352 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1353 */ 1354 virtual int setAttribute(const std::string& attributeName, 1355 const std::string& value); 1356 1357 /** @endcond */ 1358 1359 1360 1361 /** @cond doxygenLibsbmlInternal */ 1362 1363 /** 1364 * Sets the value of the "attributeName" attribute of this Unit. 1365 * 1366 * @param attributeName, the name of the attribute to set. 1367 * 1368 * @param value, the value of the attribute to set. 1369 * 1370 * @copydetails doc_returns_success_code 1371 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1372 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1373 */ 1374 //virtual int setAttribute(const std::string& attributeName, const char* 1375 // value); 1376 1377 /** @endcond */ 1378 1379 1380 1381 /** @cond doxygenLibsbmlInternal */ 1382 1383 /** 1384 * Unsets the value of the "attributeName" attribute of this Unit. 1385 * 1386 * @param attributeName, the name of the attribute to query. 1387 * 1388 * @copydetails doc_returns_success_code 1389 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 1390 * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t} 1391 */ 1392 virtual int unsetAttribute(const std::string& attributeName); 1393 1394 /** @endcond */ 1395 1396 1397 1398 1399 #endif /* !SWIG */ 1400 1401 /** @cond doxygenLibsbmlInternal */ 1402 void setExponentUnitChecking(double value); 1403 1404 double getExponentUnitChecking(); 1405 1406 double getExponentUnitChecking() const; 1407 1408 bool isUnitChecking(); 1409 1410 bool isUnitChecking() const; 1411 1412 /** @endcond */ 1413 1414 1415 protected: 1416 /** @cond doxygenLibsbmlInternal */ 1417 /** 1418 * Subclasses should override this method to get the list of 1419 * expected attributes. 1420 * This function is invoked from corresponding readAttributes() 1421 * function. 1422 */ 1423 virtual void addExpectedAttributes(ExpectedAttributes& attributes); 1424 1425 1426 /** 1427 * Subclasses should override this method to read values from the given 1428 * XMLAttributes set into their specific fields. Be sure to call your 1429 * parent's implementation of this method as well. 1430 */ 1431 virtual void readAttributes (const XMLAttributes& attributes, 1432 const ExpectedAttributes& expectedAttributes); 1433 1434 void readL1Attributes (const XMLAttributes& attributes); 1435 1436 void readL2Attributes (const XMLAttributes& attributes); 1437 1438 void readL3Attributes (const XMLAttributes& attributes); 1439 1440 1441 /** 1442 * Subclasses should override this method to write their XML attributes 1443 * to the XMLOutputStream. Be sure to call your parent's implementation 1444 * of this method as well. 1445 */ 1446 virtual void writeAttributes (XMLOutputStream& stream) const; 1447 1448 1449 /** 1450 * Predicate to test whether a given string is the name of a valid 1451 * base unit in SBML Level 1 (such as @c "gram" or @c "mole") 1452 * 1453 * @param name a string to be tested. 1454 * 1455 * @return @c true if name is a valid SBML UnitKind, @c false otherwise. 1456 */ 1457 static bool isL1UnitKind (const std::string& name); 1458 1459 1460 /** 1461 * Predicate to test whether a given string is the name of a valid base 1462 * unit in SBML Level 2 Version 1 (such as @c "gram" or 1463 * @c "mole") 1464 * 1465 * @param name a string to be tested. 1466 * 1467 * @return @c true if name is a valid SBML UnitKind, @c false otherwise. 1468 */ 1469 static bool isL2V1UnitKind (const std::string& name); 1470 1471 1472 /** 1473 * Predicate to test whether a given string is the name of a valid base 1474 * unit in SBML Level 2 Version 2, 3 or 4 (such as @c "gram" or 1475 * @c "mole") 1476 * 1477 * @param name a string to be tested. 1478 * 1479 * @return @c true if name is a valid SBML UnitKind, @c false otherwise. 1480 */ 1481 static bool isL2UnitKind (const std::string& name); 1482 1483 1484 /** 1485 * Predicate to test whether a given string is the name of a valid base 1486 * unit in SBML Level 3 (such as @c "gram" or 1487 * @c "mole") 1488 * 1489 * @param name a string to be tested. 1490 * 1491 * @return @c true if name is a valid SBML UnitKind, @c false otherwise. 1492 */ 1493 static bool isL3UnitKind (const std::string& name); 1494 isExplicitlySetExponent()1495 bool isExplicitlySetExponent() const { return mExplicitlySetExponent; }; 1496 isExplicitlySetMultiplier()1497 bool isExplicitlySetMultiplier() const { return mExplicitlySetMultiplier; }; 1498 isExplicitlySetScale()1499 bool isExplicitlySetScale() const { return mExplicitlySetScale; }; 1500 isExplicitlySetOffset()1501 bool isExplicitlySetOffset() const { return mExplicitlySetOffset; }; 1502 1503 UnitKind_t mKind; 1504 int mExponent; 1505 double mExponentDouble; 1506 int mScale; 1507 double mMultiplier; 1508 double mOffset; 1509 1510 bool mIsSetExponent; 1511 bool mIsSetScale; 1512 bool mIsSetMultiplier; 1513 1514 bool mExplicitlySetExponent; 1515 bool mExplicitlySetMultiplier; 1516 bool mExplicitlySetScale; 1517 bool mExplicitlySetOffset; 1518 1519 bool mInternalUnitCheckingFlag; 1520 1521 /* the validator classes need to be friends to access the 1522 * protected constructor that takes no arguments 1523 */ 1524 friend class Validator; 1525 friend class ConsistencyValidator; 1526 friend class IdentifierConsistencyValidator; 1527 friend class InternalConsistencyValidator; 1528 friend class L1CompatibilityValidator; 1529 friend class L2v1CompatibilityValidator; 1530 friend class L2v2CompatibilityValidator; 1531 friend class L2v3CompatibilityValidator; 1532 friend class L2v4CompatibilityValidator; 1533 friend class L3v1CompatibilityValidator; 1534 friend class MathMLConsistencyValidator; 1535 friend class ModelingPracticeValidator; 1536 friend class OverdeterminedValidator; 1537 friend class SBOConsistencyValidator; 1538 friend class UnitConsistencyValidator; 1539 friend class UnitFormulaFormatter; 1540 friend class UnitDefinition; 1541 friend class ASTBasePlugin; 1542 1543 1544 /** @endcond */ 1545 }; 1546 1547 1548 1549 class LIBSBML_EXTERN ListOfUnits : public ListOf 1550 { 1551 public: 1552 1553 /** 1554 * Creates a new ListOfUnits object. 1555 * 1556 * The object is constructed such that it is valid for the given SBML 1557 * Level and Version combination. 1558 * 1559 * @param level the SBML Level. 1560 * 1561 * @param version the Version within the SBML Level. 1562 * 1563 * @copydetails doc_throw_exception_lv 1564 * 1565 * @copydetails doc_note_setting_lv 1566 */ 1567 ListOfUnits (unsigned int level, unsigned int version); 1568 1569 1570 /** 1571 * Creates a new ListOfUnits object. 1572 * 1573 * The object is constructed such that it is valid for the SBML Level and 1574 * Version combination determined by the SBMLNamespaces object in @p 1575 * sbmlns. 1576 * 1577 * @param sbmlns an SBMLNamespaces object that is used to determine the 1578 * characteristics of the ListOfUnits object to be created. 1579 * 1580 * @copydetails doc_throw_exception_namespace 1581 * 1582 * @copydetails doc_note_setting_lv 1583 */ 1584 ListOfUnits (SBMLNamespaces* sbmlns); 1585 1586 1587 /** 1588 * Creates and returns a deep copy of this ListOfUnits object. 1589 * 1590 * @return the (deep) copy of this ListOfUnits object. 1591 */ 1592 virtual ListOfUnits* clone () const; 1593 1594 1595 /** 1596 * Returns the libSBML type code for the objects contained in this ListOf 1597 * (i.e., Unit objects, if the list is non-empty). 1598 * 1599 * @copydetails doc_what_are_typecodes 1600 * 1601 * @return the SBML type code for objects contained in this list: 1602 * @sbmlconstant{SBML_UNIT, SBMLTypeCode_t} (default). 1603 * 1604 * @see getElementName() 1605 * @see getPackageName() 1606 */ 1607 virtual int getItemTypeCode () const; 1608 1609 1610 /** 1611 * Returns the XML element name of this object. 1612 * 1613 * For ListOfUnits, the XML element name is @c "listOfUnits". 1614 * 1615 * @return the name of this element, i.e., @c "listOfUnits". 1616 */ 1617 virtual const std::string& getElementName () const; 1618 1619 1620 /** 1621 * Get a Unit from the ListOfUnits. 1622 * 1623 * @param n the index number of the Unit to get. 1624 * 1625 * @return the nth Unit in this ListOfUnits. 1626 * If the index @p n is invalid, @c NULL is returned. 1627 * 1628 * @see size() 1629 */ 1630 virtual Unit * get(unsigned int n); 1631 1632 1633 /** 1634 * Get a Unit from the ListOfUnits. 1635 * 1636 * @param n the index number of the Unit to get. 1637 * 1638 * @return the nth Unit in this ListOfUnits. 1639 * If the index @p n is invalid, @c NULL is returned. 1640 * 1641 * @see size() 1642 */ 1643 virtual const Unit * get(unsigned int n) const; 1644 1645 1646 /** 1647 * Removes the nth item from this ListOfUnits items and returns a pointer to 1648 * it. 1649 * 1650 * The caller owns the returned item and is responsible for deleting it. 1651 * 1652 * @param n the index of the item to remove. 1653 * 1654 * @see size() 1655 */ 1656 virtual Unit* remove (unsigned int n); 1657 1658 1659 /** @cond doxygenLibsbmlInternal */ 1660 /** 1661 * Get the ordinal position of this element in the containing object 1662 * (which in this case is the Model object). 1663 * 1664 * @return the ordinal position of the element with respect to its 1665 * siblings, or @c -1 (default) to indicate the position is not significant. 1666 */ 1667 virtual int getElementPosition () const; 1668 1669 /** @endcond */ 1670 1671 1672 protected: 1673 /** @cond doxygenLibsbmlInternal */ 1674 /** 1675 * Create a ListOfUnits object corresponding to the next token 1676 * in the XML input stream. 1677 * 1678 * @return the %SBML object corresponding to next XMLToken in the 1679 * XMLInputStream, or @c NULL if the token was not recognized. 1680 */ 1681 virtual SBase* createObject (XMLInputStream& stream); 1682 1683 /** @endcond */ 1684 }; 1685 1686 LIBSBML_CPP_NAMESPACE_END 1687 1688 #endif /* __cplusplus */ 1689 1690 1691 #ifndef SWIG 1692 1693 LIBSBML_CPP_NAMESPACE_BEGIN 1694 BEGIN_C_DECLS 1695 1696 /** 1697 * Creates a new Unit_t structure using the given SBML @p level 1698 * and @p version values. 1699 * 1700 * @param level an unsigned int, the SBML Level to assign to this 1701 * Unit_t. 1702 * 1703 * @param version an unsigned int, the SBML Version to assign to this 1704 * Unit_t. 1705 * 1706 * @return a pointer to the newly created Unit_t structure. 1707 * 1708 * @copydetails doc_note_setting_lv 1709 * 1710 * @memberof Unit_t 1711 */ 1712 LIBSBML_EXTERN 1713 Unit_t * 1714 Unit_create (unsigned int level, unsigned int version); 1715 1716 1717 /** 1718 * Creates a new Unit_t structure using the given 1719 * SBMLNamespaces_t structure. 1720 * 1721 * @param sbmlns SBMLNamespaces, a pointer to an SBMLNamespaces_t structure 1722 * to assign to this Unit_t. 1723 * 1724 * @return a pointer to the newly created Unit_t structure. 1725 * 1726 * @copydetails doc_note_setting_lv 1727 * 1728 * @memberof Unit_t 1729 */ 1730 LIBSBML_EXTERN 1731 Unit_t * 1732 Unit_createWithNS (SBMLNamespaces_t *sbmlns); 1733 1734 1735 /** 1736 * Frees the given Unit_t structure. 1737 * 1738 * @param u the Unit_t structure to be freed. 1739 * 1740 * @memberof Unit_t 1741 */ 1742 LIBSBML_EXTERN 1743 void 1744 Unit_free (Unit_t *u); 1745 1746 1747 /** 1748 * Creates a deep copy of the given Unit_t structure 1749 * 1750 * @param u the Unit_t structure to be copied. 1751 * 1752 * @return a (deep) copy of the given Unit_t structure. 1753 * 1754 * @memberof Unit_t 1755 */ 1756 LIBSBML_EXTERN 1757 Unit_t * 1758 Unit_clone (const Unit_t* u); 1759 1760 1761 /** 1762 * Initializes the attributes of this Unit_t (except for "kind") to their 1763 * default values. 1764 * 1765 * The default values are as follows: 1766 * 1767 * - exponent = 1 1768 * - scale = 0 1769 * - multiplier = 1.0 1770 * 1771 * @memberof Unit_t 1772 */ 1773 LIBSBML_EXTERN 1774 void 1775 Unit_initDefaults (Unit_t *u); 1776 1777 1778 /** 1779 * Returns a list of XMLNamespaces_t associated with this Unit_t 1780 * structure. 1781 * 1782 * @param u the Unit_t structure. 1783 * 1784 * @return pointer to the XMLNamespaces_t structure associated with 1785 * this structure. 1786 * 1787 * @memberof Unit_t 1788 */ 1789 LIBSBML_EXTERN 1790 const XMLNamespaces_t * 1791 Unit_getNamespaces(Unit_t *u); 1792 1793 1794 /** 1795 * Returns the "kind" attribute value of the given unit @p u. 1796 * 1797 * @return the value of the "kind" attribute of this Unit_t as a value from 1798 * the UnitKind_t enumeration. 1799 * 1800 * @memberof Unit_t 1801 */ 1802 LIBSBML_EXTERN 1803 UnitKind_t 1804 Unit_getKind (const Unit_t *u); 1805 1806 1807 /** 1808 * Returns the value of the "exponent" attribute of the given Unit_t 1809 * structure @p u. 1810 * 1811 * @param u a Unit_t structure. 1812 * 1813 * @return the "exponent" value of this Unit_t structure, as an integer. 1814 * 1815 * @memberof Unit_t 1816 */ 1817 LIBSBML_EXTERN 1818 int 1819 Unit_getExponent (const Unit_t *u); 1820 1821 1822 /** 1823 * Returns the value of the "exponent" attribute of the given Unit_t 1824 * structure @p u. 1825 * 1826 * @param u a Unit_t structure. 1827 * 1828 * @return the "exponent" value of this Unit_t structure, as a double. 1829 * 1830 * @memberof Unit_t 1831 */ 1832 LIBSBML_EXTERN 1833 double 1834 Unit_getExponentAsDouble (const Unit_t *u); 1835 1836 1837 /** 1838 * Returns the value of the "scale" attribute of the given Unit_t structure 1839 * @p u. 1840 * 1841 * @param u a Unit_t structure. 1842 * 1843 * @return the "scale" value of this Unit_t, as an integer. 1844 * 1845 * @memberof Unit_t 1846 */ 1847 LIBSBML_EXTERN 1848 int 1849 Unit_getScale (const Unit_t *u); 1850 1851 1852 /** 1853 * Returns the value of the "multiplier" attribute of the given Unit_t 1854 * structure @p u. 1855 * 1856 * @param u a Unit_t structure. 1857 * 1858 * @return the "multiplier" value of this Unit_t, as a double 1859 * 1860 * @memberof Unit_t 1861 */ 1862 LIBSBML_EXTERN 1863 double 1864 Unit_getMultiplier (const Unit_t *u); 1865 1866 1867 /** 1868 * Returns the value of the "offset" attribute of the given Unit_t 1869 * structure @p u. 1870 * 1871 * @param u a Unit_t structure. 1872 * 1873 * @return the "offset" value of this Unit_t, as a double 1874 * 1875 * @warning The "offset" attribute is only available in SBML Level 2 1876 * Version 1. This attribute is not present in SBML Level 2 Version 2 or 1877 * above. When producing SBML models using these later specifications, 1878 * Modelers and software need to account for units with offsets explicitly. 1879 * The SBML specification document offers a number of suggestions for how 1880 * to achieve this. LibSBML functions such as this one related to "offset" 1881 * are retained for compatibility with earlier versions of SBML Level 2, 1882 * but their use is strongly discouraged. 1883 * 1884 * 1885 * @memberof Unit_t 1886 */ 1887 LIBSBML_EXTERN 1888 double 1889 Unit_getOffset (const Unit_t *u); 1890 1891 1892 /** 1893 * Predicate for testing whether the given Unit_t structure represents a 1894 * unit of the kind @c ampere. 1895 * 1896 * @param u the Unit_t structure to query. 1897 * 1898 * @return @c 1 (true) if the "kind" attribute of the given 1899 * Unit_t structure is set to @c "ampere", @c 0 (false) otherwise. 1900 * 1901 * @memberof Unit_t 1902 */ 1903 LIBSBML_EXTERN 1904 int 1905 Unit_isAmpere (const Unit_t *u); 1906 1907 1908 /** 1909 * Predicate for testing whether the given Unit_t structure represents a 1910 * unit of the kind @c becquerel. 1911 * 1912 * @param u the Unit_t structure to query. 1913 * 1914 * @return @c 1 (true) if the "kind" attribute of the given 1915 * Unit_t structure is set to @c "becquerel", @c 0 (false) otherwise. 1916 * 1917 * @memberof Unit_t 1918 */ 1919 LIBSBML_EXTERN 1920 int 1921 Unit_isBecquerel (const Unit_t *u); 1922 1923 1924 /** 1925 * Predicate for testing whether the given Unit_t structure represents a 1926 * unit of the kind @c candela. 1927 * 1928 * @param u the Unit_t structure to query. 1929 * 1930 * @return @c 1 (true) if the "kind" attribute of the given 1931 * Unit_t structure is set to @c "candela", @c 0 (false) otherwise. 1932 * 1933 * @memberof Unit_t 1934 */ 1935 LIBSBML_EXTERN 1936 int 1937 Unit_isCandela (const Unit_t *u); 1938 1939 1940 /** 1941 * Predicate for testing whether the given Unit_t structure represents a 1942 * unit of the kind @c Celsius. 1943 * 1944 * @param u the Unit_t structure to query. 1945 * 1946 * @return @c 1 (true) if the "kind" attribute of the given 1947 * Unit_t structure is set to @c "Celsius", @c 0 (false) otherwise. 1948 * 1949 * @warning The predefined unit @c Celsius was removed from the list of 1950 * predefined units in SBML Level 2 Version 2 at the same time that the 1951 * "offset" attribute was removed from Unit definitions. LibSBML functions 1952 * such as this one related to @c Celsius are retained for compatibility 1953 * with earlier versions of SBML Level 2, but their use is strongly 1954 * discouraged. 1955 * 1956 * @memberof Unit_t 1957 */ 1958 LIBSBML_EXTERN 1959 int 1960 Unit_isCelsius (const Unit_t *u); 1961 1962 1963 /** 1964 * Predicate for testing whether the given Unit_t structure represents a 1965 * unit of the kind @c coulomb. 1966 * 1967 * @param u the Unit_t structure to query. 1968 * 1969 * @return @c 1 (true) if the "kind" attribute of the given 1970 * Unit_t structure is set to @c "coulomb", @c 0 (false) otherwise. 1971 * 1972 * @memberof Unit_t 1973 */ 1974 LIBSBML_EXTERN 1975 int 1976 Unit_isCoulomb (const Unit_t *u); 1977 1978 1979 /** 1980 * Predicate for testing whether the given Unit_t structure represents a 1981 * unit of the kind @c dimensionless. 1982 * 1983 * @param u the Unit_t structure to query. 1984 * 1985 * @return @c 1 (true) if the "kind" attribute of the given 1986 * Unit_t structure is set to @c "dimensionless", @c 0 (false) otherwise. 1987 * 1988 * @memberof Unit_t 1989 */ 1990 LIBSBML_EXTERN 1991 int 1992 Unit_isDimensionless (const Unit_t *u); 1993 1994 1995 /** 1996 * Predicate for testing whether the given Unit_t structure represents a 1997 * unit of the kind @c farad. 1998 * 1999 * @param u the Unit_t structure to query. 2000 * 2001 * @return @c 1 (true) if the "kind" attribute of the given 2002 * Unit_t structure is set to @c "farad", @c 0 (false) otherwise. 2003 * 2004 * @memberof Unit_t 2005 */ 2006 LIBSBML_EXTERN 2007 int 2008 Unit_isFarad (const Unit_t *u); 2009 2010 2011 /** 2012 * Predicate for testing whether the given Unit_t structure represents a 2013 * unit of the kind @c gram. 2014 * 2015 * @param u the Unit_t structure to query. 2016 * 2017 * @return @c 1 (true) if the "kind" attribute of the given 2018 * Unit_t structure is set to @c "gram", @c 0 (false) otherwise. 2019 * 2020 * @memberof Unit_t 2021 */ 2022 LIBSBML_EXTERN 2023 int 2024 Unit_isGram (const Unit_t *u); 2025 2026 2027 /** 2028 * Predicate for testing whether the given Unit_t structure represents a 2029 * unit of the kind @c gray. 2030 * 2031 * @param u the Unit_t structure to query. 2032 * 2033 * @return @c 1 (true) if the "kind" attribute of the given 2034 * Unit_t structure is set to @c "gray", @c 0 (false) otherwise. 2035 * 2036 * @memberof Unit_t 2037 */ 2038 LIBSBML_EXTERN 2039 int 2040 Unit_isGray (const Unit_t *u); 2041 2042 2043 /** 2044 * Predicate for testing whether the given Unit_t structure represents a 2045 * unit of the kind @c henry. 2046 * 2047 * @param u the Unit_t structure to query. 2048 * 2049 * @return @c 1 (true) if the "kind" attribute of the given 2050 * Unit_t structure is set to @c "henry", @c 0 (false) otherwise. 2051 * 2052 * @memberof Unit_t 2053 */ 2054 LIBSBML_EXTERN 2055 int 2056 Unit_isHenry (const Unit_t *u); 2057 2058 2059 /** 2060 * Predicate for testing whether the given Unit_t structure represents a 2061 * unit of the kind @c hertz. 2062 * 2063 * @param u the Unit_t structure to query. 2064 * 2065 * @return @c 1 (true) if the "kind" attribute of the given 2066 * Unit_t structure is set to @c "hertz", @c 0 (false) otherwise. 2067 * 2068 * @memberof Unit_t 2069 */ 2070 LIBSBML_EXTERN 2071 int 2072 Unit_isHertz (const Unit_t *u); 2073 2074 2075 /** 2076 * Predicate for testing whether the given Unit_t structure represents a 2077 * unit of the kind @c item. 2078 * 2079 * @param u the Unit_t structure to query. 2080 * 2081 * @return @c 1 (true) if the "kind" attribute of the given 2082 * Unit_t structure is set to @c "item", @c 0 (false) otherwise. 2083 * 2084 * @memberof Unit_t 2085 */ 2086 LIBSBML_EXTERN 2087 int 2088 Unit_isItem (const Unit_t *u); 2089 2090 2091 /** 2092 * Predicate for testing whether the given Unit_t structure represents a 2093 * unit of the kind @c joule. 2094 * 2095 * @param u the Unit_t structure to query. 2096 * 2097 * @return @c 1 (true) if the "kind" attribute of the given 2098 * Unit_t structure is set to @c "joule", @c 0 (false) otherwise. 2099 * 2100 * @memberof Unit_t 2101 */ 2102 LIBSBML_EXTERN 2103 int 2104 Unit_isJoule (const Unit_t *u); 2105 2106 2107 /** 2108 * Predicate for testing whether the given Unit_t structure represents a 2109 * unit of the kind @c katal. 2110 * 2111 * @param u the Unit_t structure to query. 2112 * 2113 * @return @c 1 (true) if the "kind" attribute of the given 2114 * Unit_t structure is set to @c "katal", @c 0 (false) otherwise. 2115 * 2116 * @memberof Unit_t 2117 */ 2118 LIBSBML_EXTERN 2119 int 2120 Unit_isKatal (const Unit_t *u); 2121 2122 2123 /** 2124 * Predicate for testing whether the given Unit_t structure represents a 2125 * unit of the kind @c kelvin. 2126 * 2127 * @param u the Unit_t structure to query. 2128 * 2129 * @return @c 1 (true) if the "kind" attribute of the given 2130 * Unit_t structure is set to @c "kelvin", @c 0 (false) otherwise. 2131 * 2132 * @memberof Unit_t 2133 */ 2134 LIBSBML_EXTERN 2135 int 2136 Unit_isKelvin (const Unit_t *u); 2137 2138 2139 /** 2140 * Predicate for testing whether the given Unit_t structure represents a 2141 * unit of the kind @c kilogram. 2142 * 2143 * @param u the Unit_t structure to query. 2144 * 2145 * @return @c 1 (true) if the "kind" attribute of the given 2146 * Unit_t structure is set to @c "kilogram", @c 0 (false) otherwise. 2147 * 2148 * @memberof Unit_t 2149 */ 2150 LIBSBML_EXTERN 2151 int 2152 Unit_isKilogram (const Unit_t *u); 2153 2154 2155 /** 2156 * Predicate for testing whether the given Unit_t structure represents a 2157 * unit of the kind @c litre or @c liter. 2158 * 2159 * @param u the Unit_t structure to query. 2160 * 2161 * @return @c 1 (true) if the "kind" attribute of the given Unit_t 2162 * structure is set to @c "litre" or @c "liter", @c 0 (false) otherwise. 2163 * 2164 * @memberof Unit_t 2165 */ 2166 LIBSBML_EXTERN 2167 int 2168 Unit_isLitre (const Unit_t *u); 2169 2170 2171 /** 2172 * Predicate for testing whether the given Unit_t structure represents a 2173 * unit of the kind @c lumen. 2174 * 2175 * @param u the Unit_t structure to query. 2176 * 2177 * @return @c 1 (true) if the "kind" attribute of the given 2178 * Unit_t structure is set to @c "lumen", @c 0 (false) otherwise. 2179 * 2180 * @memberof Unit_t 2181 */ 2182 LIBSBML_EXTERN 2183 int 2184 Unit_isLumen (const Unit_t *u); 2185 2186 2187 /** 2188 * Predicate for testing whether the given Unit_t structure represents a 2189 * unit of the kind @c lux. 2190 * 2191 * @param u the Unit_t structure to query. 2192 * 2193 * @return @c 1 (true) if the "kind" attribute of the given 2194 * Unit_t structure is set to @c "lux", @c 0 (false) otherwise. 2195 * 2196 * @memberof Unit_t 2197 */ 2198 LIBSBML_EXTERN 2199 int 2200 Unit_isLux (const Unit_t *u); 2201 2202 2203 /** 2204 * Predicate for testing whether the given Unit_t structure represents a 2205 * unit of the kind @c metre or @c meter. 2206 * 2207 * @param u the Unit_t structure to query. 2208 * 2209 * @return @c 1 (true) if the "kind" attribute of the given Unit_t 2210 * structure is set to @c "metre" or @c "meter", @c 0 (false) otherwise. 2211 * 2212 * @memberof Unit_t 2213 */ 2214 LIBSBML_EXTERN 2215 int 2216 Unit_isMetre (const Unit_t *u); 2217 2218 2219 /** 2220 * Predicate for testing whether the given Unit_t structure represents a 2221 * unit of the kind @c mole. 2222 * 2223 * @param u the Unit_t structure to query. 2224 * 2225 * @return @c 1 (true) if the "kind" attribute of the given 2226 * Unit_t structure is set to @c "mole", @c 0 (false) otherwise. 2227 * 2228 * @memberof Unit_t 2229 */ 2230 LIBSBML_EXTERN 2231 int 2232 Unit_isMole (const Unit_t *u); 2233 2234 2235 /** 2236 * Predicate for testing whether the given Unit_t structure represents a 2237 * unit of the kind @c newton. 2238 * 2239 * @param u the Unit_t structure to query. 2240 * 2241 * @return @c 1 (true) if the "kind" attribute of the given 2242 * Unit_t structure is set to @c "newton", @c 0 (false) otherwise. 2243 * 2244 * @memberof Unit_t 2245 */ 2246 LIBSBML_EXTERN 2247 int 2248 Unit_isNewton (const Unit_t *u); 2249 2250 2251 /** 2252 * Predicate for testing whether the given Unit_t structure represents a 2253 * unit of the kind @c ohm. 2254 * 2255 * @param u the Unit_t structure to query. 2256 * 2257 * @return @c 1 (true) if the "kind" attribute of the given 2258 * Unit_t structure is set to @c "ohm", @c 0 (false) otherwise. 2259 * 2260 * @memberof Unit_t 2261 */ 2262 LIBSBML_EXTERN 2263 int 2264 Unit_isOhm (const Unit_t *u); 2265 2266 2267 /** 2268 * Predicate for testing whether the given Unit_t structure represents a 2269 * unit of the kind @c pascal. 2270 * 2271 * @param u the Unit_t structure to query. 2272 * 2273 * @return @c 1 (true) if the "kind" attribute of the given 2274 * Unit_t structure is set to @c "pascal", @c 0 (false) otherwise. 2275 * 2276 * @memberof Unit_t 2277 */ 2278 LIBSBML_EXTERN 2279 int 2280 Unit_isPascal (const Unit_t *u); 2281 2282 2283 /** 2284 * Predicate for testing whether the given Unit_t structure represents a 2285 * unit of the kind @c radian. 2286 * 2287 * @param u the Unit_t structure to query. 2288 * 2289 * @return @c 1 (true) if the "kind" attribute of the given 2290 * Unit_t structure is set to @c "radian", @c 0 (false) otherwise. 2291 * 2292 * @memberof Unit_t 2293 */ 2294 LIBSBML_EXTERN 2295 int 2296 Unit_isRadian (const Unit_t *u); 2297 2298 2299 /** 2300 * Predicate for testing whether the given Unit_t structure represents a 2301 * unit of the kind @c second. 2302 * 2303 * @param u the Unit_t structure to query. 2304 * 2305 * @return @c 1 (true) if the "kind" attribute of the given 2306 * Unit_t structure is set to @c "second", @c 0 (false) otherwise. 2307 * 2308 * @memberof Unit_t 2309 */ 2310 LIBSBML_EXTERN 2311 int 2312 Unit_isSecond (const Unit_t *u); 2313 2314 2315 /** 2316 * Predicate for testing whether the given Unit_t structure represents a 2317 * unit of the kind @c siemens. 2318 * 2319 * @param u the Unit_t structure to query. 2320 * 2321 * @return @c 1 (true) if the "kind" attribute of the given 2322 * Unit_t structure is set to @c "siemens", @c 0 (false) otherwise. 2323 * 2324 * @memberof Unit_t 2325 */ 2326 LIBSBML_EXTERN 2327 int 2328 Unit_isSiemens (const Unit_t *u); 2329 2330 2331 /** 2332 * Predicate for testing whether the given Unit_t structure represents a 2333 * unit of the kind @c sievert. 2334 * 2335 * @param u the Unit_t structure to query. 2336 * 2337 * @return @c 1 (true) if the "kind" attribute of the given 2338 * Unit_t structure is set to @c "sievert", @c 0 (false) otherwise. 2339 * 2340 * @memberof Unit_t 2341 */ 2342 LIBSBML_EXTERN 2343 int 2344 Unit_isSievert (const Unit_t *u); 2345 2346 2347 /** 2348 * Predicate for testing whether the given Unit_t structure represents a 2349 * unit of the kind @c steradian. 2350 * 2351 * @param u the Unit_t structure to query. 2352 * 2353 * @return @c 1 (true) if the "kind" attribute of the given 2354 * Unit_t structure is set to @c "steradian", @c 0 (false) otherwise. 2355 * 2356 * @memberof Unit_t 2357 */ 2358 LIBSBML_EXTERN 2359 int 2360 Unit_isSteradian (const Unit_t *u); 2361 2362 2363 /** 2364 * Predicate for testing whether the given Unit_t structure represents a 2365 * unit of the kind @c tesla. 2366 * 2367 * @param u the Unit_t structure to query. 2368 * 2369 * @return @c 1 (true) if the "kind" attribute of the given 2370 * Unit_t structure is set to @c "tesla", @c 0 (false) otherwise. 2371 * 2372 * @memberof Unit_t 2373 */ 2374 LIBSBML_EXTERN 2375 int 2376 Unit_isTesla (const Unit_t *u); 2377 2378 2379 /** 2380 * Predicate for testing whether the given Unit_t structure represents a 2381 * unit of the kind @c volt. 2382 * 2383 * @param u the Unit_t structure to query. 2384 * 2385 * @return @c 1 (true) if the "kind" attribute of the given 2386 * Unit_t structure is set to @c "volt", @c 0 (false) otherwise. 2387 * 2388 * @memberof Unit_t 2389 */ 2390 LIBSBML_EXTERN 2391 int 2392 Unit_isVolt (const Unit_t *u); 2393 2394 2395 /** 2396 * Predicate for testing whether the given Unit_t structure represents a 2397 * unit of the kind @c watt. 2398 * 2399 * @param u the Unit_t structure to query. 2400 * 2401 * @return @c 1 (true) if the "kind" attribute of the given 2402 * Unit_t structure is set to @c "watt", @c 0 (false) otherwise. 2403 * 2404 * @memberof Unit_t 2405 */ 2406 LIBSBML_EXTERN 2407 int 2408 Unit_isWatt (const Unit_t *u); 2409 2410 2411 /** 2412 * Predicate for testing whether the given Unit_t structure represents a 2413 * unit of the kind @c weber. 2414 * 2415 * @param u the Unit_t structure to query. 2416 * 2417 * @return @c 1 (true) if the "kind" attribute of the given 2418 * Unit_t structure is set to @c "weber", @c 0 (false) otherwise. 2419 * 2420 * @memberof Unit_t 2421 */ 2422 LIBSBML_EXTERN 2423 int 2424 Unit_isWeber (const Unit_t *u); 2425 2426 2427 /** 2428 * Predicate to test whether the "kind" attribute of the given Unit_t 2429 * structure @p u is set. 2430 * 2431 * @param u the Unit_t structure to query. 2432 * 2433 * @return @c 1 (true) if the "kind" attribute of the given 2434 * Unit_t structure is set, @c 0 (false) otherwise. 2435 * 2436 * @memberof Unit_t 2437 */ 2438 LIBSBML_EXTERN 2439 int 2440 Unit_isSetKind (const Unit_t *u); 2441 2442 2443 /** 2444 * Predicate to test whether the "exponent" attribute of the given Unit_t 2445 * structure @p u is set. 2446 * 2447 * @param u the Unit_t structure to query. 2448 * 2449 * @return @c 1 (true) if the "exponent" attribute of the given 2450 * Unit_t structure is set, @c 0 (false) otherwise. 2451 * 2452 * @memberof Unit_t 2453 */ 2454 LIBSBML_EXTERN 2455 int 2456 Unit_isSetExponent (const Unit_t *u); 2457 2458 2459 /** 2460 * Predicate to test whether the "multiplier" attribute of the given Unit_t 2461 * structure @p u is set. 2462 * 2463 * @param u the Unit_t structure to query. 2464 * 2465 * @return @c 1 (true) if the "multiplier" attribute of the given 2466 * Unit_t structure is set, @c 0 (false) otherwise. 2467 * 2468 * @memberof Unit_t 2469 */ 2470 LIBSBML_EXTERN 2471 int 2472 Unit_isSetMultiplier (const Unit_t *u); 2473 2474 2475 /** 2476 * Predicate to test whether the "scale" attribute of the given Unit_t 2477 * structure @p u is set. 2478 * 2479 * @param u the Unit_t structure to query. 2480 * 2481 * @return @c 1 (true) if the "scale" attribute of the given 2482 * Unit_t structure is set, @c 0 (false) otherwise. 2483 * 2484 * @memberof Unit_t 2485 */ 2486 LIBSBML_EXTERN 2487 int 2488 Unit_isSetScale (const Unit_t *u); 2489 2490 2491 /** 2492 * Predicate to test whether the "scale" attribute of the given Unit_t 2493 * structure @p u is set. 2494 * 2495 * @param u the Unit_t structure to query. 2496 * 2497 * @return @c 1 (true) if the "scale" attribute of the given 2498 * Unit_t structure is set, @c 0 (false) otherwise. 2499 * 2500 * @warning The "offset" attribute is only available in SBML Level 2 2501 * Version 1. This attribute is not present in SBML Level 2 Version 2 or 2502 * above. When producing SBML models using these later specifications, 2503 * Modelers and software need to account for units with offsets explicitly. 2504 * The SBML specification document offers a number of suggestions for how 2505 * to achieve this. LibSBML functions such as this one related to "offset" 2506 * are retained for compatibility with earlier versions of SBML Level 2, 2507 * but their use is strongly discouraged. 2508 * 2509 * @memberof Unit_t 2510 */ 2511 LIBSBML_EXTERN 2512 int 2513 Unit_isSetOffset (const Unit_t *u); 2514 2515 2516 /** 2517 * Sets the kind of the given Unit_t structure @p u to the given 2518 * UnitKind_t value. 2519 * 2520 * @param u the Unit_t structure whose value is to be set. 2521 * @param kind a value from the UnitKind_t enumeration. 2522 * 2523 * @copydetails doc_returns_success_code 2524 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2525 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 2526 * 2527 * @memberof Unit_t 2528 */ 2529 LIBSBML_EXTERN 2530 int 2531 Unit_setKind (Unit_t *u, UnitKind_t kind); 2532 2533 2534 /** 2535 * Sets the "exponent" attribute value of the given Unit_t structure @p u. 2536 * 2537 * @param u the Unit_t structure whose value is to be set. 2538 * @param value the integer to which the attribute "exponent" should be set. 2539 * 2540 * @copydetails doc_returns_success_code 2541 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2542 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 2543 * 2544 * @memberof Unit_t 2545 */ 2546 LIBSBML_EXTERN 2547 int 2548 Unit_setExponent (Unit_t *u, int value); 2549 2550 2551 /** 2552 * Sets the "exponent" attribute value of the given Unit_t structure @p u. 2553 * 2554 * @param u the Unit_t structure whose value is to be set. 2555 * @param value the double to which the attribute "exponent" should be set. 2556 * 2557 * @copydetails doc_returns_success_code 2558 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2559 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 2560 * 2561 * @memberof Unit_t 2562 */ 2563 LIBSBML_EXTERN 2564 int 2565 Unit_setExponentAsDouble (Unit_t *u, double value); 2566 2567 2568 /** 2569 * Sets the "scale" attribute value of the given Unit_t structure @p u. 2570 * 2571 * @param u the Unit_t structure whose value is to be set. 2572 * @param value the integer to which the attribute "scale" should be set. 2573 * 2574 * @copydetails doc_returns_success_code 2575 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2576 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 2577 * 2578 * @memberof Unit_t 2579 */ 2580 LIBSBML_EXTERN 2581 int 2582 Unit_setScale (Unit_t *u, int value); 2583 2584 2585 /** 2586 * Sets the "multiplier" attribute value of the given Unit_t structure @p u. 2587 * 2588 * @param u the Unit_t structure whose value is to be set. 2589 * @param value the integer to which the attribute "multiplier" should be set. 2590 * 2591 * @copydetails doc_returns_success_code 2592 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2593 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 2594 * 2595 * @memberof Unit_t 2596 */ 2597 LIBSBML_EXTERN 2598 int 2599 Unit_setMultiplier (Unit_t *u, double value); 2600 2601 2602 /** 2603 * Sets the "offset" attribute value of the given Unit_t structure @p u. 2604 * 2605 * @param u the Unit_t structure whose value is to be set. 2606 * @param value the integer to which the attribute "offset" should be set. 2607 * 2608 * @copydetails doc_returns_success_code 2609 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2610 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 2611 * 2612 * @warning The "offset" attribute is only available in SBML Level 2 2613 * Version 1. This attribute is not present in SBML Level 2 Version 2 or 2614 * above. When producing SBML models using these later specifications, 2615 * Modelers and software need to account for units with offsets explicitly. 2616 * The SBML specification document offers a number of suggestions for how 2617 * to achieve this. LibSBML functions such as this one related to "offset" 2618 * are retained for compatibility with earlier versions of SBML Level 2, 2619 * but their use is strongly discouraged. 2620 * 2621 * @memberof Unit_t 2622 */ 2623 LIBSBML_EXTERN 2624 int 2625 Unit_setOffset (Unit_t *u, double value); 2626 2627 2628 /** 2629 * Unsets the kind of the given Unit_t structure @p u. 2630 * 2631 * @param u the Unit_t structure whose value is to be set. 2632 * 2633 * @copydetails doc_returns_success_code 2634 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2635 * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t} 2636 * 2637 * @memberof Unit_t 2638 */ 2639 LIBSBML_EXTERN 2640 int 2641 Unit_unsetKind (Unit_t *u); 2642 2643 2644 /** 2645 * Unsets the "exponent" attribute value of the given Unit_t structure @p u. 2646 * 2647 * @param u the Unit_t structure whose value is to be set. 2648 * 2649 * @copydetails doc_returns_success_code 2650 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2651 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 2652 * 2653 * @memberof Unit_t 2654 */ 2655 LIBSBML_EXTERN 2656 int 2657 Unit_unsetExponent (Unit_t *u); 2658 2659 2660 /** 2661 * Unsets the "scale" attribute value of the given Unit_t structure @p u. 2662 * 2663 * @param u the Unit_t structure whose value is to be set. 2664 * 2665 * @copydetails doc_returns_success_code 2666 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2667 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 2668 * 2669 * @memberof Unit_t 2670 */ 2671 LIBSBML_EXTERN 2672 int 2673 Unit_unsetScale (Unit_t *u); 2674 2675 2676 /** 2677 * Unsets the "multiplier" attribute value of the given Unit_t structure @p u. 2678 * 2679 * @param u the Unit_t structure whose value is to be set. 2680 * 2681 * @copydetails doc_returns_success_code 2682 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2683 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 2684 * 2685 * @memberof Unit_t 2686 */ 2687 LIBSBML_EXTERN 2688 int 2689 Unit_unsetMultiplier (Unit_t *u); 2690 2691 2692 /** 2693 * Unsets the "offset" attribute value of the given Unit_t structure @p u. 2694 * 2695 * @param u the Unit_t structure whose value is to be set. 2696 * 2697 * @copydetails doc_returns_success_code 2698 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2699 * @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t} 2700 * 2701 * @warning The "offset" attribute is only available in SBML Level 2 2702 * Version 1. This attribute is not present in SBML Level 2 Version 2 or 2703 * above. When producing SBML models using these later specifications, 2704 * Modelers and software need to account for units with offsets explicitly. 2705 * The SBML specification document offers a number of suggestions for how 2706 * to achieve this. LibSBML functions such as this one related to "offset" 2707 * are retained for compatibility with earlier versions of SBML Level 2, 2708 * but their use is strongly discouraged. 2709 * 2710 * @memberof Unit_t 2711 */ 2712 LIBSBML_EXTERN 2713 int 2714 Unit_unsetOffset (Unit_t *u); 2715 2716 2717 /** 2718 * Predicate returning @c 1 (true) or @c 0 (false) depending on whether 2719 * all the required attributes for this Unit_t structure 2720 * have been set. 2721 * 2722 * The required attributes for a Unit_t structure are: 2723 * @li kind 2724 * @li exponent (L3 on) 2725 * @li multiplier (L3 on) 2726 * @li scale (L3 on) 2727 * 2728 * @return a boolean value indicating whether all the required 2729 * elements for this structure have been defined. 2730 * 2731 * @memberof Unit_t 2732 */ 2733 LIBSBML_EXTERN 2734 int 2735 Unit_hasRequiredAttributes(Unit_t *u); 2736 2737 2738 /** 2739 * Predicate to test whether a given string is the name of a built-in SBML 2740 * unit, depending on the SBML level, since new predefined units were added 2741 * between level 2 versions 1 and 2, and then all predefined units were removed 2742 * again in SBML Level 3. 2743 * 2744 * @param name a string to be tested against the built-in unit names. 2745 * @param level the level of SBML one is checking. 2746 * 2747 * @return @c 1 (true) if @p name is one of @c "substance", @c "volume", 2748 * or @c "time" and the @p level is @c 1; or if @p name is one of 2749 * @c "substance", @c "volume", @c "area", @c "length", or @c "time" and 2750 * the @p level is @c 2; @c 0 (false) otherwise (including all values when 2751 * @p level is @c 3). 2752 * 2753 * @memberof Unit_t 2754 */ 2755 LIBSBML_EXTERN 2756 int 2757 Unit_isBuiltIn (const char *name, unsigned int level); 2758 2759 /** 2760 * Predicate returning @c 1 (true) if two 2761 * Unit_t structures are identical. 2762 * 2763 * Two Unit_t structures are considered to be @em identical if they match in 2764 * all attributes. (Contrast this to the method Unit_areEquivalent(), which 2765 * compares Unit_t structures only with respect 2766 * to certain attributes.) 2767 * 2768 * @param unit1 the first Unit_t structure to compare. 2769 * @param unit2 the second Unit_t structure to compare. 2770 * 2771 * @return @c 1 (true) if all the attributes of unit1 are identical 2772 * to the attributes of unit2, @c 0 (false) otherwise. 2773 * 2774 * @see Unit_areEquivalent() 2775 * 2776 * @memberof Unit_t 2777 */ 2778 LIBSBML_EXTERN 2779 int 2780 Unit_areIdentical(Unit_t * unit1, Unit_t * unit2); 2781 2782 /** 2783 * Predicate returning @c true if 2784 * Unit_t structures are equivalent. 2785 * 2786 * Two Unit_t structures are considered to be @em equivalent either if (1) both 2787 * have a "kind" attribute value of @c dimensionless, or (2) their "kind", 2788 * "exponent" and (for SBML Level 2 Version 1) "offset" 2789 * attribute values are equal. (Contrast this to the method 2790 * Unit_areIdentical(), which compares Unit_t structures with respect to all 2791 * attributes, not just the "kind" and "exponent".) 2792 * 2793 * @param unit1 the first Unit_t structure to compare. 2794 * @param unit2 the second Unit_t structure to compare. 2795 * 2796 * @return @c 1 (true) if the "kind" and "exponent" attributes of unit1 are 2797 * identical to the kind and exponent attributes of unit2, or if the kind attributes 2798 * of both are @c dimensionless; @c 0 (false) otherwise. 2799 * 2800 * @see Unit_areIdentical() 2801 * 2802 * @memberof Unit_t 2803 */ 2804 LIBSBML_EXTERN 2805 int 2806 Unit_areEquivalent(Unit_t * unit1, Unit_t * unit2); 2807 2808 /** 2809 * Manipulates the attributes of the Unit_t to express the unit with the 2810 * value of the scale attribute reduced to zero. 2811 * 2812 * For example, 1 millimetre can be expressed as a Unit_t with kind= 2813 * @c "metre" multiplier=@c "1" scale=@c "-3" exponent=@c "1". It can also be 2814 * expressed as a Unit_t with kind=@c "metre" 2815 * multiplier=<code>"0.001"</code> scale=@c "0" exponent=@c "1". 2816 * 2817 * @param unit the Unit_t structure to manipulate. 2818 * 2819 * @copydetails doc_returns_success_code 2820 * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t} 2821 * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t} 2822 * 2823 * @see Unit_convertToSI() 2824 * @see Unit_merge() 2825 * 2826 * @memberof Unit_t 2827 */ 2828 LIBSBML_EXTERN 2829 int 2830 Unit_removeScale(Unit_t * unit); 2831 2832 /** 2833 * Merges two Unit_t structures with the same "kind" attribute value into a 2834 * single Unit. 2835 * 2836 * For example, the following, 2837 * @verbatim 2838 <unit kind="metre" exponent="2"/> 2839 <unit kind="metre" exponent="1"/> 2840 @endverbatim 2841 * would be merged to become 2842 * @verbatim 2843 <unit kind="metre" exponent="3"/> 2844 @endverbatim 2845 * 2846 * @param unit1 the first Unit_t structure; the result of the operation is 2847 * left as a new version of this unit, modified in-place. Not modified if 2848 * the two units have different kinds. 2849 * 2850 * @param unit2 the second Unit_t structure to merge with the first. 2851 * 2852 * @see Unit_convertToSI() 2853 * @see Unit_removeScale() 2854 * 2855 * @memberof Unit_t 2856 */ 2857 LIBSBML_EXTERN 2858 void 2859 Unit_merge(Unit_t * unit1, Unit_t * unit2); 2860 2861 /** 2862 * Returns a UnitDefinition_t structure containing the given @p unit converted 2863 * to the appropriate SI unit. 2864 * 2865 * This method exists because some units can be expressed in terms of 2866 * others when the same physical dimension is involved. For example, one 2867 * hertz is identical to 1 sec<sup>-1</sup>, one litre is equivalent 2868 * to 1 cubic decametre, and so on. 2869 * 2870 * @param unit the Unit_t structure to convert to SI. 2871 * 2872 * @return a UnitDefinition_t structure containing the SI unit. 2873 * 2874 * @see Unit_merge() 2875 * 2876 * @memberof Unit_t 2877 */ 2878 LIBSBML_EXTERN 2879 UnitDefinition_t * 2880 Unit_convertToSI(Unit_t * unit); 2881 2882 END_C_DECLS 2883 LIBSBML_CPP_NAMESPACE_END 2884 2885 #endif /* !SWIG */ 2886 #endif /* Unit_h */ 2887 2888