1 /**
2  * @file CSGScale.cpp
3  * @brief Implementation of the CSGScale class.
4  * @author SBMLTeam
5  *
6  * <!--------------------------------------------------------------------------
7  * This file is part of libSBML. Please visit http://sbml.org for more
8  * information about SBML, and the latest version of libSBML.
9  *
10  * Copyright (C) 2020 jointly by the following organizations:
11  *     1. California Institute of Technology, Pasadena, CA, USA
12  *     2. University of Heidelberg, Heidelberg, Germany
13  *     3. University College London, London, UK
14  *
15  * Copyright (C) 2019 jointly by the following organizations:
16  * 1. California Institute of Technology, Pasadena, CA, USA
17  * 2. University of Heidelberg, Heidelberg, Germany
18  *
19  * Copyright (C) 2013-2018 jointly by the following organizations:
20  * 1. California Institute of Technology, Pasadena, CA, USA
21  * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
22  * 3. University of Heidelberg, Heidelberg, Germany
23  *
24  * Copyright (C) 2009-2013 jointly by the following organizations:
25  * 1. California Institute of Technology, Pasadena, CA, USA
26  * 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
27  *
28  * Copyright (C) 2006-2008 by the California Institute of Technology,
29  * Pasadena, CA, USA
30  *
31  * Copyright (C) 2002-2005 jointly by the following organizations:
32  * 1. California Institute of Technology, Pasadena, CA, USA
33  * 2. Japan Science and Technology Agency, Japan
34  *
35  * This library is free software; you can redistribute it and/or modify it
36  * under the terms of the GNU Lesser General Public License as published by the
37  * Free Software Foundation. A copy of the license agreement is provided in the
38  * file named "LICENSE.txt" included with this software distribution and also
39  * available online as http://sbml.org/software/libsbml/license.html
40  * ------------------------------------------------------------------------ -->
41  */
42 #include <sbml/packages/spatial/sbml/CSGScale.h>
43 #include <sbml/packages/spatial/validator/SpatialSBMLError.h>
44 
45 
46 using namespace std;
47 
48 
49 
50 LIBSBML_CPP_NAMESPACE_BEGIN
51 
52 
53 
54 
55 #ifdef __cplusplus
56 
57 
58 /*
59  * Creates a new CSGScale using the given SBML Level, Version and
60  * &ldquo;spatial&rdquo; package version.
61  */
CSGScale(unsigned int level,unsigned int version,unsigned int pkgVersion)62 CSGScale::CSGScale(unsigned int level,
63                    unsigned int version,
64                    unsigned int pkgVersion)
65   : CSGTransformation(level, version, pkgVersion)
66   , mScaleX (util_NaN())
67   , mIsSetScaleX (false)
68   , mScaleY (util_NaN())
69   , mIsSetScaleY (false)
70   , mScaleZ (util_NaN())
71   , mIsSetScaleZ (false)
72 {
73   setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version,
74     pkgVersion));
75 }
76 
77 
78 /*
79  * Creates a new CSGScale using the given SpatialPkgNamespaces object.
80  */
CSGScale(SpatialPkgNamespaces * spatialns)81 CSGScale::CSGScale(SpatialPkgNamespaces *spatialns)
82   : CSGTransformation(spatialns)
83   , mScaleX (util_NaN())
84   , mIsSetScaleX (false)
85   , mScaleY (util_NaN())
86   , mIsSetScaleY (false)
87   , mScaleZ (util_NaN())
88   , mIsSetScaleZ (false)
89 {
90   setElementNamespace(spatialns->getURI());
91   loadPlugins(spatialns);
92 }
93 
94 
95 /*
96  * Copy constructor for CSGScale.
97  */
CSGScale(const CSGScale & orig)98 CSGScale::CSGScale(const CSGScale& orig)
99   : CSGTransformation( orig )
100   , mScaleX ( orig.mScaleX )
101   , mIsSetScaleX ( orig.mIsSetScaleX )
102   , mScaleY ( orig.mScaleY )
103   , mIsSetScaleY ( orig.mIsSetScaleY )
104   , mScaleZ ( orig.mScaleZ )
105   , mIsSetScaleZ ( orig.mIsSetScaleZ )
106 {
107 }
108 
109 
110 /*
111  * Assignment operator for CSGScale.
112  */
113 CSGScale&
operator =(const CSGScale & rhs)114 CSGScale::operator=(const CSGScale& rhs)
115 {
116   if (&rhs != this)
117   {
118     CSGTransformation::operator=(rhs);
119     mScaleX = rhs.mScaleX;
120     mIsSetScaleX = rhs.mIsSetScaleX;
121     mScaleY = rhs.mScaleY;
122     mIsSetScaleY = rhs.mIsSetScaleY;
123     mScaleZ = rhs.mScaleZ;
124     mIsSetScaleZ = rhs.mIsSetScaleZ;
125   }
126 
127   return *this;
128 }
129 
130 
131 /*
132  * Creates and returns a deep copy of this CSGScale object.
133  */
134 CSGScale*
clone() const135 CSGScale::clone() const
136 {
137   return new CSGScale(*this);
138 }
139 
140 
141 /*
142  * Destructor for CSGScale.
143  */
~CSGScale()144 CSGScale::~CSGScale()
145 {
146 }
147 
148 
149 /*
150  * Returns the value of the "scaleX" attribute of this CSGScale.
151  */
152 double
getScaleX() const153 CSGScale::getScaleX() const
154 {
155   return mScaleX;
156 }
157 
158 
159 /*
160  * Returns the value of the "scaleY" attribute of this CSGScale.
161  */
162 double
getScaleY() const163 CSGScale::getScaleY() const
164 {
165   return mScaleY;
166 }
167 
168 
169 /*
170  * Returns the value of the "scaleZ" attribute of this CSGScale.
171  */
172 double
getScaleZ() const173 CSGScale::getScaleZ() const
174 {
175   return mScaleZ;
176 }
177 
178 
179 /*
180  * Predicate returning @c true if this CSGScale's "scaleX" attribute is set.
181  */
182 bool
isSetScaleX() const183 CSGScale::isSetScaleX() const
184 {
185   return mIsSetScaleX;
186 }
187 
188 
189 /*
190  * Predicate returning @c true if this CSGScale's "scaleY" attribute is set.
191  */
192 bool
isSetScaleY() const193 CSGScale::isSetScaleY() const
194 {
195   return mIsSetScaleY;
196 }
197 
198 
199 /*
200  * Predicate returning @c true if this CSGScale's "scaleZ" attribute is set.
201  */
202 bool
isSetScaleZ() const203 CSGScale::isSetScaleZ() const
204 {
205   return mIsSetScaleZ;
206 }
207 
208 
209 /*
210  * Sets the value of the "scaleX" attribute of this CSGScale.
211  */
212 int
setScaleX(double scaleX)213 CSGScale::setScaleX(double scaleX)
214 {
215   mScaleX = scaleX;
216   mIsSetScaleX = true;
217   return LIBSBML_OPERATION_SUCCESS;
218 }
219 
220 
221 /*
222  * Sets the value of the "scaleY" attribute of this CSGScale.
223  */
224 int
setScaleY(double scaleY)225 CSGScale::setScaleY(double scaleY)
226 {
227   mScaleY = scaleY;
228   mIsSetScaleY = true;
229   return LIBSBML_OPERATION_SUCCESS;
230 }
231 
232 
233 /*
234  * Sets the value of the "scaleZ" attribute of this CSGScale.
235  */
236 int
setScaleZ(double scaleZ)237 CSGScale::setScaleZ(double scaleZ)
238 {
239   mScaleZ = scaleZ;
240   mIsSetScaleZ = true;
241   return LIBSBML_OPERATION_SUCCESS;
242 }
243 
244 
245 /*
246  * Unsets the value of the "scaleX" attribute of this CSGScale.
247  */
248 int
unsetScaleX()249 CSGScale::unsetScaleX()
250 {
251   mScaleX = util_NaN();
252   mIsSetScaleX = false;
253 
254   if (isSetScaleX() == false)
255   {
256     return LIBSBML_OPERATION_SUCCESS;
257   }
258   else
259   {
260     return LIBSBML_OPERATION_FAILED;
261   }
262 }
263 
264 
265 /*
266  * Unsets the value of the "scaleY" attribute of this CSGScale.
267  */
268 int
unsetScaleY()269 CSGScale::unsetScaleY()
270 {
271   mScaleY = util_NaN();
272   mIsSetScaleY = false;
273 
274   if (isSetScaleY() == false)
275   {
276     return LIBSBML_OPERATION_SUCCESS;
277   }
278   else
279   {
280     return LIBSBML_OPERATION_FAILED;
281   }
282 }
283 
284 
285 /*
286  * Unsets the value of the "scaleZ" attribute of this CSGScale.
287  */
288 int
unsetScaleZ()289 CSGScale::unsetScaleZ()
290 {
291   mScaleZ = util_NaN();
292   mIsSetScaleZ = false;
293 
294   if (isSetScaleZ() == false)
295   {
296     return LIBSBML_OPERATION_SUCCESS;
297   }
298   else
299   {
300     return LIBSBML_OPERATION_FAILED;
301   }
302 }
303 
304 
305 /*
306  * Returns the XML element name of this CSGScale object.
307  */
308 const std::string&
getElementName() const309 CSGScale::getElementName() const
310 {
311   static const string name = "csgScale";
312   return name;
313 }
314 
315 
316 /*
317  * Returns the libSBML type code for this CSGScale object.
318  */
319 int
getTypeCode() const320 CSGScale::getTypeCode() const
321 {
322   return SBML_SPATIAL_CSGSCALE;
323 }
324 
325 
326 /*
327  * Predicate returning @c true if all the required attributes for this CSGScale
328  * object have been set.
329  */
330 bool
hasRequiredAttributes() const331 CSGScale::hasRequiredAttributes() const
332 {
333   bool allPresent = CSGTransformation::hasRequiredAttributes();
334 
335   if (isSetScaleX() == false)
336   {
337     allPresent = false;
338   }
339 
340   return allPresent;
341 }
342 
343 
344 
345 /** @cond doxygenLibsbmlInternal */
346 
347 /*
348  * Write any contained elements
349  */
350 void
writeElements(XMLOutputStream & stream) const351 CSGScale::writeElements(XMLOutputStream& stream) const
352 {
353   CSGTransformation::writeElements(stream);
354 
355   SBase::writeExtensionElements(stream);
356 }
357 
358 /** @endcond */
359 
360 
361 
362 /** @cond doxygenLibsbmlInternal */
363 
364 /*
365  * Accepts the given SBMLVisitor
366  */
367 bool
accept(SBMLVisitor & v) const368 CSGScale::accept(SBMLVisitor& v) const
369 {
370   return v.visit(*this);
371 }
372 
373 /** @endcond */
374 
375 
376 
377 /** @cond doxygenLibsbmlInternal */
378 
379 /*
380  * Sets the parent SBMLDocument
381  */
382 void
setSBMLDocument(SBMLDocument * d)383 CSGScale::setSBMLDocument(SBMLDocument* d)
384 {
385   CSGTransformation::setSBMLDocument(d);
386 }
387 
388 /** @endcond */
389 
390 
391 
392 /** @cond doxygenLibsbmlInternal */
393 
394 /*
395  * Enables/disables the given package with this element
396  */
397 void
enablePackageInternal(const std::string & pkgURI,const std::string & pkgPrefix,bool flag)398 CSGScale::enablePackageInternal(const std::string& pkgURI,
399                                 const std::string& pkgPrefix,
400                                 bool flag)
401 {
402   CSGTransformation::enablePackageInternal(pkgURI, pkgPrefix, flag);
403 }
404 
405 /** @endcond */
406 
407 
408 
409 /** @cond doxygenLibsbmlInternal */
410 
411 /*
412  * Gets the value of the "attributeName" attribute of this CSGScale.
413  */
414 int
getAttribute(const std::string & attributeName,bool & value) const415 CSGScale::getAttribute(const std::string& attributeName, bool& value) const
416 {
417   int return_value = CSGTransformation::getAttribute(attributeName, value);
418 
419   return return_value;
420 }
421 
422 /** @endcond */
423 
424 
425 
426 /** @cond doxygenLibsbmlInternal */
427 
428 /*
429  * Gets the value of the "attributeName" attribute of this CSGScale.
430  */
431 int
getAttribute(const std::string & attributeName,int & value) const432 CSGScale::getAttribute(const std::string& attributeName, int& value) const
433 {
434   int return_value = CSGTransformation::getAttribute(attributeName, value);
435 
436   return return_value;
437 }
438 
439 /** @endcond */
440 
441 
442 
443 /** @cond doxygenLibsbmlInternal */
444 
445 /*
446  * Gets the value of the "attributeName" attribute of this CSGScale.
447  */
448 int
getAttribute(const std::string & attributeName,double & value) const449 CSGScale::getAttribute(const std::string& attributeName, double& value) const
450 {
451   int return_value = CSGTransformation::getAttribute(attributeName, value);
452 
453   if (return_value == LIBSBML_OPERATION_SUCCESS)
454   {
455     return return_value;
456   }
457 
458   if (attributeName == "scaleX")
459   {
460     value = getScaleX();
461     return_value = LIBSBML_OPERATION_SUCCESS;
462   }
463   else if (attributeName == "scaleY")
464   {
465     value = getScaleY();
466     return_value = LIBSBML_OPERATION_SUCCESS;
467   }
468   else if (attributeName == "scaleZ")
469   {
470     value = getScaleZ();
471     return_value = LIBSBML_OPERATION_SUCCESS;
472   }
473 
474   return return_value;
475 }
476 
477 /** @endcond */
478 
479 
480 
481 /** @cond doxygenLibsbmlInternal */
482 
483 /*
484  * Gets the value of the "attributeName" attribute of this CSGScale.
485  */
486 int
getAttribute(const std::string & attributeName,unsigned int & value) const487 CSGScale::getAttribute(const std::string& attributeName,
488                        unsigned int& value) const
489 {
490   int return_value = CSGTransformation::getAttribute(attributeName, value);
491 
492   return return_value;
493 }
494 
495 /** @endcond */
496 
497 
498 
499 /** @cond doxygenLibsbmlInternal */
500 
501 /*
502  * Gets the value of the "attributeName" attribute of this CSGScale.
503  */
504 int
getAttribute(const std::string & attributeName,std::string & value) const505 CSGScale::getAttribute(const std::string& attributeName,
506                        std::string& value) const
507 {
508   int return_value = CSGTransformation::getAttribute(attributeName, value);
509 
510   return return_value;
511 }
512 
513 /** @endcond */
514 
515 
516 
517 /** @cond doxygenLibsbmlInternal */
518 
519 /*
520  * Predicate returning @c true if this CSGScale's attribute "attributeName" is
521  * set.
522  */
523 bool
isSetAttribute(const std::string & attributeName) const524 CSGScale::isSetAttribute(const std::string& attributeName) const
525 {
526   bool value = CSGTransformation::isSetAttribute(attributeName);
527 
528   if (attributeName == "scaleX")
529   {
530     value = isSetScaleX();
531   }
532   else if (attributeName == "scaleY")
533   {
534     value = isSetScaleY();
535   }
536   else if (attributeName == "scaleZ")
537   {
538     value = isSetScaleZ();
539   }
540 
541   return value;
542 }
543 
544 /** @endcond */
545 
546 
547 
548 /** @cond doxygenLibsbmlInternal */
549 
550 /*
551  * Sets the value of the "attributeName" attribute of this CSGScale.
552  */
553 int
setAttribute(const std::string & attributeName,bool value)554 CSGScale::setAttribute(const std::string& attributeName, bool value)
555 {
556   int return_value = CSGTransformation::setAttribute(attributeName, value);
557 
558   return return_value;
559 }
560 
561 /** @endcond */
562 
563 
564 
565 /** @cond doxygenLibsbmlInternal */
566 
567 /*
568  * Sets the value of the "attributeName" attribute of this CSGScale.
569  */
570 int
setAttribute(const std::string & attributeName,int value)571 CSGScale::setAttribute(const std::string& attributeName, int value)
572 {
573   int return_value = CSGTransformation::setAttribute(attributeName, value);
574 
575   return return_value;
576 }
577 
578 /** @endcond */
579 
580 
581 
582 /** @cond doxygenLibsbmlInternal */
583 
584 /*
585  * Sets the value of the "attributeName" attribute of this CSGScale.
586  */
587 int
setAttribute(const std::string & attributeName,double value)588 CSGScale::setAttribute(const std::string& attributeName, double value)
589 {
590   int return_value = CSGTransformation::setAttribute(attributeName, value);
591 
592   if (attributeName == "scaleX")
593   {
594     return_value = setScaleX(value);
595   }
596   else if (attributeName == "scaleY")
597   {
598     return_value = setScaleY(value);
599   }
600   else if (attributeName == "scaleZ")
601   {
602     return_value = setScaleZ(value);
603   }
604 
605   return return_value;
606 }
607 
608 /** @endcond */
609 
610 
611 
612 /** @cond doxygenLibsbmlInternal */
613 
614 /*
615  * Sets the value of the "attributeName" attribute of this CSGScale.
616  */
617 int
setAttribute(const std::string & attributeName,unsigned int value)618 CSGScale::setAttribute(const std::string& attributeName, unsigned int value)
619 {
620   int return_value = CSGTransformation::setAttribute(attributeName, value);
621 
622   return return_value;
623 }
624 
625 /** @endcond */
626 
627 
628 
629 /** @cond doxygenLibsbmlInternal */
630 
631 /*
632  * Sets the value of the "attributeName" attribute of this CSGScale.
633  */
634 int
setAttribute(const std::string & attributeName,const std::string & value)635 CSGScale::setAttribute(const std::string& attributeName,
636                        const std::string& value)
637 {
638   int return_value = CSGTransformation::setAttribute(attributeName, value);
639 
640   return return_value;
641 }
642 
643 /** @endcond */
644 
645 
646 
647 /** @cond doxygenLibsbmlInternal */
648 
649 /*
650  * Unsets the value of the "attributeName" attribute of this CSGScale.
651  */
652 int
unsetAttribute(const std::string & attributeName)653 CSGScale::unsetAttribute(const std::string& attributeName)
654 {
655   int value = CSGTransformation::unsetAttribute(attributeName);
656 
657   if (attributeName == "scaleX")
658   {
659     value = unsetScaleX();
660   }
661   else if (attributeName == "scaleY")
662   {
663     value = unsetScaleY();
664   }
665   else if (attributeName == "scaleZ")
666   {
667     value = unsetScaleZ();
668   }
669 
670   return value;
671 }
672 
673 /** @endcond */
674 
675 
676 
677 /** @cond doxygenLibsbmlInternal */
678 
679 /*
680  * Creates a new object from the next XMLToken on the XMLInputStream
681  */
682 SBase*
createObject(XMLInputStream & stream)683 CSGScale::createObject(XMLInputStream& stream)
684 {
685   SBase* obj = CSGTransformation::createObject(stream);
686 
687   connectToChild();
688 
689   return obj;
690 }
691 
692 /** @endcond */
693 
694 
695 
696 /** @cond doxygenLibsbmlInternal */
697 
698 /*
699  * Adds the expected attributes for this element
700  */
701 void
addExpectedAttributes(ExpectedAttributes & attributes)702 CSGScale::addExpectedAttributes(ExpectedAttributes& attributes)
703 {
704   CSGTransformation::addExpectedAttributes(attributes);
705 
706   attributes.add("scaleX");
707 
708   attributes.add("scaleY");
709 
710   attributes.add("scaleZ");
711 }
712 
713 /** @endcond */
714 
715 
716 
717 /** @cond doxygenLibsbmlInternal */
718 
719 /*
720  * Reads the expected attributes into the member data variables
721  */
722 void
readAttributes(const XMLAttributes & attributes,const ExpectedAttributes & expectedAttributes)723 CSGScale::readAttributes(const XMLAttributes& attributes,
724                          const ExpectedAttributes& expectedAttributes)
725 {
726   unsigned int level = getLevel();
727   unsigned int version = getVersion();
728   unsigned int pkgVersion = getPackageVersion();
729   unsigned int numErrs;
730   bool assigned = false;
731   SBMLErrorLog* log = getErrorLog();
732 
733   CSGTransformation::readAttributes(attributes, expectedAttributes);
734 
735   if (log)
736   {
737     numErrs = log->getNumErrors();
738 
739     for (int n = numErrs-1; n >= 0; n--)
740     {
741       if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
742       {
743         const std::string details = log->getError(n)->getMessage();
744         log->remove(UnknownPackageAttribute);
745         log->logPackageError("spatial", SpatialCSGScaleAllowedAttributes,
746           pkgVersion, level, version, details, getLine(), getColumn());
747       }
748       else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
749       {
750         const std::string details = log->getError(n)->getMessage();
751         log->remove(UnknownCoreAttribute);
752         log->logPackageError("spatial", SpatialCSGScaleAllowedCoreAttributes,
753           pkgVersion, level, version, details, getLine(), getColumn());
754       }
755     }
756   }
757 
758   //
759   // scaleX double (use = "required" )
760   //
761 
762   numErrs = log->getNumErrors();
763   mIsSetScaleX = attributes.readInto("scaleX", mScaleX);
764 
765   if ( mIsSetScaleX == false)
766   {
767     if (log->getNumErrors() == numErrs + 1 &&
768       log->contains(XMLAttributeTypeMismatch))
769     {
770       log->remove(XMLAttributeTypeMismatch);
771       std::string message = "Spatial attribute 'scaleX' from the <csgScale> "
772         "element must be an integer.";
773       log->logPackageError("spatial", SpatialCSGScaleScaleXMustBeDouble,
774         pkgVersion, level, version, message, getLine(), getColumn());
775     }
776     else
777     {
778       std::string message = "Spatial attribute 'scaleX' is missing from the "
779         "<csgScale> element.";
780       log->logPackageError("spatial", SpatialCSGScaleAllowedAttributes,
781         pkgVersion, level, version, message, getLine(), getColumn());
782     }
783   }
784 
785   //
786   // scaleY double (use = "optional" )
787   //
788 
789   numErrs = log->getNumErrors();
790   mIsSetScaleY = attributes.readInto("scaleY", mScaleY);
791 
792   if ( mIsSetScaleY == false)
793   {
794     if (log->getNumErrors() == numErrs + 1 &&
795       log->contains(XMLAttributeTypeMismatch))
796     {
797       log->remove(XMLAttributeTypeMismatch);
798       std::string message = "Spatial attribute 'scaleY' from the <csgScale> "
799         "element must be an integer.";
800       log->logPackageError("spatial", SpatialCSGScaleScaleYMustBeDouble,
801         pkgVersion, level, version, message, getLine(), getColumn());
802     }
803   }
804 
805   //
806   // scaleZ double (use = "optional" )
807   //
808 
809   numErrs = log->getNumErrors();
810   mIsSetScaleZ = attributes.readInto("scaleZ", mScaleZ);
811 
812   if ( mIsSetScaleZ == false)
813   {
814     if (log->getNumErrors() == numErrs + 1 &&
815       log->contains(XMLAttributeTypeMismatch))
816     {
817       log->remove(XMLAttributeTypeMismatch);
818       std::string message = "Spatial attribute 'scaleZ' from the <csgScale> "
819         "element must be an integer.";
820       log->logPackageError("spatial", SpatialCSGScaleScaleZMustBeDouble,
821         pkgVersion, level, version, message, getLine(), getColumn());
822     }
823   }
824 }
825 
826 /** @endcond */
827 
828 
829 
830 /** @cond doxygenLibsbmlInternal */
831 
832 /*
833  * Writes the attributes to the stream
834  */
835 void
writeAttributes(XMLOutputStream & stream) const836 CSGScale::writeAttributes(XMLOutputStream& stream) const
837 {
838   CSGTransformation::writeAttributes(stream);
839 
840   if (isSetScaleX() == true)
841   {
842     stream.writeAttribute("scaleX", getPrefix(), mScaleX);
843   }
844 
845   if (isSetScaleY() == true)
846   {
847     stream.writeAttribute("scaleY", getPrefix(), mScaleY);
848   }
849 
850   if (isSetScaleZ() == true)
851   {
852     stream.writeAttribute("scaleZ", getPrefix(), mScaleZ);
853   }
854 
855   SBase::writeExtensionAttributes(stream);
856 }
857 
858 /** @endcond */
859 
860 
861 
862 
863 #endif /* __cplusplus */
864 
865 
866 /*
867  * Creates a new CSGScale_t using the given SBML Level, Version and
868  * &ldquo;spatial&rdquo; package version.
869  */
870 LIBSBML_EXTERN
871 CSGScale_t *
CSGScale_create(unsigned int level,unsigned int version,unsigned int pkgVersion)872 CSGScale_create(unsigned int level,
873                 unsigned int version,
874                 unsigned int pkgVersion)
875 {
876   return new CSGScale(level, version, pkgVersion);
877 }
878 
879 
880 /*
881  * Creates and returns a deep copy of this CSGScale_t object.
882  */
883 LIBSBML_EXTERN
884 CSGScale_t*
CSGScale_clone(const CSGScale_t * csgs)885 CSGScale_clone(const CSGScale_t* csgs)
886 {
887   if (csgs != NULL)
888   {
889     return static_cast<CSGScale_t*>(csgs->clone());
890   }
891   else
892   {
893     return NULL;
894   }
895 }
896 
897 
898 /*
899  * Frees this CSGScale_t object.
900  */
901 LIBSBML_EXTERN
902 void
CSGScale_free(CSGScale_t * csgs)903 CSGScale_free(CSGScale_t* csgs)
904 {
905   if (csgs != NULL)
906   {
907     delete csgs;
908   }
909 }
910 
911 
912 /*
913  * Returns the value of the "scaleX" attribute of this CSGScale_t.
914  */
915 LIBSBML_EXTERN
916 double
CSGScale_getScaleX(const CSGScale_t * csgs)917 CSGScale_getScaleX(const CSGScale_t * csgs)
918 {
919   return (csgs != NULL) ? csgs->getScaleX() : util_NaN();
920 }
921 
922 
923 /*
924  * Returns the value of the "scaleY" attribute of this CSGScale_t.
925  */
926 LIBSBML_EXTERN
927 double
CSGScale_getScaleY(const CSGScale_t * csgs)928 CSGScale_getScaleY(const CSGScale_t * csgs)
929 {
930   return (csgs != NULL) ? csgs->getScaleY() : util_NaN();
931 }
932 
933 
934 /*
935  * Returns the value of the "scaleZ" attribute of this CSGScale_t.
936  */
937 LIBSBML_EXTERN
938 double
CSGScale_getScaleZ(const CSGScale_t * csgs)939 CSGScale_getScaleZ(const CSGScale_t * csgs)
940 {
941   return (csgs != NULL) ? csgs->getScaleZ() : util_NaN();
942 }
943 
944 
945 /*
946  * Predicate returning @c 1 (true) if this CSGScale_t's "scaleX" attribute is
947  * set.
948  */
949 LIBSBML_EXTERN
950 int
CSGScale_isSetScaleX(const CSGScale_t * csgs)951 CSGScale_isSetScaleX(const CSGScale_t * csgs)
952 {
953   return (csgs != NULL) ? static_cast<int>(csgs->isSetScaleX()) : 0;
954 }
955 
956 
957 /*
958  * Predicate returning @c 1 (true) if this CSGScale_t's "scaleY" attribute is
959  * set.
960  */
961 LIBSBML_EXTERN
962 int
CSGScale_isSetScaleY(const CSGScale_t * csgs)963 CSGScale_isSetScaleY(const CSGScale_t * csgs)
964 {
965   return (csgs != NULL) ? static_cast<int>(csgs->isSetScaleY()) : 0;
966 }
967 
968 
969 /*
970  * Predicate returning @c 1 (true) if this CSGScale_t's "scaleZ" attribute is
971  * set.
972  */
973 LIBSBML_EXTERN
974 int
CSGScale_isSetScaleZ(const CSGScale_t * csgs)975 CSGScale_isSetScaleZ(const CSGScale_t * csgs)
976 {
977   return (csgs != NULL) ? static_cast<int>(csgs->isSetScaleZ()) : 0;
978 }
979 
980 
981 /*
982  * Sets the value of the "scaleX" attribute of this CSGScale_t.
983  */
984 LIBSBML_EXTERN
985 int
CSGScale_setScaleX(CSGScale_t * csgs,double scaleX)986 CSGScale_setScaleX(CSGScale_t * csgs, double scaleX)
987 {
988   return (csgs != NULL) ? csgs->setScaleX(scaleX) : LIBSBML_INVALID_OBJECT;
989 }
990 
991 
992 /*
993  * Sets the value of the "scaleY" attribute of this CSGScale_t.
994  */
995 LIBSBML_EXTERN
996 int
CSGScale_setScaleY(CSGScale_t * csgs,double scaleY)997 CSGScale_setScaleY(CSGScale_t * csgs, double scaleY)
998 {
999   return (csgs != NULL) ? csgs->setScaleY(scaleY) : LIBSBML_INVALID_OBJECT;
1000 }
1001 
1002 
1003 /*
1004  * Sets the value of the "scaleZ" attribute of this CSGScale_t.
1005  */
1006 LIBSBML_EXTERN
1007 int
CSGScale_setScaleZ(CSGScale_t * csgs,double scaleZ)1008 CSGScale_setScaleZ(CSGScale_t * csgs, double scaleZ)
1009 {
1010   return (csgs != NULL) ? csgs->setScaleZ(scaleZ) : LIBSBML_INVALID_OBJECT;
1011 }
1012 
1013 
1014 /*
1015  * Unsets the value of the "scaleX" attribute of this CSGScale_t.
1016  */
1017 LIBSBML_EXTERN
1018 int
CSGScale_unsetScaleX(CSGScale_t * csgs)1019 CSGScale_unsetScaleX(CSGScale_t * csgs)
1020 {
1021   return (csgs != NULL) ? csgs->unsetScaleX() : LIBSBML_INVALID_OBJECT;
1022 }
1023 
1024 
1025 /*
1026  * Unsets the value of the "scaleY" attribute of this CSGScale_t.
1027  */
1028 LIBSBML_EXTERN
1029 int
CSGScale_unsetScaleY(CSGScale_t * csgs)1030 CSGScale_unsetScaleY(CSGScale_t * csgs)
1031 {
1032   return (csgs != NULL) ? csgs->unsetScaleY() : LIBSBML_INVALID_OBJECT;
1033 }
1034 
1035 
1036 /*
1037  * Unsets the value of the "scaleZ" attribute of this CSGScale_t.
1038  */
1039 LIBSBML_EXTERN
1040 int
CSGScale_unsetScaleZ(CSGScale_t * csgs)1041 CSGScale_unsetScaleZ(CSGScale_t * csgs)
1042 {
1043   return (csgs != NULL) ? csgs->unsetScaleZ() : LIBSBML_INVALID_OBJECT;
1044 }
1045 
1046 
1047 /*
1048  * Predicate returning @c 1 (true) if all the required attributes for this
1049  * CSGScale_t object have been set.
1050  */
1051 LIBSBML_EXTERN
1052 int
CSGScale_hasRequiredAttributes(const CSGScale_t * csgs)1053 CSGScale_hasRequiredAttributes(const CSGScale_t * csgs)
1054 {
1055   return (csgs != NULL) ? static_cast<int>(csgs->hasRequiredAttributes()) : 0;
1056 }
1057 
1058 
1059 
1060 
1061 LIBSBML_CPP_NAMESPACE_END
1062 
1063 
1064