1 /**
2 * @file CSGTranslation.cpp
3 * @brief Implementation of the CSGTranslation 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/CSGTranslation.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 CSGTranslation using the given SBML Level, Version and
60 * “spatial” package version.
61 */
CSGTranslation(unsigned int level,unsigned int version,unsigned int pkgVersion)62 CSGTranslation::CSGTranslation(unsigned int level,
63 unsigned int version,
64 unsigned int pkgVersion)
65 : CSGTransformation(level, version, pkgVersion)
66 , mTranslateX (util_NaN())
67 , mIsSetTranslateX (false)
68 , mTranslateY (util_NaN())
69 , mIsSetTranslateY (false)
70 , mTranslateZ (util_NaN())
71 , mIsSetTranslateZ (false)
72 {
73 setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version,
74 pkgVersion));
75 }
76
77
78 /*
79 * Creates a new CSGTranslation using the given SpatialPkgNamespaces object.
80 */
CSGTranslation(SpatialPkgNamespaces * spatialns)81 CSGTranslation::CSGTranslation(SpatialPkgNamespaces *spatialns)
82 : CSGTransformation(spatialns)
83 , mTranslateX (util_NaN())
84 , mIsSetTranslateX (false)
85 , mTranslateY (util_NaN())
86 , mIsSetTranslateY (false)
87 , mTranslateZ (util_NaN())
88 , mIsSetTranslateZ (false)
89 {
90 setElementNamespace(spatialns->getURI());
91 loadPlugins(spatialns);
92 }
93
94
95 /*
96 * Copy constructor for CSGTranslation.
97 */
CSGTranslation(const CSGTranslation & orig)98 CSGTranslation::CSGTranslation(const CSGTranslation& orig)
99 : CSGTransformation( orig )
100 , mTranslateX ( orig.mTranslateX )
101 , mIsSetTranslateX ( orig.mIsSetTranslateX )
102 , mTranslateY ( orig.mTranslateY )
103 , mIsSetTranslateY ( orig.mIsSetTranslateY )
104 , mTranslateZ ( orig.mTranslateZ )
105 , mIsSetTranslateZ ( orig.mIsSetTranslateZ )
106 {
107 }
108
109
110 /*
111 * Assignment operator for CSGTranslation.
112 */
113 CSGTranslation&
operator =(const CSGTranslation & rhs)114 CSGTranslation::operator=(const CSGTranslation& rhs)
115 {
116 if (&rhs != this)
117 {
118 CSGTransformation::operator=(rhs);
119 mTranslateX = rhs.mTranslateX;
120 mIsSetTranslateX = rhs.mIsSetTranslateX;
121 mTranslateY = rhs.mTranslateY;
122 mIsSetTranslateY = rhs.mIsSetTranslateY;
123 mTranslateZ = rhs.mTranslateZ;
124 mIsSetTranslateZ = rhs.mIsSetTranslateZ;
125 }
126
127 return *this;
128 }
129
130
131 /*
132 * Creates and returns a deep copy of this CSGTranslation object.
133 */
134 CSGTranslation*
clone() const135 CSGTranslation::clone() const
136 {
137 return new CSGTranslation(*this);
138 }
139
140
141 /*
142 * Destructor for CSGTranslation.
143 */
~CSGTranslation()144 CSGTranslation::~CSGTranslation()
145 {
146 }
147
148
149 /*
150 * Returns the value of the "translateX" attribute of this CSGTranslation.
151 */
152 double
getTranslateX() const153 CSGTranslation::getTranslateX() const
154 {
155 return mTranslateX;
156 }
157
158
159 /*
160 * Returns the value of the "translateY" attribute of this CSGTranslation.
161 */
162 double
getTranslateY() const163 CSGTranslation::getTranslateY() const
164 {
165 return mTranslateY;
166 }
167
168
169 /*
170 * Returns the value of the "translateZ" attribute of this CSGTranslation.
171 */
172 double
getTranslateZ() const173 CSGTranslation::getTranslateZ() const
174 {
175 return mTranslateZ;
176 }
177
178
179 /*
180 * Predicate returning @c true if this CSGTranslation's "translateX" attribute
181 * is set.
182 */
183 bool
isSetTranslateX() const184 CSGTranslation::isSetTranslateX() const
185 {
186 return mIsSetTranslateX;
187 }
188
189
190 /*
191 * Predicate returning @c true if this CSGTranslation's "translateY" attribute
192 * is set.
193 */
194 bool
isSetTranslateY() const195 CSGTranslation::isSetTranslateY() const
196 {
197 return mIsSetTranslateY;
198 }
199
200
201 /*
202 * Predicate returning @c true if this CSGTranslation's "translateZ" attribute
203 * is set.
204 */
205 bool
isSetTranslateZ() const206 CSGTranslation::isSetTranslateZ() const
207 {
208 return mIsSetTranslateZ;
209 }
210
211
212 /*
213 * Sets the value of the "translateX" attribute of this CSGTranslation.
214 */
215 int
setTranslateX(double translateX)216 CSGTranslation::setTranslateX(double translateX)
217 {
218 mTranslateX = translateX;
219 mIsSetTranslateX = true;
220 return LIBSBML_OPERATION_SUCCESS;
221 }
222
223
224 /*
225 * Sets the value of the "translateY" attribute of this CSGTranslation.
226 */
227 int
setTranslateY(double translateY)228 CSGTranslation::setTranslateY(double translateY)
229 {
230 mTranslateY = translateY;
231 mIsSetTranslateY = true;
232 return LIBSBML_OPERATION_SUCCESS;
233 }
234
235
236 /*
237 * Sets the value of the "translateZ" attribute of this CSGTranslation.
238 */
239 int
setTranslateZ(double translateZ)240 CSGTranslation::setTranslateZ(double translateZ)
241 {
242 mTranslateZ = translateZ;
243 mIsSetTranslateZ = true;
244 return LIBSBML_OPERATION_SUCCESS;
245 }
246
247
248 /*
249 * Unsets the value of the "translateX" attribute of this CSGTranslation.
250 */
251 int
unsetTranslateX()252 CSGTranslation::unsetTranslateX()
253 {
254 mTranslateX = util_NaN();
255 mIsSetTranslateX = false;
256
257 if (isSetTranslateX() == false)
258 {
259 return LIBSBML_OPERATION_SUCCESS;
260 }
261 else
262 {
263 return LIBSBML_OPERATION_FAILED;
264 }
265 }
266
267
268 /*
269 * Unsets the value of the "translateY" attribute of this CSGTranslation.
270 */
271 int
unsetTranslateY()272 CSGTranslation::unsetTranslateY()
273 {
274 mTranslateY = util_NaN();
275 mIsSetTranslateY = false;
276
277 if (isSetTranslateY() == false)
278 {
279 return LIBSBML_OPERATION_SUCCESS;
280 }
281 else
282 {
283 return LIBSBML_OPERATION_FAILED;
284 }
285 }
286
287
288 /*
289 * Unsets the value of the "translateZ" attribute of this CSGTranslation.
290 */
291 int
unsetTranslateZ()292 CSGTranslation::unsetTranslateZ()
293 {
294 mTranslateZ = util_NaN();
295 mIsSetTranslateZ = false;
296
297 if (isSetTranslateZ() == false)
298 {
299 return LIBSBML_OPERATION_SUCCESS;
300 }
301 else
302 {
303 return LIBSBML_OPERATION_FAILED;
304 }
305 }
306
307
308 /*
309 * Returns the XML element name of this CSGTranslation object.
310 */
311 const std::string&
getElementName() const312 CSGTranslation::getElementName() const
313 {
314 static const string name = "csgTranslation";
315 return name;
316 }
317
318
319 /*
320 * Returns the libSBML type code for this CSGTranslation object.
321 */
322 int
getTypeCode() const323 CSGTranslation::getTypeCode() const
324 {
325 return SBML_SPATIAL_CSGTRANSLATION;
326 }
327
328
329 /*
330 * Predicate returning @c true if all the required attributes for this
331 * CSGTranslation object have been set.
332 */
333 bool
hasRequiredAttributes() const334 CSGTranslation::hasRequiredAttributes() const
335 {
336 bool allPresent = CSGTransformation::hasRequiredAttributes();
337
338 if (isSetTranslateX() == false)
339 {
340 allPresent = false;
341 }
342
343 return allPresent;
344 }
345
346
347
348 /** @cond doxygenLibsbmlInternal */
349
350 /*
351 * Write any contained elements
352 */
353 void
writeElements(XMLOutputStream & stream) const354 CSGTranslation::writeElements(XMLOutputStream& stream) const
355 {
356 CSGTransformation::writeElements(stream);
357
358 SBase::writeExtensionElements(stream);
359 }
360
361 /** @endcond */
362
363
364
365 /** @cond doxygenLibsbmlInternal */
366
367 /*
368 * Accepts the given SBMLVisitor
369 */
370 bool
accept(SBMLVisitor & v) const371 CSGTranslation::accept(SBMLVisitor& v) const
372 {
373 return v.visit(*this);
374 }
375
376 /** @endcond */
377
378
379
380 /** @cond doxygenLibsbmlInternal */
381
382 /*
383 * Sets the parent SBMLDocument
384 */
385 void
setSBMLDocument(SBMLDocument * d)386 CSGTranslation::setSBMLDocument(SBMLDocument* d)
387 {
388 CSGTransformation::setSBMLDocument(d);
389 }
390
391 /** @endcond */
392
393
394
395 /** @cond doxygenLibsbmlInternal */
396
397 /*
398 * Enables/disables the given package with this element
399 */
400 void
enablePackageInternal(const std::string & pkgURI,const std::string & pkgPrefix,bool flag)401 CSGTranslation::enablePackageInternal(const std::string& pkgURI,
402 const std::string& pkgPrefix,
403 bool flag)
404 {
405 CSGTransformation::enablePackageInternal(pkgURI, pkgPrefix, flag);
406 }
407
408 /** @endcond */
409
410
411
412 /** @cond doxygenLibsbmlInternal */
413
414 /*
415 * Gets the value of the "attributeName" attribute of this CSGTranslation.
416 */
417 int
getAttribute(const std::string & attributeName,bool & value) const418 CSGTranslation::getAttribute(const std::string& attributeName,
419 bool& value) const
420 {
421 int return_value = CSGTransformation::getAttribute(attributeName, value);
422
423 return return_value;
424 }
425
426 /** @endcond */
427
428
429
430 /** @cond doxygenLibsbmlInternal */
431
432 /*
433 * Gets the value of the "attributeName" attribute of this CSGTranslation.
434 */
435 int
getAttribute(const std::string & attributeName,int & value) const436 CSGTranslation::getAttribute(const std::string& attributeName,
437 int& value) const
438 {
439 int return_value = CSGTransformation::getAttribute(attributeName, value);
440
441 return return_value;
442 }
443
444 /** @endcond */
445
446
447
448 /** @cond doxygenLibsbmlInternal */
449
450 /*
451 * Gets the value of the "attributeName" attribute of this CSGTranslation.
452 */
453 int
getAttribute(const std::string & attributeName,double & value) const454 CSGTranslation::getAttribute(const std::string& attributeName,
455 double& value) const
456 {
457 int return_value = CSGTransformation::getAttribute(attributeName, value);
458
459 if (return_value == LIBSBML_OPERATION_SUCCESS)
460 {
461 return return_value;
462 }
463
464 if (attributeName == "translateX")
465 {
466 value = getTranslateX();
467 return_value = LIBSBML_OPERATION_SUCCESS;
468 }
469 else if (attributeName == "translateY")
470 {
471 value = getTranslateY();
472 return_value = LIBSBML_OPERATION_SUCCESS;
473 }
474 else if (attributeName == "translateZ")
475 {
476 value = getTranslateZ();
477 return_value = LIBSBML_OPERATION_SUCCESS;
478 }
479
480 return return_value;
481 }
482
483 /** @endcond */
484
485
486
487 /** @cond doxygenLibsbmlInternal */
488
489 /*
490 * Gets the value of the "attributeName" attribute of this CSGTranslation.
491 */
492 int
getAttribute(const std::string & attributeName,unsigned int & value) const493 CSGTranslation::getAttribute(const std::string& attributeName,
494 unsigned int& value) const
495 {
496 int return_value = CSGTransformation::getAttribute(attributeName, value);
497
498 return return_value;
499 }
500
501 /** @endcond */
502
503
504
505 /** @cond doxygenLibsbmlInternal */
506
507 /*
508 * Gets the value of the "attributeName" attribute of this CSGTranslation.
509 */
510 int
getAttribute(const std::string & attributeName,std::string & value) const511 CSGTranslation::getAttribute(const std::string& attributeName,
512 std::string& value) const
513 {
514 int return_value = CSGTransformation::getAttribute(attributeName, value);
515
516 return return_value;
517 }
518
519 /** @endcond */
520
521
522
523 /** @cond doxygenLibsbmlInternal */
524
525 /*
526 * Predicate returning @c true if this CSGTranslation's attribute
527 * "attributeName" is set.
528 */
529 bool
isSetAttribute(const std::string & attributeName) const530 CSGTranslation::isSetAttribute(const std::string& attributeName) const
531 {
532 bool value = CSGTransformation::isSetAttribute(attributeName);
533
534 if (attributeName == "translateX")
535 {
536 value = isSetTranslateX();
537 }
538 else if (attributeName == "translateY")
539 {
540 value = isSetTranslateY();
541 }
542 else if (attributeName == "translateZ")
543 {
544 value = isSetTranslateZ();
545 }
546
547 return value;
548 }
549
550 /** @endcond */
551
552
553
554 /** @cond doxygenLibsbmlInternal */
555
556 /*
557 * Sets the value of the "attributeName" attribute of this CSGTranslation.
558 */
559 int
setAttribute(const std::string & attributeName,bool value)560 CSGTranslation::setAttribute(const std::string& attributeName, bool value)
561 {
562 int return_value = CSGTransformation::setAttribute(attributeName, value);
563
564 return return_value;
565 }
566
567 /** @endcond */
568
569
570
571 /** @cond doxygenLibsbmlInternal */
572
573 /*
574 * Sets the value of the "attributeName" attribute of this CSGTranslation.
575 */
576 int
setAttribute(const std::string & attributeName,int value)577 CSGTranslation::setAttribute(const std::string& attributeName, int value)
578 {
579 int return_value = CSGTransformation::setAttribute(attributeName, value);
580
581 return return_value;
582 }
583
584 /** @endcond */
585
586
587
588 /** @cond doxygenLibsbmlInternal */
589
590 /*
591 * Sets the value of the "attributeName" attribute of this CSGTranslation.
592 */
593 int
setAttribute(const std::string & attributeName,double value)594 CSGTranslation::setAttribute(const std::string& attributeName, double value)
595 {
596 int return_value = CSGTransformation::setAttribute(attributeName, value);
597
598 if (attributeName == "translateX")
599 {
600 return_value = setTranslateX(value);
601 }
602 else if (attributeName == "translateY")
603 {
604 return_value = setTranslateY(value);
605 }
606 else if (attributeName == "translateZ")
607 {
608 return_value = setTranslateZ(value);
609 }
610
611 return return_value;
612 }
613
614 /** @endcond */
615
616
617
618 /** @cond doxygenLibsbmlInternal */
619
620 /*
621 * Sets the value of the "attributeName" attribute of this CSGTranslation.
622 */
623 int
setAttribute(const std::string & attributeName,unsigned int value)624 CSGTranslation::setAttribute(const std::string& attributeName,
625 unsigned int value)
626 {
627 int return_value = CSGTransformation::setAttribute(attributeName, value);
628
629 return return_value;
630 }
631
632 /** @endcond */
633
634
635
636 /** @cond doxygenLibsbmlInternal */
637
638 /*
639 * Sets the value of the "attributeName" attribute of this CSGTranslation.
640 */
641 int
setAttribute(const std::string & attributeName,const std::string & value)642 CSGTranslation::setAttribute(const std::string& attributeName,
643 const std::string& value)
644 {
645 int return_value = CSGTransformation::setAttribute(attributeName, value);
646
647 return return_value;
648 }
649
650 /** @endcond */
651
652
653
654 /** @cond doxygenLibsbmlInternal */
655
656 /*
657 * Unsets the value of the "attributeName" attribute of this CSGTranslation.
658 */
659 int
unsetAttribute(const std::string & attributeName)660 CSGTranslation::unsetAttribute(const std::string& attributeName)
661 {
662 int value = CSGTransformation::unsetAttribute(attributeName);
663
664 if (attributeName == "translateX")
665 {
666 value = unsetTranslateX();
667 }
668 else if (attributeName == "translateY")
669 {
670 value = unsetTranslateY();
671 }
672 else if (attributeName == "translateZ")
673 {
674 value = unsetTranslateZ();
675 }
676
677 return value;
678 }
679
680 /** @endcond */
681
682
683
684 /** @cond doxygenLibsbmlInternal */
685
686 /*
687 * Creates a new object from the next XMLToken on the XMLInputStream
688 */
689 SBase*
createObject(XMLInputStream & stream)690 CSGTranslation::createObject(XMLInputStream& stream)
691 {
692 SBase* obj = CSGTransformation::createObject(stream);
693
694 connectToChild();
695
696 return obj;
697 }
698
699 /** @endcond */
700
701
702
703 /** @cond doxygenLibsbmlInternal */
704
705 /*
706 * Adds the expected attributes for this element
707 */
708 void
addExpectedAttributes(ExpectedAttributes & attributes)709 CSGTranslation::addExpectedAttributes(ExpectedAttributes& attributes)
710 {
711 CSGTransformation::addExpectedAttributes(attributes);
712
713 attributes.add("translateX");
714
715 attributes.add("translateY");
716
717 attributes.add("translateZ");
718 }
719
720 /** @endcond */
721
722
723
724 /** @cond doxygenLibsbmlInternal */
725
726 /*
727 * Reads the expected attributes into the member data variables
728 */
729 void
readAttributes(const XMLAttributes & attributes,const ExpectedAttributes & expectedAttributes)730 CSGTranslation::readAttributes(const XMLAttributes& attributes,
731 const ExpectedAttributes& expectedAttributes)
732 {
733 unsigned int level = getLevel();
734 unsigned int version = getVersion();
735 unsigned int pkgVersion = getPackageVersion();
736 unsigned int numErrs;
737 bool assigned = false;
738 SBMLErrorLog* log = getErrorLog();
739
740 CSGTransformation::readAttributes(attributes, expectedAttributes);
741
742 if (log)
743 {
744 numErrs = log->getNumErrors();
745
746 for (int n = numErrs-1; n >= 0; n--)
747 {
748 if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
749 {
750 const std::string details = log->getError(n)->getMessage();
751 log->remove(UnknownPackageAttribute);
752 log->logPackageError("spatial", SpatialCSGTranslationAllowedAttributes,
753 pkgVersion, level, version, details, getLine(), getColumn());
754 }
755 else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
756 {
757 const std::string details = log->getError(n)->getMessage();
758 log->remove(UnknownCoreAttribute);
759 log->logPackageError("spatial",
760 SpatialCSGTranslationAllowedCoreAttributes, pkgVersion, level, version,
761 details, getLine(), getColumn());
762 }
763 }
764 }
765
766 //
767 // translateX double (use = "required" )
768 //
769
770 numErrs = log->getNumErrors();
771 mIsSetTranslateX = attributes.readInto("translateX", mTranslateX);
772
773 if ( mIsSetTranslateX == false)
774 {
775 if (log->getNumErrors() == numErrs + 1 &&
776 log->contains(XMLAttributeTypeMismatch))
777 {
778 log->remove(XMLAttributeTypeMismatch);
779 std::string message = "Spatial attribute 'translateX' from the "
780 "<csgTranslation> element must be an integer.";
781 log->logPackageError("spatial",
782 SpatialCSGTranslationTranslateXMustBeDouble, pkgVersion, level, version,
783 message, getLine(), getColumn());
784 }
785 else
786 {
787 std::string message = "Spatial attribute 'translateX' is missing from the "
788 "<csgTranslation> element.";
789 log->logPackageError("spatial", SpatialCSGTranslationAllowedAttributes,
790 pkgVersion, level, version, message, getLine(), getColumn());
791 }
792 }
793
794 //
795 // translateY double (use = "optional" )
796 //
797
798 numErrs = log->getNumErrors();
799 mIsSetTranslateY = attributes.readInto("translateY", mTranslateY);
800
801 if ( mIsSetTranslateY == false)
802 {
803 if (log->getNumErrors() == numErrs + 1 &&
804 log->contains(XMLAttributeTypeMismatch))
805 {
806 log->remove(XMLAttributeTypeMismatch);
807 std::string message = "Spatial attribute 'translateY' from the "
808 "<csgTranslation> element must be an integer.";
809 log->logPackageError("spatial",
810 SpatialCSGTranslationTranslateYMustBeDouble, pkgVersion, level, version,
811 message, getLine(), getColumn());
812 }
813 }
814
815 //
816 // translateZ double (use = "optional" )
817 //
818
819 numErrs = log->getNumErrors();
820 mIsSetTranslateZ = attributes.readInto("translateZ", mTranslateZ);
821
822 if ( mIsSetTranslateZ == false)
823 {
824 if (log->getNumErrors() == numErrs + 1 &&
825 log->contains(XMLAttributeTypeMismatch))
826 {
827 log->remove(XMLAttributeTypeMismatch);
828 std::string message = "Spatial attribute 'translateZ' from the "
829 "<csgTranslation> element must be an integer.";
830 log->logPackageError("spatial",
831 SpatialCSGTranslationTranslateZMustBeDouble, pkgVersion, level, version,
832 message, getLine(), getColumn());
833 }
834 }
835 }
836
837 /** @endcond */
838
839
840
841 /** @cond doxygenLibsbmlInternal */
842
843 /*
844 * Writes the attributes to the stream
845 */
846 void
writeAttributes(XMLOutputStream & stream) const847 CSGTranslation::writeAttributes(XMLOutputStream& stream) const
848 {
849 CSGTransformation::writeAttributes(stream);
850
851 if (isSetTranslateX() == true)
852 {
853 stream.writeAttribute("translateX", getPrefix(), mTranslateX);
854 }
855
856 if (isSetTranslateY() == true)
857 {
858 stream.writeAttribute("translateY", getPrefix(), mTranslateY);
859 }
860
861 if (isSetTranslateZ() == true)
862 {
863 stream.writeAttribute("translateZ", getPrefix(), mTranslateZ);
864 }
865
866 SBase::writeExtensionAttributes(stream);
867 }
868
869 /** @endcond */
870
871
872
873
874 #endif /* __cplusplus */
875
876
877 /*
878 * Creates a new CSGTranslation_t using the given SBML Level, Version and
879 * “spatial” package version.
880 */
881 LIBSBML_EXTERN
882 CSGTranslation_t *
CSGTranslation_create(unsigned int level,unsigned int version,unsigned int pkgVersion)883 CSGTranslation_create(unsigned int level,
884 unsigned int version,
885 unsigned int pkgVersion)
886 {
887 return new CSGTranslation(level, version, pkgVersion);
888 }
889
890
891 /*
892 * Creates and returns a deep copy of this CSGTranslation_t object.
893 */
894 LIBSBML_EXTERN
895 CSGTranslation_t*
CSGTranslation_clone(const CSGTranslation_t * csgt)896 CSGTranslation_clone(const CSGTranslation_t* csgt)
897 {
898 if (csgt != NULL)
899 {
900 return static_cast<CSGTranslation_t*>(csgt->clone());
901 }
902 else
903 {
904 return NULL;
905 }
906 }
907
908
909 /*
910 * Frees this CSGTranslation_t object.
911 */
912 LIBSBML_EXTERN
913 void
CSGTranslation_free(CSGTranslation_t * csgt)914 CSGTranslation_free(CSGTranslation_t* csgt)
915 {
916 if (csgt != NULL)
917 {
918 delete csgt;
919 }
920 }
921
922
923 /*
924 * Returns the value of the "translateX" attribute of this CSGTranslation_t.
925 */
926 LIBSBML_EXTERN
927 double
CSGTranslation_getTranslateX(const CSGTranslation_t * csgt)928 CSGTranslation_getTranslateX(const CSGTranslation_t * csgt)
929 {
930 return (csgt != NULL) ? csgt->getTranslateX() : util_NaN();
931 }
932
933
934 /*
935 * Returns the value of the "translateY" attribute of this CSGTranslation_t.
936 */
937 LIBSBML_EXTERN
938 double
CSGTranslation_getTranslateY(const CSGTranslation_t * csgt)939 CSGTranslation_getTranslateY(const CSGTranslation_t * csgt)
940 {
941 return (csgt != NULL) ? csgt->getTranslateY() : util_NaN();
942 }
943
944
945 /*
946 * Returns the value of the "translateZ" attribute of this CSGTranslation_t.
947 */
948 LIBSBML_EXTERN
949 double
CSGTranslation_getTranslateZ(const CSGTranslation_t * csgt)950 CSGTranslation_getTranslateZ(const CSGTranslation_t * csgt)
951 {
952 return (csgt != NULL) ? csgt->getTranslateZ() : util_NaN();
953 }
954
955
956 /*
957 * Predicate returning @c 1 (true) if this CSGTranslation_t's "translateX"
958 * attribute is set.
959 */
960 LIBSBML_EXTERN
961 int
CSGTranslation_isSetTranslateX(const CSGTranslation_t * csgt)962 CSGTranslation_isSetTranslateX(const CSGTranslation_t * csgt)
963 {
964 return (csgt != NULL) ? static_cast<int>(csgt->isSetTranslateX()) : 0;
965 }
966
967
968 /*
969 * Predicate returning @c 1 (true) if this CSGTranslation_t's "translateY"
970 * attribute is set.
971 */
972 LIBSBML_EXTERN
973 int
CSGTranslation_isSetTranslateY(const CSGTranslation_t * csgt)974 CSGTranslation_isSetTranslateY(const CSGTranslation_t * csgt)
975 {
976 return (csgt != NULL) ? static_cast<int>(csgt->isSetTranslateY()) : 0;
977 }
978
979
980 /*
981 * Predicate returning @c 1 (true) if this CSGTranslation_t's "translateZ"
982 * attribute is set.
983 */
984 LIBSBML_EXTERN
985 int
CSGTranslation_isSetTranslateZ(const CSGTranslation_t * csgt)986 CSGTranslation_isSetTranslateZ(const CSGTranslation_t * csgt)
987 {
988 return (csgt != NULL) ? static_cast<int>(csgt->isSetTranslateZ()) : 0;
989 }
990
991
992 /*
993 * Sets the value of the "translateX" attribute of this CSGTranslation_t.
994 */
995 LIBSBML_EXTERN
996 int
CSGTranslation_setTranslateX(CSGTranslation_t * csgt,double translateX)997 CSGTranslation_setTranslateX(CSGTranslation_t * csgt, double translateX)
998 {
999 return (csgt != NULL) ? csgt->setTranslateX(translateX) :
1000 LIBSBML_INVALID_OBJECT;
1001 }
1002
1003
1004 /*
1005 * Sets the value of the "translateY" attribute of this CSGTranslation_t.
1006 */
1007 LIBSBML_EXTERN
1008 int
CSGTranslation_setTranslateY(CSGTranslation_t * csgt,double translateY)1009 CSGTranslation_setTranslateY(CSGTranslation_t * csgt, double translateY)
1010 {
1011 return (csgt != NULL) ? csgt->setTranslateY(translateY) :
1012 LIBSBML_INVALID_OBJECT;
1013 }
1014
1015
1016 /*
1017 * Sets the value of the "translateZ" attribute of this CSGTranslation_t.
1018 */
1019 LIBSBML_EXTERN
1020 int
CSGTranslation_setTranslateZ(CSGTranslation_t * csgt,double translateZ)1021 CSGTranslation_setTranslateZ(CSGTranslation_t * csgt, double translateZ)
1022 {
1023 return (csgt != NULL) ? csgt->setTranslateZ(translateZ) :
1024 LIBSBML_INVALID_OBJECT;
1025 }
1026
1027
1028 /*
1029 * Unsets the value of the "translateX" attribute of this CSGTranslation_t.
1030 */
1031 LIBSBML_EXTERN
1032 int
CSGTranslation_unsetTranslateX(CSGTranslation_t * csgt)1033 CSGTranslation_unsetTranslateX(CSGTranslation_t * csgt)
1034 {
1035 return (csgt != NULL) ? csgt->unsetTranslateX() : LIBSBML_INVALID_OBJECT;
1036 }
1037
1038
1039 /*
1040 * Unsets the value of the "translateY" attribute of this CSGTranslation_t.
1041 */
1042 LIBSBML_EXTERN
1043 int
CSGTranslation_unsetTranslateY(CSGTranslation_t * csgt)1044 CSGTranslation_unsetTranslateY(CSGTranslation_t * csgt)
1045 {
1046 return (csgt != NULL) ? csgt->unsetTranslateY() : LIBSBML_INVALID_OBJECT;
1047 }
1048
1049
1050 /*
1051 * Unsets the value of the "translateZ" attribute of this CSGTranslation_t.
1052 */
1053 LIBSBML_EXTERN
1054 int
CSGTranslation_unsetTranslateZ(CSGTranslation_t * csgt)1055 CSGTranslation_unsetTranslateZ(CSGTranslation_t * csgt)
1056 {
1057 return (csgt != NULL) ? csgt->unsetTranslateZ() : LIBSBML_INVALID_OBJECT;
1058 }
1059
1060
1061 /*
1062 * Predicate returning @c 1 (true) if all the required attributes for this
1063 * CSGTranslation_t object have been set.
1064 */
1065 LIBSBML_EXTERN
1066 int
CSGTranslation_hasRequiredAttributes(const CSGTranslation_t * csgt)1067 CSGTranslation_hasRequiredAttributes(const CSGTranslation_t * csgt)
1068 {
1069 return (csgt != NULL) ? static_cast<int>(csgt->hasRequiredAttributes()) : 0;
1070 }
1071
1072
1073
1074
1075 LIBSBML_CPP_NAMESPACE_END
1076
1077
1078