1 /** 2 * @file SedOneStep.h 3 * @brief Definition of the SedOneStep class. 4 * @author DEVISER 5 * 6 * <!-------------------------------------------------------------------------- 7 * This file is part of libSEDML. Please visit http://sed-ml.org for more 8 * information about SED-ML. The latest version of libSEDML can be found on 9 * github: https://github.com/fbergmann/libSEDML/ 10 * 11 12 * Copyright (c) 2013-2019, Frank T. Bergmann 13 * All rights reserved. 14 * 15 16 * Redistribution and use in source and binary forms, with or without 17 * modification, are permitted provided that the following conditions are met: 18 * 19 20 * 1. Redistributions of source code must retain the above copyright notice, 21 * this 22 * list of conditions and the following disclaimer. 23 * 2. Redistributions in binary form must reproduce the above copyright notice, 24 * this list of conditions and the following disclaimer in the documentation 25 * and/or other materials provided with the distribution. 26 * 27 * This library is free software; you can redistribute it and/or modify it 28 * under the terms of the GNU Lesser General Public License as published by the 29 * Free Software Foundation. A copy of the license agreement is provided in the 30 * file named "LICENSE.txt" included with this software distribution and also 31 * available online as http://sbml.org/software/libsbml/license.html 32 * ------------------------------------------------------------------------ --> 33 * 34 * @class SedOneStep 35 * @sbmlbrief{sedml} TODO:Definition of the SedOneStep class. 36 */ 37 38 39 #ifndef SedOneStep_H__ 40 #define SedOneStep_H__ 41 42 43 #include <sedml/common/extern.h> 44 #include <sedml/common/sedmlfwd.h> 45 46 47 #ifdef __cplusplus 48 49 50 #include <string> 51 52 53 #include <sedml/SedSimulation.h> 54 #include <sbml/common/libsbml-namespace.h> 55 56 57 LIBSEDML_CPP_NAMESPACE_BEGIN 58 59 60 class LIBSEDML_EXTERN SedOneStep : public SedSimulation 61 { 62 protected: 63 64 /** @cond doxygenLibSEDMLInternal */ 65 66 double mStep; 67 bool mIsSetStep; 68 69 /** @endcond */ 70 71 public: 72 73 /** 74 * Creates a new SedOneStep using the given SED-ML Level and @ p version 75 * values. 76 * 77 * @param level an unsigned int, the SED-ML Level to assign to this 78 * SedOneStep. 79 * 80 * @param version an unsigned int, the SED-ML Version to assign to this 81 * SedOneStep. 82 * 83 * @copydetails doc_note_setting_lv_pkg 84 */ 85 SedOneStep(unsigned int level = SEDML_DEFAULT_LEVEL, 86 unsigned int version = SEDML_DEFAULT_VERSION); 87 88 89 /** 90 * Creates a new SedOneStep using the given SedNamespaces object @p sedmlns. 91 * 92 * @param sedmlns the SedNamespaces object. 93 * 94 * @copydetails doc_note_setting_lv_pkg 95 */ 96 SedOneStep(SedNamespaces *sedmlns); 97 98 99 /** 100 * Copy constructor for SedOneStep. 101 * 102 * @param orig the SedOneStep instance to copy. 103 */ 104 SedOneStep(const SedOneStep& orig); 105 106 107 /** 108 * Assignment operator for SedOneStep. 109 * 110 * @param rhs the SedOneStep object whose values are to be used as the basis 111 * of the assignment. 112 */ 113 SedOneStep& operator=(const SedOneStep& rhs); 114 115 116 /** 117 * Creates and returns a deep copy of this SedOneStep object. 118 * 119 * @return a (deep) copy of this SedOneStep object. 120 */ 121 virtual SedOneStep* clone() const; 122 123 124 /** 125 * Destructor for SedOneStep. 126 */ 127 virtual ~SedOneStep(); 128 129 130 /** 131 * Returns the value of the "step" attribute of this SedOneStep. 132 * 133 * @return the value of the "step" attribute of this SedOneStep as a double. 134 */ 135 double getStep() const; 136 137 138 /** 139 * Predicate returning @c true if this SedOneStep's "step" attribute is set. 140 * 141 * @return @c true if this SedOneStep's "step" attribute has been set, 142 * otherwise @c false is returned. 143 */ 144 bool isSetStep() const; 145 146 147 /** 148 * Sets the value of the "step" attribute of this SedOneStep. 149 * 150 * @param step double value of the "step" attribute to be set. 151 * 152 * @copydetails doc_returns_success_code 153 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 154 * @li @sedmlconstant{LIBSEDML_INVALID_ATTRIBUTE_VALUE, 155 * OperationReturnValues_t} 156 */ 157 int setStep(double step); 158 159 160 /** 161 * Unsets the value of the "step" attribute of this SedOneStep. 162 * 163 * @copydetails doc_returns_success_code 164 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 165 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 166 */ 167 int unsetStep(); 168 169 170 /** 171 * Returns the XML element name of this SedOneStep object. 172 * 173 * For SedOneStep, the XML element name is always @c "oneStep". 174 * 175 * @return the name of this element, i.e. @c "oneStep". 176 */ 177 virtual const std::string& getElementName() const; 178 179 180 /** 181 * Returns the libSEDML type code for this SedOneStep object. 182 * 183 * @copydetails doc_what_are_typecodes 184 * 185 * @return the SED-ML type code for this object: 186 * @sedmlconstant{SEDML_SIMULATION_ONESTEP, SedTypeCode_t}. 187 * 188 * @copydetails doc_warning_typecodes_not_unique 189 * 190 * @see getElementName() 191 */ 192 virtual int getTypeCode() const; 193 194 195 /** 196 * Predicate returning @c true if all the required attributes for this 197 * SedOneStep object have been set. 198 * 199 * @return @c true to indicate that all the required attributes of this 200 * SedOneStep have been set, otherwise @c false is returned. 201 * 202 * 203 * @note The required attributes for the SedOneStep object are: 204 * @li "step" 205 */ 206 virtual bool hasRequiredAttributes() const; 207 208 209 210 /** @cond doxygenLibSEDMLInternal */ 211 212 /** 213 * Write any contained elements 214 */ 215 virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& 216 stream) const; 217 218 /** @endcond */ 219 220 221 222 /** @cond doxygenLibSEDMLInternal */ 223 224 /** 225 * Accepts the given SedVisitor 226 */ 227 virtual bool accept(SedVisitor& v) const; 228 229 /** @endcond */ 230 231 232 233 /** @cond doxygenLibSEDMLInternal */ 234 235 /** 236 * Sets the parent SedDocument 237 */ 238 virtual void setSedDocument(SedDocument* d); 239 240 /** @endcond */ 241 242 243 244 245 #ifndef SWIG 246 247 248 249 /** @cond doxygenLibSEDMLInternal */ 250 251 /** 252 * Gets the value of the "attributeName" attribute of this SedOneStep. 253 * 254 * @param attributeName, the name of the attribute to retrieve. 255 * 256 * @param value, the address of the value to record. 257 * 258 * @copydetails doc_returns_success_code 259 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 260 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 261 */ 262 virtual int getAttribute(const std::string& attributeName, bool& value) 263 const; 264 265 /** @endcond */ 266 267 268 269 /** @cond doxygenLibSEDMLInternal */ 270 271 /** 272 * Gets the value of the "attributeName" attribute of this SedOneStep. 273 * 274 * @param attributeName, the name of the attribute to retrieve. 275 * 276 * @param value, the address of the value to record. 277 * 278 * @copydetails doc_returns_success_code 279 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 280 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 281 */ 282 virtual int getAttribute(const std::string& attributeName, int& value) const; 283 284 /** @endcond */ 285 286 287 288 /** @cond doxygenLibSEDMLInternal */ 289 290 /** 291 * Gets the value of the "attributeName" attribute of this SedOneStep. 292 * 293 * @param attributeName, the name of the attribute to retrieve. 294 * 295 * @param value, the address of the value to record. 296 * 297 * @copydetails doc_returns_success_code 298 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 299 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 300 */ 301 virtual int getAttribute(const std::string& attributeName, 302 double& value) const; 303 304 /** @endcond */ 305 306 307 308 /** @cond doxygenLibSEDMLInternal */ 309 310 /** 311 * Gets the value of the "attributeName" attribute of this SedOneStep. 312 * 313 * @param attributeName, the name of the attribute to retrieve. 314 * 315 * @param value, the address of the value to record. 316 * 317 * @copydetails doc_returns_success_code 318 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 319 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 320 */ 321 virtual int getAttribute(const std::string& attributeName, 322 unsigned int& value) const; 323 324 /** @endcond */ 325 326 327 328 /** @cond doxygenLibSEDMLInternal */ 329 330 /** 331 * Gets the value of the "attributeName" attribute of this SedOneStep. 332 * 333 * @param attributeName, the name of the attribute to retrieve. 334 * 335 * @param value, the address of the value to record. 336 * 337 * @copydetails doc_returns_success_code 338 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 339 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 340 */ 341 virtual int getAttribute(const std::string& attributeName, 342 std::string& value) const; 343 344 /** @endcond */ 345 346 347 348 /** @cond doxygenLibSEDMLInternal */ 349 350 /** 351 * Predicate returning @c true if this SedOneStep's attribute "attributeName" 352 * is set. 353 * 354 * @param attributeName, the name of the attribute to query. 355 * 356 * @return @c true if this SedOneStep's attribute "attributeName" has been 357 * set, otherwise @c false is returned. 358 */ 359 virtual bool isSetAttribute(const std::string& attributeName) const; 360 361 /** @endcond */ 362 363 364 365 /** @cond doxygenLibSEDMLInternal */ 366 367 /** 368 * Sets the value of the "attributeName" attribute of this SedOneStep. 369 * 370 * @param attributeName, the name of the attribute to set. 371 * 372 * @param value, the value of the attribute to set. 373 * 374 * @copydetails doc_returns_success_code 375 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 376 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 377 */ 378 virtual int setAttribute(const std::string& attributeName, bool value); 379 380 /** @endcond */ 381 382 383 384 /** @cond doxygenLibSEDMLInternal */ 385 386 /** 387 * Sets the value of the "attributeName" attribute of this SedOneStep. 388 * 389 * @param attributeName, the name of the attribute to set. 390 * 391 * @param value, the value of the attribute to set. 392 * 393 * @copydetails doc_returns_success_code 394 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 395 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 396 */ 397 virtual int setAttribute(const std::string& attributeName, int value); 398 399 /** @endcond */ 400 401 402 403 /** @cond doxygenLibSEDMLInternal */ 404 405 /** 406 * Sets the value of the "attributeName" attribute of this SedOneStep. 407 * 408 * @param attributeName, the name of the attribute to set. 409 * 410 * @param value, the value of the attribute to set. 411 * 412 * @copydetails doc_returns_success_code 413 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 414 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 415 */ 416 virtual int setAttribute(const std::string& attributeName, double value); 417 418 /** @endcond */ 419 420 421 422 /** @cond doxygenLibSEDMLInternal */ 423 424 /** 425 * Sets the value of the "attributeName" attribute of this SedOneStep. 426 * 427 * @param attributeName, the name of the attribute to set. 428 * 429 * @param value, the value of the attribute to set. 430 * 431 * @copydetails doc_returns_success_code 432 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 433 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 434 */ 435 virtual int setAttribute(const std::string& attributeName, 436 unsigned int value); 437 438 /** @endcond */ 439 440 441 442 /** @cond doxygenLibSEDMLInternal */ 443 444 /** 445 * Sets the value of the "attributeName" attribute of this SedOneStep. 446 * 447 * @param attributeName, the name of the attribute to set. 448 * 449 * @param value, the value of the attribute to set. 450 * 451 * @copydetails doc_returns_success_code 452 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 453 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 454 */ 455 virtual int setAttribute(const std::string& attributeName, 456 const std::string& value); 457 458 /** @endcond */ 459 460 461 462 /** @cond doxygenLibSEDMLInternal */ 463 464 /** 465 * Unsets the value of the "attributeName" attribute of this SedOneStep. 466 * 467 * @param attributeName, the name of the attribute to query. 468 * 469 * @copydetails doc_returns_success_code 470 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 471 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 472 */ 473 virtual int unsetAttribute(const std::string& attributeName); 474 475 /** @endcond */ 476 477 478 479 480 #endif /* !SWIG */ 481 482 483 protected: 484 485 486 /** @cond doxygenLibSEDMLInternal */ 487 488 /** 489 * Creates a new object from the next XMLToken on the XMLInputStream 490 */ 491 virtual SedBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& 492 stream); 493 494 /** @endcond */ 495 496 497 498 /** @cond doxygenLibSEDMLInternal */ 499 500 /** 501 * Adds the expected attributes for this element 502 */ 503 virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER 504 ExpectedAttributes& attributes); 505 506 /** @endcond */ 507 508 509 510 /** @cond doxygenLibSEDMLInternal */ 511 512 /** 513 * Reads the expected attributes into the member data variables 514 */ 515 virtual void readAttributes( 516 const LIBSBML_CPP_NAMESPACE_QUALIFIER 517 XMLAttributes& attributes, 518 const LIBSBML_CPP_NAMESPACE_QUALIFIER 519 ExpectedAttributes& expectedAttributes); 520 521 /** @endcond */ 522 523 524 525 /** @cond doxygenLibSEDMLInternal */ 526 527 /** 528 * Writes the attributes to the stream 529 */ 530 virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& 531 stream) const; 532 533 /** @endcond */ 534 535 536 }; 537 538 539 540 LIBSEDML_CPP_NAMESPACE_END 541 542 543 544 545 #endif /* __cplusplus */ 546 547 548 549 550 #ifndef SWIG 551 552 553 554 555 LIBSEDML_CPP_NAMESPACE_BEGIN 556 557 558 559 560 BEGIN_C_DECLS 561 562 563 /** 564 * Creates a new SedOneStep_t using the given SED-ML Level and @ p version 565 * values. 566 * 567 * @param level an unsigned int, the SED-ML Level to assign to this 568 * SedOneStep_t. 569 * 570 * @param version an unsigned int, the SED-ML Version to assign to this 571 * SedOneStep_t. 572 * 573 * @copydetails doc_note_setting_lv_pkg 574 * 575 * @copydetails doc_returned_owned_pointer 576 * 577 * @memberof SedOneStep_t 578 */ 579 LIBSEDML_EXTERN 580 SedOneStep_t * 581 SedOneStep_create(unsigned int level, unsigned int version); 582 583 584 /** 585 * Creates and returns a deep copy of this SedOneStep_t object. 586 * 587 * @param sos the SedOneStep_t structure. 588 * 589 * @return a (deep) copy of this SedOneStep_t object. 590 * 591 * @copydetails doc_returned_owned_pointer 592 * 593 * @memberof SedOneStep_t 594 */ 595 LIBSEDML_EXTERN 596 SedOneStep_t* 597 SedOneStep_clone(const SedOneStep_t* sos); 598 599 600 /** 601 * Frees this SedOneStep_t object. 602 * 603 * @param sos the SedOneStep_t structure. 604 * 605 * @memberof SedOneStep_t 606 */ 607 LIBSEDML_EXTERN 608 void 609 SedOneStep_free(SedOneStep_t* sos); 610 611 612 /** 613 * Returns the value of the "step" attribute of this SedOneStep_t. 614 * 615 * @param sos the SedOneStep_t structure whose step is sought. 616 * 617 * @return the value of the "step" attribute of this SedOneStep_t as a double. 618 * 619 * @memberof SedOneStep_t 620 */ 621 LIBSEDML_EXTERN 622 double 623 SedOneStep_getStep(const SedOneStep_t * sos); 624 625 626 /** 627 * Predicate returning @c 1 (true) if this SedOneStep_t's "step" attribute is 628 * set. 629 * 630 * @param sos the SedOneStep_t structure. 631 * 632 * @return @c 1 (true) if this SedOneStep_t's "step" attribute has been set, 633 * otherwise @c 0 (false) is returned. 634 * 635 * @memberof SedOneStep_t 636 */ 637 LIBSEDML_EXTERN 638 int 639 SedOneStep_isSetStep(const SedOneStep_t * sos); 640 641 642 /** 643 * Sets the value of the "step" attribute of this SedOneStep_t. 644 * 645 * @param sos the SedOneStep_t structure. 646 * 647 * @param step double value of the "step" attribute to be set. 648 * 649 * @copydetails doc_returns_success_code 650 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 651 * @li @sedmlconstant{LIBSEDML_INVALID_ATTRIBUTE_VALUE, 652 * OperationReturnValues_t} 653 * @li @sedmlconstant{LIBSEDML_INVALID_OBJECT, OperationReturnValues_t} 654 * 655 * @memberof SedOneStep_t 656 */ 657 LIBSEDML_EXTERN 658 int 659 SedOneStep_setStep(SedOneStep_t * sos, double step); 660 661 662 /** 663 * Unsets the value of the "step" attribute of this SedOneStep_t. 664 * 665 * @param sos the SedOneStep_t structure. 666 * 667 * @copydetails doc_returns_success_code 668 * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t} 669 * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t} 670 * @li @sedmlconstant{LIBSEDML_INVALID_OBJECT, OperationReturnValues_t} 671 * 672 * @memberof SedOneStep_t 673 */ 674 LIBSEDML_EXTERN 675 int 676 SedOneStep_unsetStep(SedOneStep_t * sos); 677 678 679 /** 680 * Predicate returning @c 1 (true) if all the required attributes for this 681 * SedOneStep_t object have been set. 682 * 683 * @param sos the SedOneStep_t structure. 684 * 685 * @return @c 1 (true) to indicate that all the required attributes of this 686 * SedOneStep_t have been set, otherwise @c 0 (false) is returned. 687 * 688 * 689 * @note The required attributes for the SedOneStep_t object are: 690 * @li "step" 691 * 692 * @memberof SedOneStep_t 693 */ 694 LIBSEDML_EXTERN 695 int 696 SedOneStep_hasRequiredAttributes(const SedOneStep_t * sos); 697 698 699 700 701 END_C_DECLS 702 703 704 705 706 LIBSEDML_CPP_NAMESPACE_END 707 708 709 710 711 #endif /* !SWIG */ 712 713 714 715 716 #endif /* !SedOneStep_H__ */ 717 718 719