1 /**
2 * @file SedBounds.cpp
3 * @brief Implementation of the SedBounds 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 #include <sedml/SedBounds.h>
35 #include <sbml/xml/XMLInputStream.h>
36
37
38 using namespace std;
39
40
41
42 LIBSEDML_CPP_NAMESPACE_BEGIN
43
44
45
46
47 #ifdef __cplusplus
48
49
50 /*
51 * Creates a new SedBounds using the given SED-ML Level and @ p version values.
52 */
SedBounds(unsigned int level,unsigned int version)53 SedBounds::SedBounds(unsigned int level, unsigned int version)
54 : SedBase(level, version)
55 , mLowerBound (util_NaN())
56 , mIsSetLowerBound (false)
57 , mUpperBound (util_NaN())
58 , mIsSetUpperBound (false)
59 , mScale (SEDML_SCALETYPE_INVALID)
60 {
61 setSedNamespacesAndOwn(new SedNamespaces(level, version));
62 }
63
64
65 /*
66 * Creates a new SedBounds using the given SedNamespaces object @p sedmlns.
67 */
SedBounds(SedNamespaces * sedmlns)68 SedBounds::SedBounds(SedNamespaces *sedmlns)
69 : SedBase(sedmlns)
70 , mLowerBound (util_NaN())
71 , mIsSetLowerBound (false)
72 , mUpperBound (util_NaN())
73 , mIsSetUpperBound (false)
74 , mScale (SEDML_SCALETYPE_INVALID)
75 {
76 setElementNamespace(sedmlns->getURI());
77 }
78
79
80 /*
81 * Copy constructor for SedBounds.
82 */
SedBounds(const SedBounds & orig)83 SedBounds::SedBounds(const SedBounds& orig)
84 : SedBase( orig )
85 , mLowerBound ( orig.mLowerBound )
86 , mIsSetLowerBound ( orig.mIsSetLowerBound )
87 , mUpperBound ( orig.mUpperBound )
88 , mIsSetUpperBound ( orig.mIsSetUpperBound )
89 , mScale ( orig.mScale )
90 {
91 }
92
93
94 /*
95 * Assignment operator for SedBounds.
96 */
97 SedBounds&
operator =(const SedBounds & rhs)98 SedBounds::operator=(const SedBounds& rhs)
99 {
100 if (&rhs != this)
101 {
102 SedBase::operator=(rhs);
103 mLowerBound = rhs.mLowerBound;
104 mIsSetLowerBound = rhs.mIsSetLowerBound;
105 mUpperBound = rhs.mUpperBound;
106 mIsSetUpperBound = rhs.mIsSetUpperBound;
107 mScale = rhs.mScale;
108 }
109
110 return *this;
111 }
112
113
114 /*
115 * Creates and returns a deep copy of this SedBounds object.
116 */
117 SedBounds*
clone() const118 SedBounds::clone() const
119 {
120 return new SedBounds(*this);
121 }
122
123
124 /*
125 * Destructor for SedBounds.
126 */
~SedBounds()127 SedBounds::~SedBounds()
128 {
129 }
130
131
132 /*
133 * Returns the value of the "lowerBound" attribute of this SedBounds.
134 */
135 double
getLowerBound() const136 SedBounds::getLowerBound() const
137 {
138 return mLowerBound;
139 }
140
141
142 /*
143 * Returns the value of the "upperBound" attribute of this SedBounds.
144 */
145 double
getUpperBound() const146 SedBounds::getUpperBound() const
147 {
148 return mUpperBound;
149 }
150
151
152 /*
153 * Returns the value of the "scale" attribute of this SedBounds.
154 */
155 ScaleType_t
getScale() const156 SedBounds::getScale() const
157 {
158 return mScale;
159 }
160
161
162 /*
163 * Returns the value of the "scale" attribute of this SedBounds.
164 */
165 std::string
getScaleAsString() const166 SedBounds::getScaleAsString() const
167 {
168 std::string code_str = ScaleType_toString(mScale);
169 return code_str;
170 }
171
172
173 /*
174 * Predicate returning @c true if this SedBounds's "lowerBound" attribute is
175 * set.
176 */
177 bool
isSetLowerBound() const178 SedBounds::isSetLowerBound() const
179 {
180 return mIsSetLowerBound;
181 }
182
183
184 /*
185 * Predicate returning @c true if this SedBounds's "upperBound" attribute is
186 * set.
187 */
188 bool
isSetUpperBound() const189 SedBounds::isSetUpperBound() const
190 {
191 return mIsSetUpperBound;
192 }
193
194
195 /*
196 * Predicate returning @c true if this SedBounds's "scale" attribute is set.
197 */
198 bool
isSetScale() const199 SedBounds::isSetScale() const
200 {
201 return (mScale != SEDML_SCALETYPE_INVALID);
202 }
203
204
205 /*
206 * Sets the value of the "lowerBound" attribute of this SedBounds.
207 */
208 int
setLowerBound(double lowerBound)209 SedBounds::setLowerBound(double lowerBound)
210 {
211 mLowerBound = lowerBound;
212 mIsSetLowerBound = true;
213 return LIBSEDML_OPERATION_SUCCESS;
214 }
215
216
217 /*
218 * Sets the value of the "upperBound" attribute of this SedBounds.
219 */
220 int
setUpperBound(double upperBound)221 SedBounds::setUpperBound(double upperBound)
222 {
223 mUpperBound = upperBound;
224 mIsSetUpperBound = true;
225 return LIBSEDML_OPERATION_SUCCESS;
226 }
227
228
229 /*
230 * Sets the value of the "scale" attribute of this SedBounds.
231 */
232 int
setScale(const ScaleType_t scale)233 SedBounds::setScale(const ScaleType_t scale)
234 {
235 if (ScaleType_isValid(scale) == 0)
236 {
237 mScale = SEDML_SCALETYPE_INVALID;
238 return LIBSEDML_INVALID_ATTRIBUTE_VALUE;
239 }
240 else
241 {
242 mScale = scale;
243 return LIBSEDML_OPERATION_SUCCESS;
244 }
245 }
246
247
248 /*
249 * Sets the value of the "scale" attribute of this SedBounds.
250 */
251 int
setScale(const std::string & scale)252 SedBounds::setScale(const std::string& scale)
253 {
254 mScale = ScaleType_fromString(scale.c_str());
255
256 if (mScale == SEDML_SCALETYPE_INVALID)
257 {
258 return LIBSEDML_INVALID_ATTRIBUTE_VALUE;
259 }
260
261 return LIBSEDML_OPERATION_SUCCESS;
262 }
263
264
265 /*
266 * Unsets the value of the "lowerBound" attribute of this SedBounds.
267 */
268 int
unsetLowerBound()269 SedBounds::unsetLowerBound()
270 {
271 mLowerBound = util_NaN();
272 mIsSetLowerBound = false;
273
274 if (isSetLowerBound() == false)
275 {
276 return LIBSEDML_OPERATION_SUCCESS;
277 }
278 else
279 {
280 return LIBSEDML_OPERATION_FAILED;
281 }
282 }
283
284
285 /*
286 * Unsets the value of the "upperBound" attribute of this SedBounds.
287 */
288 int
unsetUpperBound()289 SedBounds::unsetUpperBound()
290 {
291 mUpperBound = util_NaN();
292 mIsSetUpperBound = false;
293
294 if (isSetUpperBound() == false)
295 {
296 return LIBSEDML_OPERATION_SUCCESS;
297 }
298 else
299 {
300 return LIBSEDML_OPERATION_FAILED;
301 }
302 }
303
304
305 /*
306 * Unsets the value of the "scale" attribute of this SedBounds.
307 */
308 int
unsetScale()309 SedBounds::unsetScale()
310 {
311 mScale = SEDML_SCALETYPE_INVALID;
312 return LIBSEDML_OPERATION_SUCCESS;
313 }
314
315
316 /*
317 * Returns the XML element name of this SedBounds object.
318 */
319 const std::string&
getElementName() const320 SedBounds::getElementName() const
321 {
322 static const string name = "bounds";
323 return name;
324 }
325
326
327 /*
328 * Returns the libSEDML type code for this SedBounds object.
329 */
330 int
getTypeCode() const331 SedBounds::getTypeCode() const
332 {
333 return SEDML_BOUNDS;
334 }
335
336
337 /*
338 * Predicate returning @c true if all the required attributes for this
339 * SedBounds object have been set.
340 */
341 bool
hasRequiredAttributes() const342 SedBounds::hasRequiredAttributes() const
343 {
344 bool allPresent = true;
345
346 return allPresent;
347 }
348
349
350
351 /** @cond doxygenLibSEDMLInternal */
352
353 /*
354 * Write any contained elements
355 */
356 void
writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream & stream) const357 SedBounds::writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream&
358 stream) const
359 {
360 SedBase::writeElements(stream);
361 }
362
363 /** @endcond */
364
365
366
367 /** @cond doxygenLibSEDMLInternal */
368
369 /*
370 * Accepts the given SedVisitor
371 */
372 bool
accept(SedVisitor & v) const373 SedBounds::accept(SedVisitor& v) const
374 {
375 return false;
376 }
377
378 /** @endcond */
379
380
381
382 /** @cond doxygenLibSEDMLInternal */
383
384 /*
385 * Sets the parent SedDocument
386 */
387 void
setSedDocument(SedDocument * d)388 SedBounds::setSedDocument(SedDocument* d)
389 {
390 SedBase::setSedDocument(d);
391 }
392
393 /** @endcond */
394
395
396
397 /** @cond doxygenLibSEDMLInternal */
398
399 /*
400 * Gets the value of the "attributeName" attribute of this SedBounds.
401 */
402 int
getAttribute(const std::string & attributeName,bool & value) const403 SedBounds::getAttribute(const std::string& attributeName, bool& value) const
404 {
405 int return_value = SedBase::getAttribute(attributeName, value);
406
407 return return_value;
408 }
409
410 /** @endcond */
411
412
413
414 /** @cond doxygenLibSEDMLInternal */
415
416 /*
417 * Gets the value of the "attributeName" attribute of this SedBounds.
418 */
419 int
getAttribute(const std::string & attributeName,int & value) const420 SedBounds::getAttribute(const std::string& attributeName, int& value) const
421 {
422 int return_value = SedBase::getAttribute(attributeName, value);
423
424 return return_value;
425 }
426
427 /** @endcond */
428
429
430
431 /** @cond doxygenLibSEDMLInternal */
432
433 /*
434 * Gets the value of the "attributeName" attribute of this SedBounds.
435 */
436 int
getAttribute(const std::string & attributeName,double & value) const437 SedBounds::getAttribute(const std::string& attributeName, double& value) const
438 {
439 int return_value = SedBase::getAttribute(attributeName, value);
440
441 if (return_value == LIBSEDML_OPERATION_SUCCESS)
442 {
443 return return_value;
444 }
445
446 if (attributeName == "lowerBound")
447 {
448 value = getLowerBound();
449 return_value = LIBSEDML_OPERATION_SUCCESS;
450 }
451 else if (attributeName == "upperBound")
452 {
453 value = getUpperBound();
454 return_value = LIBSEDML_OPERATION_SUCCESS;
455 }
456
457 return return_value;
458 }
459
460 /** @endcond */
461
462
463
464 /** @cond doxygenLibSEDMLInternal */
465
466 /*
467 * Gets the value of the "attributeName" attribute of this SedBounds.
468 */
469 int
getAttribute(const std::string & attributeName,unsigned int & value) const470 SedBounds::getAttribute(const std::string& attributeName,
471 unsigned int& value) const
472 {
473 int return_value = SedBase::getAttribute(attributeName, value);
474
475 return return_value;
476 }
477
478 /** @endcond */
479
480
481
482 /** @cond doxygenLibSEDMLInternal */
483
484 /*
485 * Gets the value of the "attributeName" attribute of this SedBounds.
486 */
487 int
getAttribute(const std::string & attributeName,std::string & value) const488 SedBounds::getAttribute(const std::string& attributeName,
489 std::string& value) const
490 {
491 int return_value = SedBase::getAttribute(attributeName, value);
492
493 if (return_value == LIBSEDML_OPERATION_SUCCESS)
494 {
495 return return_value;
496 }
497
498 if (attributeName == "scale")
499 {
500 value = getScaleAsString();
501 return_value = LIBSEDML_OPERATION_SUCCESS;
502 }
503
504 return return_value;
505 }
506
507 /** @endcond */
508
509
510
511 /** @cond doxygenLibSEDMLInternal */
512
513 /*
514 * Predicate returning @c true if this SedBounds's attribute "attributeName" is
515 * set.
516 */
517 bool
isSetAttribute(const std::string & attributeName) const518 SedBounds::isSetAttribute(const std::string& attributeName) const
519 {
520 bool value = SedBase::isSetAttribute(attributeName);
521
522 if (attributeName == "lowerBound")
523 {
524 value = isSetLowerBound();
525 }
526 else if (attributeName == "upperBound")
527 {
528 value = isSetUpperBound();
529 }
530 else if (attributeName == "scale")
531 {
532 value = isSetScale();
533 }
534
535 return value;
536 }
537
538 /** @endcond */
539
540
541
542 /** @cond doxygenLibSEDMLInternal */
543
544 /*
545 * Sets the value of the "attributeName" attribute of this SedBounds.
546 */
547 int
setAttribute(const std::string & attributeName,bool value)548 SedBounds::setAttribute(const std::string& attributeName, bool value)
549 {
550 int return_value = SedBase::setAttribute(attributeName, value);
551
552 return return_value;
553 }
554
555 /** @endcond */
556
557
558
559 /** @cond doxygenLibSEDMLInternal */
560
561 /*
562 * Sets the value of the "attributeName" attribute of this SedBounds.
563 */
564 int
setAttribute(const std::string & attributeName,int value)565 SedBounds::setAttribute(const std::string& attributeName, int value)
566 {
567 int return_value = SedBase::setAttribute(attributeName, value);
568
569 return return_value;
570 }
571
572 /** @endcond */
573
574
575
576 /** @cond doxygenLibSEDMLInternal */
577
578 /*
579 * Sets the value of the "attributeName" attribute of this SedBounds.
580 */
581 int
setAttribute(const std::string & attributeName,double value)582 SedBounds::setAttribute(const std::string& attributeName, double value)
583 {
584 int return_value = SedBase::setAttribute(attributeName, value);
585
586 if (attributeName == "lowerBound")
587 {
588 return_value = setLowerBound(value);
589 }
590 else if (attributeName == "upperBound")
591 {
592 return_value = setUpperBound(value);
593 }
594
595 return return_value;
596 }
597
598 /** @endcond */
599
600
601
602 /** @cond doxygenLibSEDMLInternal */
603
604 /*
605 * Sets the value of the "attributeName" attribute of this SedBounds.
606 */
607 int
setAttribute(const std::string & attributeName,unsigned int value)608 SedBounds::setAttribute(const std::string& attributeName, unsigned int value)
609 {
610 int return_value = SedBase::setAttribute(attributeName, value);
611
612 return return_value;
613 }
614
615 /** @endcond */
616
617
618
619 /** @cond doxygenLibSEDMLInternal */
620
621 /*
622 * Sets the value of the "attributeName" attribute of this SedBounds.
623 */
624 int
setAttribute(const std::string & attributeName,const std::string & value)625 SedBounds::setAttribute(const std::string& attributeName,
626 const std::string& value)
627 {
628 int return_value = SedBase::setAttribute(attributeName, value);
629
630 if (attributeName == "scale")
631 {
632 return_value = setScale(value);
633 }
634
635 return return_value;
636 }
637
638 /** @endcond */
639
640
641
642 /** @cond doxygenLibSEDMLInternal */
643
644 /*
645 * Unsets the value of the "attributeName" attribute of this SedBounds.
646 */
647 int
unsetAttribute(const std::string & attributeName)648 SedBounds::unsetAttribute(const std::string& attributeName)
649 {
650 int value = SedBase::unsetAttribute(attributeName);
651
652 if (attributeName == "lowerBound")
653 {
654 value = unsetLowerBound();
655 }
656 else if (attributeName == "upperBound")
657 {
658 value = unsetUpperBound();
659 }
660 else if (attributeName == "scale")
661 {
662 value = unsetScale();
663 }
664
665 return value;
666 }
667
668 /** @endcond */
669
670
671
672 /** @cond doxygenLibSEDMLInternal */
673
674 /*
675 * Adds the expected attributes for this element
676 */
677 void
addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes & attributes)678 SedBounds::addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER
679 ExpectedAttributes& attributes)
680 {
681 SedBase::addExpectedAttributes(attributes);
682
683 attributes.add("lowerBound");
684
685 attributes.add("upperBound");
686
687 attributes.add("scale");
688 }
689
690 /** @endcond */
691
692
693
694 /** @cond doxygenLibSEDMLInternal */
695
696 /*
697 * Reads the expected attributes into the member data variables
698 */
699 void
readAttributes(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes & attributes,const LIBSBML_CPP_NAMESPACE_QUALIFIER ExpectedAttributes & expectedAttributes)700 SedBounds::readAttributes(
701 const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes&
702 attributes,
703 const LIBSBML_CPP_NAMESPACE_QUALIFIER
704 ExpectedAttributes& expectedAttributes)
705 {
706 unsigned int level = getLevel();
707 unsigned int version = getVersion();
708 unsigned int numErrs;
709 bool assigned = false;
710 SedErrorLog* log = getErrorLog();
711
712 SedBase::readAttributes(attributes, expectedAttributes);
713
714 if (log)
715 {
716 numErrs = log->getNumErrors();
717
718 for (int n = numErrs-1; n >= 0; n--)
719 {
720 if (log->getError(n)->getErrorId() == SedUnknownCoreAttribute)
721 {
722 const std::string details = log->getError(n)->getMessage();
723 log->remove(SedUnknownCoreAttribute);
724 log->logError(SedmlBoundsAllowedAttributes, level, version, details,
725 getLine(), getColumn());
726 }
727 }
728 }
729
730 //
731 // lowerBound double (use = "optional" )
732 //
733
734 numErrs = log ? log->getNumErrors() : 0;
735 mIsSetLowerBound = attributes.readInto("lowerBound", mLowerBound);
736
737 if ( mIsSetLowerBound == false && log)
738 {
739 if (log && log->getNumErrors() == numErrs + 1 &&
740 log->contains(XMLAttributeTypeMismatch))
741 {
742 log->remove(XMLAttributeTypeMismatch);
743 std::string message = "Sedml attribute 'lowerBound' from the <SedBounds> "
744 "element must be an integer.";
745 log->logError(SedmlBoundsLowerBoundMustBeDouble, level, version, message,
746 getLine(), getColumn());
747 }
748 }
749
750 //
751 // upperBound double (use = "optional" )
752 //
753
754 numErrs = log ? log->getNumErrors() : 0;
755 mIsSetUpperBound = attributes.readInto("upperBound", mUpperBound);
756
757 if ( mIsSetUpperBound == false && log)
758 {
759 if (log && log->getNumErrors() == numErrs + 1 &&
760 log->contains(XMLAttributeTypeMismatch))
761 {
762 log->remove(XMLAttributeTypeMismatch);
763 std::string message = "Sedml attribute 'upperBound' from the <SedBounds> "
764 "element must be an integer.";
765 log->logError(SedmlBoundsUpperBoundMustBeDouble, level, version, message,
766 getLine(), getColumn());
767 }
768 }
769
770 //
771 // scale enum (use = "optional" )
772 //
773
774 std::string scale;
775 assigned = attributes.readInto("scale", scale);
776
777 if (assigned == true)
778 {
779 if (scale.empty() == true)
780 {
781 logEmptyString(scale, level, version, "<SedBounds>");
782 }
783 else
784 {
785 mScale = ScaleType_fromString(scale.c_str());
786
787 if (log && ScaleType_isValid(mScale) == 0)
788 {
789 std::string msg = "The scale on the <SedBounds> ";
790
791 if (isSetId())
792 {
793 msg += "with id '" + getId() + "'";
794 }
795
796 msg += "is '" + scale + "', which is not a valid option.";
797
798 log->logError(SedmlBoundsScaleMustBeScaleTypeEnum, level, version, msg,
799 getLine(), getColumn());
800 }
801 }
802 }
803 }
804
805 /** @endcond */
806
807
808
809 /** @cond doxygenLibSEDMLInternal */
810
811 /*
812 * Writes the attributes to the stream
813 */
814 void
writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream & stream) const815 SedBounds::writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream&
816 stream) const
817 {
818 SedBase::writeAttributes(stream);
819
820 if (isSetLowerBound() == true)
821 {
822 stream.writeAttribute("lowerBound", getPrefix(), mLowerBound);
823 }
824
825 if (isSetUpperBound() == true)
826 {
827 stream.writeAttribute("upperBound", getPrefix(), mUpperBound);
828 }
829
830 if (isSetScale() == true)
831 {
832 stream.writeAttribute("scale", getPrefix(), ScaleType_toString(mScale));
833 }
834 }
835
836 /** @endcond */
837
838
839
840
841 #endif /* __cplusplus */
842
843
844 /*
845 * Creates a new SedBounds_t using the given SED-ML Level and @ p version
846 * values.
847 */
848 LIBSEDML_EXTERN
849 SedBounds_t *
SedBounds_create(unsigned int level,unsigned int version)850 SedBounds_create(unsigned int level, unsigned int version)
851 {
852 return new SedBounds(level, version);
853 }
854
855
856 /*
857 * Creates and returns a deep copy of this SedBounds_t object.
858 */
859 LIBSEDML_EXTERN
860 SedBounds_t*
SedBounds_clone(const SedBounds_t * sb)861 SedBounds_clone(const SedBounds_t* sb)
862 {
863 if (sb != NULL)
864 {
865 return static_cast<SedBounds_t*>(sb->clone());
866 }
867 else
868 {
869 return NULL;
870 }
871 }
872
873
874 /*
875 * Frees this SedBounds_t object.
876 */
877 LIBSEDML_EXTERN
878 void
SedBounds_free(SedBounds_t * sb)879 SedBounds_free(SedBounds_t* sb)
880 {
881 if (sb != NULL)
882 {
883 delete sb;
884 }
885 }
886
887
888 /*
889 * Returns the value of the "lowerBound" attribute of this SedBounds_t.
890 */
891 LIBSEDML_EXTERN
892 double
SedBounds_getLowerBound(const SedBounds_t * sb)893 SedBounds_getLowerBound(const SedBounds_t * sb)
894 {
895 return (sb != NULL) ? sb->getLowerBound() : util_NaN();
896 }
897
898
899 /*
900 * Returns the value of the "upperBound" attribute of this SedBounds_t.
901 */
902 LIBSEDML_EXTERN
903 double
SedBounds_getUpperBound(const SedBounds_t * sb)904 SedBounds_getUpperBound(const SedBounds_t * sb)
905 {
906 return (sb != NULL) ? sb->getUpperBound() : util_NaN();
907 }
908
909
910 /*
911 * Returns the value of the "scale" attribute of this SedBounds_t.
912 */
913 LIBSEDML_EXTERN
914 ScaleType_t
SedBounds_getScale(const SedBounds_t * sb)915 SedBounds_getScale(const SedBounds_t * sb)
916 {
917 if (sb == NULL)
918 {
919 return SEDML_SCALETYPE_INVALID;
920 }
921
922 return sb->getScale();
923 }
924
925
926 /*
927 * Returns the value of the "scale" attribute of this SedBounds_t.
928 */
929 LIBSEDML_EXTERN
930 char *
SedBounds_getScaleAsString(const SedBounds_t * sb)931 SedBounds_getScaleAsString(const SedBounds_t * sb)
932 {
933 return (char*)(ScaleType_toString(sb->getScale()));
934 }
935
936
937 /*
938 * Predicate returning @c 1 (true) if this SedBounds_t's "lowerBound" attribute
939 * is set.
940 */
941 LIBSEDML_EXTERN
942 int
SedBounds_isSetLowerBound(const SedBounds_t * sb)943 SedBounds_isSetLowerBound(const SedBounds_t * sb)
944 {
945 return (sb != NULL) ? static_cast<int>(sb->isSetLowerBound()) : 0;
946 }
947
948
949 /*
950 * Predicate returning @c 1 (true) if this SedBounds_t's "upperBound" attribute
951 * is set.
952 */
953 LIBSEDML_EXTERN
954 int
SedBounds_isSetUpperBound(const SedBounds_t * sb)955 SedBounds_isSetUpperBound(const SedBounds_t * sb)
956 {
957 return (sb != NULL) ? static_cast<int>(sb->isSetUpperBound()) : 0;
958 }
959
960
961 /*
962 * Predicate returning @c 1 (true) if this SedBounds_t's "scale" attribute is
963 * set.
964 */
965 LIBSEDML_EXTERN
966 int
SedBounds_isSetScale(const SedBounds_t * sb)967 SedBounds_isSetScale(const SedBounds_t * sb)
968 {
969 return (sb != NULL) ? static_cast<int>(sb->isSetScale()) : 0;
970 }
971
972
973 /*
974 * Sets the value of the "lowerBound" attribute of this SedBounds_t.
975 */
976 LIBSEDML_EXTERN
977 int
SedBounds_setLowerBound(SedBounds_t * sb,double lowerBound)978 SedBounds_setLowerBound(SedBounds_t * sb, double lowerBound)
979 {
980 return (sb != NULL) ? sb->setLowerBound(lowerBound) :
981 LIBSEDML_INVALID_OBJECT;
982 }
983
984
985 /*
986 * Sets the value of the "upperBound" attribute of this SedBounds_t.
987 */
988 LIBSEDML_EXTERN
989 int
SedBounds_setUpperBound(SedBounds_t * sb,double upperBound)990 SedBounds_setUpperBound(SedBounds_t * sb, double upperBound)
991 {
992 return (sb != NULL) ? sb->setUpperBound(upperBound) :
993 LIBSEDML_INVALID_OBJECT;
994 }
995
996
997 /*
998 * Sets the value of the "scale" attribute of this SedBounds_t.
999 */
1000 LIBSEDML_EXTERN
1001 int
SedBounds_setScale(SedBounds_t * sb,ScaleType_t scale)1002 SedBounds_setScale(SedBounds_t * sb, ScaleType_t scale)
1003 {
1004 return (sb != NULL) ? sb->setScale(scale) : LIBSEDML_INVALID_OBJECT;
1005 }
1006
1007
1008 /*
1009 * Sets the value of the "scale" attribute of this SedBounds_t.
1010 */
1011 LIBSEDML_EXTERN
1012 int
SedBounds_setScaleAsString(SedBounds_t * sb,const char * scale)1013 SedBounds_setScaleAsString(SedBounds_t * sb, const char * scale)
1014 {
1015 return (sb != NULL) ? sb->setScale(scale): LIBSEDML_INVALID_OBJECT;
1016 }
1017
1018
1019 /*
1020 * Unsets the value of the "lowerBound" attribute of this SedBounds_t.
1021 */
1022 LIBSEDML_EXTERN
1023 int
SedBounds_unsetLowerBound(SedBounds_t * sb)1024 SedBounds_unsetLowerBound(SedBounds_t * sb)
1025 {
1026 return (sb != NULL) ? sb->unsetLowerBound() : LIBSEDML_INVALID_OBJECT;
1027 }
1028
1029
1030 /*
1031 * Unsets the value of the "upperBound" attribute of this SedBounds_t.
1032 */
1033 LIBSEDML_EXTERN
1034 int
SedBounds_unsetUpperBound(SedBounds_t * sb)1035 SedBounds_unsetUpperBound(SedBounds_t * sb)
1036 {
1037 return (sb != NULL) ? sb->unsetUpperBound() : LIBSEDML_INVALID_OBJECT;
1038 }
1039
1040
1041 /*
1042 * Unsets the value of the "scale" attribute of this SedBounds_t.
1043 */
1044 LIBSEDML_EXTERN
1045 int
SedBounds_unsetScale(SedBounds_t * sb)1046 SedBounds_unsetScale(SedBounds_t * sb)
1047 {
1048 return (sb != NULL) ? sb->unsetScale() : LIBSEDML_INVALID_OBJECT;
1049 }
1050
1051
1052 /*
1053 * Predicate returning @c 1 (true) if all the required attributes for this
1054 * SedBounds_t object have been set.
1055 */
1056 LIBSEDML_EXTERN
1057 int
SedBounds_hasRequiredAttributes(const SedBounds_t * sb)1058 SedBounds_hasRequiredAttributes(const SedBounds_t * sb)
1059 {
1060 return (sb != NULL) ? static_cast<int>(sb->hasRequiredAttributes()) : 0;
1061 }
1062
1063
1064
1065
1066 LIBSEDML_CPP_NAMESPACE_END
1067
1068
1069