1 /**
2  * @file MixedGeometry.cpp
3  * @brief Implementation of the MixedGeometry 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/MixedGeometry.h>
43 #include <sbml/packages/spatial/validator/SpatialSBMLError.h>
44 #include <sbml/util/ElementFilter.h>
45 
46 #include <sbml/packages/spatial/sbml/AnalyticGeometry.h>
47 #include <sbml/packages/spatial/sbml/SampledFieldGeometry.h>
48 #include <sbml/packages/spatial/sbml/CSGeometry.h>
49 #include <sbml/packages/spatial/sbml/ParametricGeometry.h>
50 #include <sbml/packages/spatial/sbml/MixedGeometry.h>
51 
52 
53 using namespace std;
54 
55 
56 
57 LIBSBML_CPP_NAMESPACE_BEGIN
58 
59 
60 
61 
62 #ifdef __cplusplus
63 
64 
65 /*
66  * Creates a new MixedGeometry using the given SBML Level, Version and
67  * &ldquo;spatial&rdquo; package version.
68  */
MixedGeometry(unsigned int level,unsigned int version,unsigned int pkgVersion)69 MixedGeometry::MixedGeometry(unsigned int level,
70                              unsigned int version,
71                              unsigned int pkgVersion)
72   : GeometryDefinition(level, version, pkgVersion)
73   , mGeometryDefinitions (level, version, pkgVersion)
74   , mOrdinalMappings (level, version, pkgVersion)
75 {
76   setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version,
77     pkgVersion));
78   connectToChild();
79 }
80 
81 
82 /*
83  * Creates a new MixedGeometry using the given SpatialPkgNamespaces object.
84  */
MixedGeometry(SpatialPkgNamespaces * spatialns)85 MixedGeometry::MixedGeometry(SpatialPkgNamespaces *spatialns)
86   : GeometryDefinition(spatialns)
87   , mGeometryDefinitions (spatialns)
88   , mOrdinalMappings (spatialns)
89 {
90   setElementNamespace(spatialns->getURI());
91   connectToChild();
92   loadPlugins(spatialns);
93 }
94 
95 
96 /*
97  * Copy constructor for MixedGeometry.
98  */
MixedGeometry(const MixedGeometry & orig)99 MixedGeometry::MixedGeometry(const MixedGeometry& orig)
100   : GeometryDefinition( orig )
101   , mGeometryDefinitions ( orig.mGeometryDefinitions )
102   , mOrdinalMappings ( orig.mOrdinalMappings )
103 {
104   connectToChild();
105 }
106 
107 
108 /*
109  * Assignment operator for MixedGeometry.
110  */
111 MixedGeometry&
operator =(const MixedGeometry & rhs)112 MixedGeometry::operator=(const MixedGeometry& rhs)
113 {
114   if (&rhs != this)
115   {
116     GeometryDefinition::operator=(rhs);
117     mGeometryDefinitions = rhs.mGeometryDefinitions;
118     mOrdinalMappings = rhs.mOrdinalMappings;
119     connectToChild();
120   }
121 
122   return *this;
123 }
124 
125 
126 /*
127  * Creates and returns a deep copy of this MixedGeometry object.
128  */
129 MixedGeometry*
clone() const130 MixedGeometry::clone() const
131 {
132   return new MixedGeometry(*this);
133 }
134 
135 
136 /*
137  * Destructor for MixedGeometry.
138  */
~MixedGeometry()139 MixedGeometry::~MixedGeometry()
140 {
141 }
142 
143 
144 /*
145  * Returns the ListOfGeometryDefinitions from this MixedGeometry.
146  */
147 const ListOfGeometryDefinitions*
getListOfGeometryDefinitions() const148 MixedGeometry::getListOfGeometryDefinitions() const
149 {
150   return &mGeometryDefinitions;
151 }
152 
153 
154 /*
155  * Returns the ListOfGeometryDefinitions from this MixedGeometry.
156  */
157 ListOfGeometryDefinitions*
getListOfGeometryDefinitions()158 MixedGeometry::getListOfGeometryDefinitions()
159 {
160   return &mGeometryDefinitions;
161 }
162 
163 
164 /*
165  * Get a GeometryDefinition from the MixedGeometry.
166  */
167 GeometryDefinition*
getGeometryDefinition(unsigned int n)168 MixedGeometry::getGeometryDefinition(unsigned int n)
169 {
170   return mGeometryDefinitions.get(n);
171 }
172 
173 
174 /*
175  * Get a GeometryDefinition from the MixedGeometry.
176  */
177 const GeometryDefinition*
getGeometryDefinition(unsigned int n) const178 MixedGeometry::getGeometryDefinition(unsigned int n) const
179 {
180   return mGeometryDefinitions.get(n);
181 }
182 
183 
184 /*
185  * Get a GeometryDefinition from the MixedGeometry based on its identifier.
186  */
187 GeometryDefinition*
getGeometryDefinition(const std::string & sid)188 MixedGeometry::getGeometryDefinition(const std::string& sid)
189 {
190   return mGeometryDefinitions.get(sid);
191 }
192 
193 
194 /*
195  * Get a GeometryDefinition from the MixedGeometry based on its identifier.
196  */
197 const GeometryDefinition*
getGeometryDefinition(const std::string & sid) const198 MixedGeometry::getGeometryDefinition(const std::string& sid) const
199 {
200   return mGeometryDefinitions.get(sid);
201 }
202 
203 
204 /*
205  * Adds a copy of the given GeometryDefinition to this MixedGeometry.
206  */
207 int
addGeometryDefinition(const GeometryDefinition * gd)208 MixedGeometry::addGeometryDefinition(const GeometryDefinition* gd)
209 {
210   if (gd == NULL)
211   {
212     return LIBSBML_OPERATION_FAILED;
213   }
214   else if (gd->hasRequiredAttributes() == false)
215   {
216     return LIBSBML_INVALID_OBJECT;
217   }
218   else if (getLevel() != gd->getLevel())
219   {
220     return LIBSBML_LEVEL_MISMATCH;
221   }
222   else if (getVersion() != gd->getVersion())
223   {
224     return LIBSBML_VERSION_MISMATCH;
225   }
226   else if (matchesRequiredSBMLNamespacesForAddition(static_cast<const
227     SBase*>(gd)) == false)
228   {
229     return LIBSBML_NAMESPACES_MISMATCH;
230   }
231   else if (gd->isSetId() && (mGeometryDefinitions.get(gd->getId())) != NULL)
232   {
233     return LIBSBML_DUPLICATE_OBJECT_ID;
234   }
235   else
236   {
237     return mGeometryDefinitions.append(gd);
238   }
239 }
240 
241 
242 /*
243  * Get the number of GeometryDefinition objects in this MixedGeometry.
244  */
245 unsigned int
getNumGeometryDefinitions() const246 MixedGeometry::getNumGeometryDefinitions() const
247 {
248   return mGeometryDefinitions.size();
249 }
250 
251 
252 /*
253  * Creates a new AnalyticGeometry object, adds it to this MixedGeometry object
254  * and returns the AnalyticGeometry object created.
255  */
256 AnalyticGeometry*
createAnalyticGeometry()257 MixedGeometry::createAnalyticGeometry()
258 {
259   AnalyticGeometry* ag = NULL;
260 
261   try
262   {
263     SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces());
264     ag = new AnalyticGeometry(spatialns);
265     delete spatialns;
266   }
267   catch (...)
268   {
269   }
270 
271   if (ag != NULL)
272   {
273     mGeometryDefinitions.appendAndOwn(ag);
274   }
275 
276   return ag;
277 }
278 
279 
280 /*
281  * Creates a new SampledFieldGeometry object, adds it to this MixedGeometry
282  * object and returns the SampledFieldGeometry object created.
283  */
284 SampledFieldGeometry*
createSampledFieldGeometry()285 MixedGeometry::createSampledFieldGeometry()
286 {
287   SampledFieldGeometry* sfg = NULL;
288 
289   try
290   {
291     SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces());
292     sfg = new SampledFieldGeometry(spatialns);
293     delete spatialns;
294   }
295   catch (...)
296   {
297   }
298 
299   if (sfg != NULL)
300   {
301     mGeometryDefinitions.appendAndOwn(sfg);
302   }
303 
304   return sfg;
305 }
306 
307 
308 /*
309  * Creates a new CSGeometry object, adds it to this MixedGeometry object and
310  * returns the CSGeometry object created.
311  */
312 CSGeometry*
createCSGeometry()313 MixedGeometry::createCSGeometry()
314 {
315   CSGeometry* csg = NULL;
316 
317   try
318   {
319     SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces());
320     csg = new CSGeometry(spatialns);
321     delete spatialns;
322   }
323   catch (...)
324   {
325   }
326 
327   if (csg != NULL)
328   {
329     mGeometryDefinitions.appendAndOwn(csg);
330   }
331 
332   return csg;
333 }
334 
335 
336 /*
337  * Creates a new ParametricGeometry object, adds it to this MixedGeometry
338  * object and returns the ParametricGeometry object created.
339  */
340 ParametricGeometry*
createParametricGeometry()341 MixedGeometry::createParametricGeometry()
342 {
343   ParametricGeometry* pg = NULL;
344 
345   try
346   {
347     SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces());
348     pg = new ParametricGeometry(spatialns);
349     delete spatialns;
350   }
351   catch (...)
352   {
353   }
354 
355   if (pg != NULL)
356   {
357     mGeometryDefinitions.appendAndOwn(pg);
358   }
359 
360   return pg;
361 }
362 
363 
364 /*
365  * Creates a new MixedGeometry object, adds it to this MixedGeometry object and
366  * returns the MixedGeometry object created.
367  */
368 MixedGeometry*
createMixedGeometry()369 MixedGeometry::createMixedGeometry()
370 {
371   MixedGeometry* mg = NULL;
372 
373   try
374   {
375     SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces());
376     mg = new MixedGeometry(spatialns);
377     delete spatialns;
378   }
379   catch (...)
380   {
381   }
382 
383   if (mg != NULL)
384   {
385     mGeometryDefinitions.appendAndOwn(mg);
386   }
387 
388   return mg;
389 }
390 
391 
392 /*
393  * Removes the nth GeometryDefinition from this MixedGeometry and returns a
394  * pointer to it.
395  */
396 GeometryDefinition*
removeGeometryDefinition(unsigned int n)397 MixedGeometry::removeGeometryDefinition(unsigned int n)
398 {
399   return mGeometryDefinitions.remove(n);
400 }
401 
402 
403 /*
404  * Removes the GeometryDefinition from this MixedGeometry based on its
405  * identifier and returns a pointer to it.
406  */
407 GeometryDefinition*
removeGeometryDefinition(const std::string & sid)408 MixedGeometry::removeGeometryDefinition(const std::string& sid)
409 {
410   return mGeometryDefinitions.remove(sid);
411 }
412 
413 
414 /*
415  * Returns the ListOfOrdinalMappings from this MixedGeometry.
416  */
417 const ListOfOrdinalMappings*
getListOfOrdinalMappings() const418 MixedGeometry::getListOfOrdinalMappings() const
419 {
420   return &mOrdinalMappings;
421 }
422 
423 
424 /*
425  * Returns the ListOfOrdinalMappings from this MixedGeometry.
426  */
427 ListOfOrdinalMappings*
getListOfOrdinalMappings()428 MixedGeometry::getListOfOrdinalMappings()
429 {
430   return &mOrdinalMappings;
431 }
432 
433 
434 /*
435  * Get an OrdinalMapping from the MixedGeometry.
436  */
437 OrdinalMapping*
getOrdinalMapping(unsigned int n)438 MixedGeometry::getOrdinalMapping(unsigned int n)
439 {
440   return mOrdinalMappings.get(n);
441 }
442 
443 
444 /*
445  * Get an OrdinalMapping from the MixedGeometry.
446  */
447 const OrdinalMapping*
getOrdinalMapping(unsigned int n) const448 MixedGeometry::getOrdinalMapping(unsigned int n) const
449 {
450   return mOrdinalMappings.get(n);
451 }
452 
453 
454 /*
455  * Get an OrdinalMapping from the MixedGeometry based on the GeometryDefinition
456  * to which it refers.
457  */
458 const OrdinalMapping*
getOrdinalMappingByGeometryDefinition(const std::string & sid) const459 MixedGeometry::getOrdinalMappingByGeometryDefinition(const std::string& sid)
460   const
461 {
462   return mOrdinalMappings.getByGeometryDefinition(sid);
463 }
464 
465 
466 /*
467  * Get an OrdinalMapping from the MixedGeometry based on the GeometryDefinition
468  * to which it refers.
469  */
470 OrdinalMapping*
getOrdinalMappingByGeometryDefinition(const std::string & sid)471 MixedGeometry::getOrdinalMappingByGeometryDefinition(const std::string& sid)
472 {
473   return mOrdinalMappings.getByGeometryDefinition(sid);
474 }
475 
476 
477 /*
478  * Adds a copy of the given OrdinalMapping to this MixedGeometry.
479  */
480 int
addOrdinalMapping(const OrdinalMapping * om)481 MixedGeometry::addOrdinalMapping(const OrdinalMapping* om)
482 {
483   if (om == NULL)
484   {
485     return LIBSBML_OPERATION_FAILED;
486   }
487   else if (om->hasRequiredAttributes() == false)
488   {
489     return LIBSBML_INVALID_OBJECT;
490   }
491   else if (getLevel() != om->getLevel())
492   {
493     return LIBSBML_LEVEL_MISMATCH;
494   }
495   else if (getVersion() != om->getVersion())
496   {
497     return LIBSBML_VERSION_MISMATCH;
498   }
499   else if (matchesRequiredSBMLNamespacesForAddition(static_cast<const
500     SBase*>(om)) == false)
501   {
502     return LIBSBML_NAMESPACES_MISMATCH;
503   }
504   else
505   {
506     return mOrdinalMappings.append(om);
507   }
508 }
509 
510 
511 /*
512  * Get the number of OrdinalMapping objects in this MixedGeometry.
513  */
514 unsigned int
getNumOrdinalMappings() const515 MixedGeometry::getNumOrdinalMappings() const
516 {
517   return mOrdinalMappings.size();
518 }
519 
520 
521 /*
522  * Creates a new OrdinalMapping object, adds it to this MixedGeometry object
523  * and returns the OrdinalMapping object created.
524  */
525 OrdinalMapping*
createOrdinalMapping()526 MixedGeometry::createOrdinalMapping()
527 {
528   OrdinalMapping* om = NULL;
529 
530   try
531   {
532     SPATIAL_CREATE_NS(spatialns, getSBMLNamespaces());
533     om = new OrdinalMapping(spatialns);
534     delete spatialns;
535   }
536   catch (...)
537   {
538   }
539 
540   if (om != NULL)
541   {
542     mOrdinalMappings.appendAndOwn(om);
543   }
544 
545   return om;
546 }
547 
548 
549 /*
550  * Removes the nth OrdinalMapping from this MixedGeometry and returns a pointer
551  * to it.
552  */
553 OrdinalMapping*
removeOrdinalMapping(unsigned int n)554 MixedGeometry::removeOrdinalMapping(unsigned int n)
555 {
556   return mOrdinalMappings.remove(n);
557 }
558 
559 
560 /*
561  * Returns the XML element name of this MixedGeometry object.
562  */
563 const std::string&
getElementName() const564 MixedGeometry::getElementName() const
565 {
566   static const string name = "mixedGeometry";
567   return name;
568 }
569 
570 
571 /*
572  * Returns the libSBML type code for this MixedGeometry object.
573  */
574 int
getTypeCode() const575 MixedGeometry::getTypeCode() const
576 {
577   return SBML_SPATIAL_MIXEDGEOMETRY;
578 }
579 
580 
581 /*
582  * Predicate returning @c true if all the required attributes for this
583  * MixedGeometry object have been set.
584  */
585 bool
hasRequiredAttributes() const586 MixedGeometry::hasRequiredAttributes() const
587 {
588   bool allPresent = GeometryDefinition::hasRequiredAttributes();
589 
590   return allPresent;
591 }
592 
593 
594 /*
595  * Predicate returning @c true if all the required elements for this
596  * MixedGeometry object have been set.
597  */
598 bool
hasRequiredElements() const599 MixedGeometry::hasRequiredElements() const
600 {
601   bool allPresent = GeometryDefinition::hasRequiredElements();
602 
603   return allPresent;
604 }
605 
606 
607 
608 /** @cond doxygenLibsbmlInternal */
609 
610 /*
611  * Write any contained elements
612  */
613 void
writeElements(XMLOutputStream & stream) const614 MixedGeometry::writeElements(XMLOutputStream& stream) const
615 {
616   GeometryDefinition::writeElements(stream);
617 
618   if (getNumGeometryDefinitions() > 0)
619   {
620     mGeometryDefinitions.write(stream);
621   }
622 
623   if (getNumOrdinalMappings() > 0)
624   {
625     mOrdinalMappings.write(stream);
626   }
627 
628   SBase::writeExtensionElements(stream);
629 }
630 
631 /** @endcond */
632 
633 
634 
635 /** @cond doxygenLibsbmlInternal */
636 
637 /*
638  * Accepts the given SBMLVisitor
639  */
640 bool
accept(SBMLVisitor & v) const641 MixedGeometry::accept(SBMLVisitor& v) const
642 {
643   v.visit(*this);
644 
645   mGeometryDefinitions.accept(v);
646 
647   mOrdinalMappings.accept(v);
648 
649   v.leave(*this);
650   return true;
651 }
652 
653 /** @endcond */
654 
655 
656 
657 /** @cond doxygenLibsbmlInternal */
658 
659 /*
660  * Sets the parent SBMLDocument
661  */
662 void
setSBMLDocument(SBMLDocument * d)663 MixedGeometry::setSBMLDocument(SBMLDocument* d)
664 {
665   GeometryDefinition::setSBMLDocument(d);
666 
667   mGeometryDefinitions.setSBMLDocument(d);
668 
669   mOrdinalMappings.setSBMLDocument(d);
670 }
671 
672 /** @endcond */
673 
674 
675 
676 /** @cond doxygenLibsbmlInternal */
677 
678 /*
679  * Connects to child elements
680  */
681 void
connectToChild()682 MixedGeometry::connectToChild()
683 {
684   GeometryDefinition::connectToChild();
685 
686   mGeometryDefinitions.connectToParent(this);
687 
688   mOrdinalMappings.connectToParent(this);
689 }
690 
691 /** @endcond */
692 
693 
694 
695 /** @cond doxygenLibsbmlInternal */
696 
697 /*
698  * Enables/disables the given package with this element
699  */
700 void
enablePackageInternal(const std::string & pkgURI,const std::string & pkgPrefix,bool flag)701 MixedGeometry::enablePackageInternal(const std::string& pkgURI,
702                                      const std::string& pkgPrefix,
703                                      bool flag)
704 {
705   GeometryDefinition::enablePackageInternal(pkgURI, pkgPrefix, flag);
706 
707   mGeometryDefinitions.enablePackageInternal(pkgURI, pkgPrefix, flag);
708 
709   mOrdinalMappings.enablePackageInternal(pkgURI, pkgPrefix, flag);
710 }
711 
712 /** @endcond */
713 
714 
715 
716 /** @cond doxygenLibsbmlInternal */
717 
718 /*
719  * Updates the namespaces when setLevelVersion is used
720  */
721 void
updateSBMLNamespace(const std::string & package,unsigned int level,unsigned int version)722 MixedGeometry::updateSBMLNamespace(const std::string& package,
723                                    unsigned int level,
724                                    unsigned int version)
725 {
726   GeometryDefinition::updateSBMLNamespace(package, level, version);
727 
728   mGeometryDefinitions.updateSBMLNamespace(package, level, version);
729 
730   mOrdinalMappings.updateSBMLNamespace(package, level, version);
731 }
732 
733 /** @endcond */
734 
735 
736 
737 /** @cond doxygenLibsbmlInternal */
738 
739 /*
740  * Gets the value of the "attributeName" attribute of this MixedGeometry.
741  */
742 int
getAttribute(const std::string & attributeName,bool & value) const743 MixedGeometry::getAttribute(const std::string& attributeName,
744                             bool& value) const
745 {
746   int return_value = GeometryDefinition::getAttribute(attributeName, value);
747 
748   return return_value;
749 }
750 
751 /** @endcond */
752 
753 
754 
755 /** @cond doxygenLibsbmlInternal */
756 
757 /*
758  * Gets the value of the "attributeName" attribute of this MixedGeometry.
759  */
760 int
getAttribute(const std::string & attributeName,int & value) const761 MixedGeometry::getAttribute(const std::string& attributeName,
762                             int& value) const
763 {
764   int return_value = GeometryDefinition::getAttribute(attributeName, value);
765 
766   return return_value;
767 }
768 
769 /** @endcond */
770 
771 
772 
773 /** @cond doxygenLibsbmlInternal */
774 
775 /*
776  * Gets the value of the "attributeName" attribute of this MixedGeometry.
777  */
778 int
getAttribute(const std::string & attributeName,double & value) const779 MixedGeometry::getAttribute(const std::string& attributeName,
780                             double& value) const
781 {
782   int return_value = GeometryDefinition::getAttribute(attributeName, value);
783 
784   return return_value;
785 }
786 
787 /** @endcond */
788 
789 
790 
791 /** @cond doxygenLibsbmlInternal */
792 
793 /*
794  * Gets the value of the "attributeName" attribute of this MixedGeometry.
795  */
796 int
getAttribute(const std::string & attributeName,unsigned int & value) const797 MixedGeometry::getAttribute(const std::string& attributeName,
798                             unsigned int& value) const
799 {
800   int return_value = GeometryDefinition::getAttribute(attributeName, value);
801 
802   return return_value;
803 }
804 
805 /** @endcond */
806 
807 
808 
809 /** @cond doxygenLibsbmlInternal */
810 
811 /*
812  * Gets the value of the "attributeName" attribute of this MixedGeometry.
813  */
814 int
getAttribute(const std::string & attributeName,std::string & value) const815 MixedGeometry::getAttribute(const std::string& attributeName,
816                             std::string& value) const
817 {
818   int return_value = GeometryDefinition::getAttribute(attributeName, value);
819 
820   return return_value;
821 }
822 
823 /** @endcond */
824 
825 
826 
827 /** @cond doxygenLibsbmlInternal */
828 
829 /*
830  * Predicate returning @c true if this MixedGeometry's attribute
831  * "attributeName" is set.
832  */
833 bool
isSetAttribute(const std::string & attributeName) const834 MixedGeometry::isSetAttribute(const std::string& attributeName) const
835 {
836   bool value = GeometryDefinition::isSetAttribute(attributeName);
837 
838   return value;
839 }
840 
841 /** @endcond */
842 
843 
844 
845 /** @cond doxygenLibsbmlInternal */
846 
847 /*
848  * Sets the value of the "attributeName" attribute of this MixedGeometry.
849  */
850 int
setAttribute(const std::string & attributeName,bool value)851 MixedGeometry::setAttribute(const std::string& attributeName, bool value)
852 {
853   int return_value = GeometryDefinition::setAttribute(attributeName, value);
854 
855   return return_value;
856 }
857 
858 /** @endcond */
859 
860 
861 
862 /** @cond doxygenLibsbmlInternal */
863 
864 /*
865  * Sets the value of the "attributeName" attribute of this MixedGeometry.
866  */
867 int
setAttribute(const std::string & attributeName,int value)868 MixedGeometry::setAttribute(const std::string& attributeName, int value)
869 {
870   int return_value = GeometryDefinition::setAttribute(attributeName, value);
871 
872   return return_value;
873 }
874 
875 /** @endcond */
876 
877 
878 
879 /** @cond doxygenLibsbmlInternal */
880 
881 /*
882  * Sets the value of the "attributeName" attribute of this MixedGeometry.
883  */
884 int
setAttribute(const std::string & attributeName,double value)885 MixedGeometry::setAttribute(const std::string& attributeName, double value)
886 {
887   int return_value = GeometryDefinition::setAttribute(attributeName, value);
888 
889   return return_value;
890 }
891 
892 /** @endcond */
893 
894 
895 
896 /** @cond doxygenLibsbmlInternal */
897 
898 /*
899  * Sets the value of the "attributeName" attribute of this MixedGeometry.
900  */
901 int
setAttribute(const std::string & attributeName,unsigned int value)902 MixedGeometry::setAttribute(const std::string& attributeName,
903                             unsigned int value)
904 {
905   int return_value = GeometryDefinition::setAttribute(attributeName, value);
906 
907   return return_value;
908 }
909 
910 /** @endcond */
911 
912 
913 
914 /** @cond doxygenLibsbmlInternal */
915 
916 /*
917  * Sets the value of the "attributeName" attribute of this MixedGeometry.
918  */
919 int
setAttribute(const std::string & attributeName,const std::string & value)920 MixedGeometry::setAttribute(const std::string& attributeName,
921                             const std::string& value)
922 {
923   int return_value = GeometryDefinition::setAttribute(attributeName, value);
924 
925   return return_value;
926 }
927 
928 /** @endcond */
929 
930 
931 
932 /** @cond doxygenLibsbmlInternal */
933 
934 /*
935  * Unsets the value of the "attributeName" attribute of this MixedGeometry.
936  */
937 int
unsetAttribute(const std::string & attributeName)938 MixedGeometry::unsetAttribute(const std::string& attributeName)
939 {
940   int value = GeometryDefinition::unsetAttribute(attributeName);
941 
942   return value;
943 }
944 
945 /** @endcond */
946 
947 
948 
949 /** @cond doxygenLibsbmlInternal */
950 
951 /*
952  * Creates and returns an new "elementName" object in this MixedGeometry.
953  */
954 SBase*
createChildObject(const std::string & elementName)955 MixedGeometry::createChildObject(const std::string& elementName)
956 {
957   GeometryDefinition* obj = NULL;
958 
959   if (elementName == "analyticGeometry")
960   {
961     return createAnalyticGeometry();
962   }
963   else if (elementName == "sampledFieldGeometry")
964   {
965     return createSampledFieldGeometry();
966   }
967   else if (elementName == "csGeometry")
968   {
969     return createCSGeometry();
970   }
971   else if (elementName == "parametricGeometry")
972   {
973     return createParametricGeometry();
974   }
975   else if (elementName == "mixedGeometry")
976   {
977     return createMixedGeometry();
978   }
979   else if (elementName == "ordinalMapping")
980   {
981     return createOrdinalMapping();
982   }
983 
984   return obj;
985 }
986 
987 /** @endcond */
988 
989 
990 
991 /** @cond doxygenLibsbmlInternal */
992 
993 /*
994  * Adds a new "elementName" object to this MixedGeometry.
995  */
996 int
addChildObject(const std::string & elementName,const SBase * element)997 MixedGeometry::addChildObject(const std::string& elementName,
998                               const SBase* element)
999 {
1000   if (elementName == "analyticGeometry" && element->getTypeCode() ==
1001     SBML_SPATIAL_ANALYTICGEOMETRY)
1002   {
1003     return addGeometryDefinition((const GeometryDefinition*)(element));
1004   }
1005   else if (elementName == "sampledFieldGeometry" && element->getTypeCode() ==
1006     SBML_SPATIAL_SAMPLEDFIELDGEOMETRY)
1007   {
1008     return addGeometryDefinition((const GeometryDefinition*)(element));
1009   }
1010   else if (elementName == "csGeometry" && element->getTypeCode() ==
1011     SBML_SPATIAL_CSGEOMETRY)
1012   {
1013     return addGeometryDefinition((const GeometryDefinition*)(element));
1014   }
1015   else if (elementName == "parametricGeometry" && element->getTypeCode() ==
1016     SBML_SPATIAL_PARAMETRICGEOMETRY)
1017   {
1018     return addGeometryDefinition((const GeometryDefinition*)(element));
1019   }
1020   else if (elementName == "mixedGeometry" && element->getTypeCode() ==
1021     SBML_SPATIAL_MIXEDGEOMETRY)
1022   {
1023     return addGeometryDefinition((const GeometryDefinition*)(element));
1024   }
1025   else if (elementName == "ordinalMapping" && element->getTypeCode() ==
1026     SBML_SPATIAL_ORDINALMAPPING)
1027   {
1028     return addOrdinalMapping((const OrdinalMapping*)(element));
1029   }
1030 
1031   return LIBSBML_OPERATION_FAILED;
1032 }
1033 
1034 /** @endcond */
1035 
1036 
1037 
1038 /** @cond doxygenLibsbmlInternal */
1039 
1040 /*
1041  * Removes and returns the new "elementName" object with the given id in this
1042  * MixedGeometry.
1043  */
1044 SBase*
removeChildObject(const std::string & elementName,const std::string & id)1045 MixedGeometry::removeChildObject(const std::string& elementName,
1046                                  const std::string& id)
1047 {
1048   if (elementName == "analyticGeometry")
1049   {
1050     return removeGeometryDefinition(id);
1051   }
1052   else if (elementName == "sampledFieldGeometry")
1053   {
1054     return removeGeometryDefinition(id);
1055   }
1056   else if (elementName == "csGeometry")
1057   {
1058     return removeGeometryDefinition(id);
1059   }
1060   else if (elementName == "parametricGeometry")
1061   {
1062     return removeGeometryDefinition(id);
1063   }
1064   else if (elementName == "mixedGeometry")
1065   {
1066     return removeGeometryDefinition(id);
1067   }
1068   else if (elementName == "ordinalMapping")
1069   {
1070     for (unsigned int i = 0; i < getNumOrdinalMappings(); i++)
1071     {
1072       if (getOrdinalMapping(i)->getId() == id)
1073       {
1074         return removeOrdinalMapping(i);
1075       }
1076     }
1077   }
1078 
1079   return NULL;
1080 }
1081 
1082 /** @endcond */
1083 
1084 
1085 
1086 /** @cond doxygenLibsbmlInternal */
1087 
1088 /*
1089  * Returns the number of "elementName" in this MixedGeometry.
1090  */
1091 unsigned int
getNumObjects(const std::string & elementName)1092 MixedGeometry::getNumObjects(const std::string& elementName)
1093 {
1094   unsigned int n = 0;
1095 
1096   if (elementName == "geometryDefinition")
1097   {
1098     return getNumGeometryDefinitions();
1099   }
1100   else if (elementName == "ordinalMapping")
1101   {
1102     return getNumOrdinalMappings();
1103   }
1104 
1105   return n;
1106 }
1107 
1108 /** @endcond */
1109 
1110 
1111 
1112 /** @cond doxygenLibsbmlInternal */
1113 
1114 /*
1115  * Returns the nth object of "objectName" in this MixedGeometry.
1116  */
1117 SBase*
getObject(const std::string & elementName,unsigned int index)1118 MixedGeometry::getObject(const std::string& elementName, unsigned int index)
1119 {
1120   SBase* obj = NULL;
1121 
1122   if (elementName == "geometryDefinition")
1123   {
1124     return getGeometryDefinition(index);
1125   }
1126   else if (elementName == "ordinalMapping")
1127   {
1128     return getOrdinalMapping(index);
1129   }
1130 
1131   return obj;
1132 }
1133 
1134 /** @endcond */
1135 
1136 
1137 /*
1138  * Returns the first child element that has the given @p id in the model-wide
1139  * SId namespace, or @c NULL if no such object is found.
1140  */
1141 SBase*
getElementBySId(const std::string & id)1142 MixedGeometry::getElementBySId(const std::string& id)
1143 {
1144   if (id.empty())
1145   {
1146     return NULL;
1147   }
1148 
1149   SBase* obj = NULL;
1150 
1151   obj = mGeometryDefinitions.getElementBySId(id);
1152 
1153   if (obj != NULL)
1154   {
1155     return obj;
1156   }
1157 
1158   obj = mOrdinalMappings.getElementBySId(id);
1159 
1160   if (obj != NULL)
1161   {
1162     return obj;
1163   }
1164 
1165   return obj;
1166 }
1167 
1168 
1169 /*
1170  * Returns the first child element that has the given @p metaid, or @c NULL if
1171  * no such object is found.
1172  */
1173 SBase*
getElementByMetaId(const std::string & metaid)1174 MixedGeometry::getElementByMetaId(const std::string& metaid)
1175 {
1176   if (metaid.empty())
1177   {
1178     return NULL;
1179   }
1180 
1181   SBase* obj = NULL;
1182 
1183   if (mGeometryDefinitions.getMetaId() == metaid)
1184   {
1185     return &mGeometryDefinitions;
1186   }
1187 
1188   if (mOrdinalMappings.getMetaId() == metaid)
1189   {
1190     return &mOrdinalMappings;
1191   }
1192 
1193   obj = mGeometryDefinitions.getElementByMetaId(metaid);
1194 
1195   if (obj != NULL)
1196   {
1197     return obj;
1198   }
1199 
1200   obj = mOrdinalMappings.getElementByMetaId(metaid);
1201 
1202   if (obj != NULL)
1203   {
1204     return obj;
1205   }
1206 
1207   return obj;
1208 }
1209 
1210 
1211 /*
1212  * Returns a List of all child SBase objects, including those nested to an
1213  * arbitrary depth.
1214  */
1215 List*
getAllElements(ElementFilter * filter)1216 MixedGeometry::getAllElements(ElementFilter* filter)
1217 {
1218   List* ret = new List();
1219   List* sublist = NULL;
1220 
1221 
1222   ADD_FILTERED_LIST(ret, sublist, mGeometryDefinitions, filter);
1223   ADD_FILTERED_LIST(ret, sublist, mOrdinalMappings, filter);
1224 
1225   ADD_FILTERED_FROM_PLUGIN(ret, sublist, filter);
1226 
1227   return ret;
1228 }
1229 
1230 
1231 
1232 /** @cond doxygenLibsbmlInternal */
1233 
1234 /*
1235  * Creates a new object from the next XMLToken on the XMLInputStream
1236  */
1237 SBase*
createObject(XMLInputStream & stream)1238 MixedGeometry::createObject(XMLInputStream& stream)
1239 {
1240   SBase* obj = GeometryDefinition::createObject(stream);
1241 
1242   const std::string& name = stream.peek().getName();
1243 
1244   if (name == "listOfGeometryDefinitions")
1245   {
1246     if (mGeometryDefinitions.size() != 0)
1247     {
1248       getErrorLog()->logPackageError("spatial",
1249         SpatialMixedGeometryAllowedElements, getPackageVersion(), getLevel(),
1250           getVersion());
1251     }
1252 
1253     obj = &mGeometryDefinitions;
1254   }
1255   else if (name == "listOfOrdinalMappings")
1256   {
1257     if (mOrdinalMappings.size() != 0)
1258     {
1259       getErrorLog()->logPackageError("spatial",
1260         SpatialMixedGeometryAllowedElements, getPackageVersion(), getLevel(),
1261           getVersion());
1262     }
1263 
1264     obj = &mOrdinalMappings;
1265   }
1266 
1267   connectToChild();
1268 
1269   return obj;
1270 }
1271 
1272 /** @endcond */
1273 
1274 
1275 
1276 /** @cond doxygenLibsbmlInternal */
1277 
1278 /*
1279  * Adds the expected attributes for this element
1280  */
1281 void
addExpectedAttributes(ExpectedAttributes & attributes)1282 MixedGeometry::addExpectedAttributes(ExpectedAttributes& attributes)
1283 {
1284   GeometryDefinition::addExpectedAttributes(attributes);
1285 }
1286 
1287 /** @endcond */
1288 
1289 
1290 
1291 /** @cond doxygenLibsbmlInternal */
1292 
1293 /*
1294  * Reads the expected attributes into the member data variables
1295  */
1296 void
readAttributes(const XMLAttributes & attributes,const ExpectedAttributes & expectedAttributes)1297 MixedGeometry::readAttributes(const XMLAttributes& attributes,
1298                               const ExpectedAttributes& expectedAttributes)
1299 {
1300   unsigned int level = getLevel();
1301   unsigned int version = getVersion();
1302   unsigned int pkgVersion = getPackageVersion();
1303   unsigned int numErrs;
1304   bool assigned = false;
1305   SBMLErrorLog* log = getErrorLog();
1306 
1307   GeometryDefinition::readAttributes(attributes, expectedAttributes);
1308 
1309   if (log)
1310   {
1311     numErrs = log->getNumErrors();
1312 
1313     for (int n = numErrs-1; n >= 0; n--)
1314     {
1315       if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
1316       {
1317         const std::string details = log->getError(n)->getMessage();
1318         log->remove(UnknownPackageAttribute);
1319         log->logPackageError("spatial", SpatialUnknown, pkgVersion, level,
1320           version, details);
1321       }
1322       else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
1323       {
1324         const std::string details = log->getError(n)->getMessage();
1325         log->remove(UnknownCoreAttribute);
1326         log->logPackageError("spatial",
1327           SpatialMixedGeometryAllowedCoreAttributes, pkgVersion, level, version,
1328             details);
1329       }
1330     }
1331   }
1332 }
1333 
1334 /** @endcond */
1335 
1336 
1337 
1338 /** @cond doxygenLibsbmlInternal */
1339 
1340 /*
1341  * Writes the attributes to the stream
1342  */
1343 void
writeAttributes(XMLOutputStream & stream) const1344 MixedGeometry::writeAttributes(XMLOutputStream& stream) const
1345 {
1346   GeometryDefinition::writeAttributes(stream);
1347 
1348   SBase::writeExtensionAttributes(stream);
1349 }
1350 
1351 /** @endcond */
1352 
1353 
1354 
1355 
1356 #endif /* __cplusplus */
1357 
1358 
1359 /*
1360  * Creates a new MixedGeometry_t using the given SBML Level, Version and
1361  * &ldquo;spatial&rdquo; package version.
1362  */
1363 LIBSBML_EXTERN
1364 MixedGeometry_t *
MixedGeometry_create(unsigned int level,unsigned int version,unsigned int pkgVersion)1365 MixedGeometry_create(unsigned int level,
1366                      unsigned int version,
1367                      unsigned int pkgVersion)
1368 {
1369   return new MixedGeometry(level, version, pkgVersion);
1370 }
1371 
1372 
1373 /*
1374  * Creates and returns a deep copy of this MixedGeometry_t object.
1375  */
1376 LIBSBML_EXTERN
1377 MixedGeometry_t*
MixedGeometry_clone(const MixedGeometry_t * mg)1378 MixedGeometry_clone(const MixedGeometry_t* mg)
1379 {
1380   if (mg != NULL)
1381   {
1382     return static_cast<MixedGeometry_t*>(mg->clone());
1383   }
1384   else
1385   {
1386     return NULL;
1387   }
1388 }
1389 
1390 
1391 /*
1392  * Frees this MixedGeometry_t object.
1393  */
1394 LIBSBML_EXTERN
1395 void
MixedGeometry_free(MixedGeometry_t * mg)1396 MixedGeometry_free(MixedGeometry_t* mg)
1397 {
1398   if (mg != NULL)
1399   {
1400     delete mg;
1401   }
1402 }
1403 
1404 
1405 /*
1406  * Returns a ListOf_t * containing GeometryDefinition_t objects from this
1407  * MixedGeometry_t.
1408  */
1409 LIBSBML_EXTERN
1410 ListOf_t*
MixedGeometry_getListOfGeometryDefinitions(MixedGeometry_t * mg)1411 MixedGeometry_getListOfGeometryDefinitions(MixedGeometry_t* mg)
1412 {
1413   return (mg != NULL) ? mg->getListOfGeometryDefinitions() : NULL;
1414 }
1415 
1416 
1417 /*
1418  * Get a GeometryDefinition_t from the MixedGeometry_t.
1419  */
1420 LIBSBML_EXTERN
1421 GeometryDefinition_t*
MixedGeometry_getGeometryDefinition(MixedGeometry_t * mg,unsigned int n)1422 MixedGeometry_getGeometryDefinition(MixedGeometry_t* mg, unsigned int n)
1423 {
1424   return (mg != NULL) ? mg->getGeometryDefinition(n) : NULL;
1425 }
1426 
1427 
1428 /*
1429  * Get a GeometryDefinition_t from the MixedGeometry_t based on its identifier.
1430  */
1431 LIBSBML_EXTERN
1432 GeometryDefinition_t*
MixedGeometry_getGeometryDefinitionById(MixedGeometry_t * mg,const char * sid)1433 MixedGeometry_getGeometryDefinitionById(MixedGeometry_t* mg, const char *sid)
1434 {
1435   return (mg != NULL && sid != NULL) ? mg->getGeometryDefinition(sid) : NULL;
1436 }
1437 
1438 
1439 /*
1440  * Adds a copy of the given GeometryDefinition_t to this MixedGeometry_t.
1441  */
1442 LIBSBML_EXTERN
1443 int
MixedGeometry_addGeometryDefinition(MixedGeometry_t * mg,const GeometryDefinition_t * gd)1444 MixedGeometry_addGeometryDefinition(MixedGeometry_t* mg,
1445                                     const GeometryDefinition_t* gd)
1446 {
1447   return (mg != NULL) ? mg->addGeometryDefinition(gd) : LIBSBML_INVALID_OBJECT;
1448 }
1449 
1450 
1451 /*
1452  * Get the number of GeometryDefinition_t objects in this MixedGeometry_t.
1453  */
1454 LIBSBML_EXTERN
1455 unsigned int
MixedGeometry_getNumGeometryDefinitions(MixedGeometry_t * mg)1456 MixedGeometry_getNumGeometryDefinitions(MixedGeometry_t* mg)
1457 {
1458   return (mg != NULL) ? mg->getNumGeometryDefinitions() : SBML_INT_MAX;
1459 }
1460 
1461 
1462 /*
1463  * Creates a new AnalyticGeometry_t object, adds it to this MixedGeometry_t
1464  * object and returns the AnalyticGeometry_t object created.
1465  */
1466 LIBSBML_EXTERN
1467 AnalyticGeometry_t*
MixedGeometry_createAnalyticGeometry(MixedGeometry_t * mg)1468 MixedGeometry_createAnalyticGeometry(MixedGeometry_t* mg)
1469 {
1470   return (mg != NULL) ? mg->createAnalyticGeometry() : NULL;
1471 }
1472 
1473 
1474 /*
1475  * Creates a new SampledFieldGeometry_t object, adds it to this MixedGeometry_t
1476  * object and returns the SampledFieldGeometry_t object created.
1477  */
1478 LIBSBML_EXTERN
1479 SampledFieldGeometry_t*
MixedGeometry_createSampledFieldGeometry(MixedGeometry_t * mg)1480 MixedGeometry_createSampledFieldGeometry(MixedGeometry_t* mg)
1481 {
1482   return (mg != NULL) ? mg->createSampledFieldGeometry() : NULL;
1483 }
1484 
1485 
1486 /*
1487  * Creates a new CSGeometry_t object, adds it to this MixedGeometry_t object
1488  * and returns the CSGeometry_t object created.
1489  */
1490 LIBSBML_EXTERN
1491 CSGeometry_t*
MixedGeometry_createCSGeometry(MixedGeometry_t * mg)1492 MixedGeometry_createCSGeometry(MixedGeometry_t* mg)
1493 {
1494   return (mg != NULL) ? mg->createCSGeometry() : NULL;
1495 }
1496 
1497 
1498 /*
1499  * Creates a new ParametricGeometry_t object, adds it to this MixedGeometry_t
1500  * object and returns the ParametricGeometry_t object created.
1501  */
1502 LIBSBML_EXTERN
1503 ParametricGeometry_t*
MixedGeometry_createParametricGeometry(MixedGeometry_t * mg)1504 MixedGeometry_createParametricGeometry(MixedGeometry_t* mg)
1505 {
1506   return (mg != NULL) ? mg->createParametricGeometry() : NULL;
1507 }
1508 
1509 
1510 /*
1511  * Creates a new MixedGeometry_t object, adds it to this MixedGeometry_t object
1512  * and returns the MixedGeometry_t object created.
1513  */
1514 LIBSBML_EXTERN
1515 MixedGeometry_t*
MixedGeometry_createMixedGeometry(MixedGeometry_t * mg)1516 MixedGeometry_createMixedGeometry(MixedGeometry_t* mg)
1517 {
1518   return (mg != NULL) ? mg->createMixedGeometry() : NULL;
1519 }
1520 
1521 
1522 /*
1523  * Removes the nth GeometryDefinition_t from this MixedGeometry_t and returns a
1524  * pointer to it.
1525  */
1526 LIBSBML_EXTERN
1527 GeometryDefinition_t*
MixedGeometry_removeGeometryDefinition(MixedGeometry_t * mg,unsigned int n)1528 MixedGeometry_removeGeometryDefinition(MixedGeometry_t* mg, unsigned int n)
1529 {
1530   return (mg != NULL) ? mg->removeGeometryDefinition(n) : NULL;
1531 }
1532 
1533 
1534 /*
1535  * Removes the GeometryDefinition_t from this MixedGeometry_t based on its
1536  * identifier and returns a pointer to it.
1537  */
1538 LIBSBML_EXTERN
1539 GeometryDefinition_t*
MixedGeometry_removeGeometryDefinitionById(MixedGeometry_t * mg,const char * sid)1540 MixedGeometry_removeGeometryDefinitionById(MixedGeometry_t* mg,
1541                                            const char* sid)
1542 {
1543   return (mg != NULL && sid != NULL) ? mg->removeGeometryDefinition(sid) :
1544     NULL;
1545 }
1546 
1547 
1548 /*
1549  * Returns a ListOf_t * containing OrdinalMapping_t objects from this
1550  * MixedGeometry_t.
1551  */
1552 LIBSBML_EXTERN
1553 ListOf_t*
MixedGeometry_getListOfOrdinalMappings(MixedGeometry_t * mg)1554 MixedGeometry_getListOfOrdinalMappings(MixedGeometry_t* mg)
1555 {
1556   return (mg != NULL) ? mg->getListOfOrdinalMappings() : NULL;
1557 }
1558 
1559 
1560 /*
1561  * Get an OrdinalMapping_t from the MixedGeometry_t.
1562  */
1563 LIBSBML_EXTERN
1564 OrdinalMapping_t*
MixedGeometry_getOrdinalMapping(MixedGeometry_t * mg,unsigned int n)1565 MixedGeometry_getOrdinalMapping(MixedGeometry_t* mg, unsigned int n)
1566 {
1567   return (mg != NULL) ? mg->getOrdinalMapping(n) : NULL;
1568 }
1569 
1570 
1571 /*
1572  * Get an OrdinalMapping_t from the MixedGeometry_t based on the
1573  * GeometryDefinition to which it refers.
1574  */
1575 LIBSBML_EXTERN
1576 OrdinalMapping_t*
MixedGeometry_getOrdinalMappingByGeometryDefinition(MixedGeometry_t * mg,const char * sid)1577 MixedGeometry_getOrdinalMappingByGeometryDefinition(MixedGeometry_t* mg,
1578                                                     const char *sid)
1579 {
1580   return (mg != NULL && sid != NULL) ?
1581     mg->getOrdinalMappingByGeometryDefinition(sid) : NULL;
1582 }
1583 
1584 
1585 /*
1586  * Adds a copy of the given OrdinalMapping_t to this MixedGeometry_t.
1587  */
1588 LIBSBML_EXTERN
1589 int
MixedGeometry_addOrdinalMapping(MixedGeometry_t * mg,const OrdinalMapping_t * om)1590 MixedGeometry_addOrdinalMapping(MixedGeometry_t* mg,
1591                                 const OrdinalMapping_t* om)
1592 {
1593   return (mg != NULL) ? mg->addOrdinalMapping(om) : LIBSBML_INVALID_OBJECT;
1594 }
1595 
1596 
1597 /*
1598  * Get the number of OrdinalMapping_t objects in this MixedGeometry_t.
1599  */
1600 LIBSBML_EXTERN
1601 unsigned int
MixedGeometry_getNumOrdinalMappings(MixedGeometry_t * mg)1602 MixedGeometry_getNumOrdinalMappings(MixedGeometry_t* mg)
1603 {
1604   return (mg != NULL) ? mg->getNumOrdinalMappings() : SBML_INT_MAX;
1605 }
1606 
1607 
1608 /*
1609  * Creates a new OrdinalMapping_t object, adds it to this MixedGeometry_t
1610  * object and returns the OrdinalMapping_t object created.
1611  */
1612 LIBSBML_EXTERN
1613 OrdinalMapping_t*
MixedGeometry_createOrdinalMapping(MixedGeometry_t * mg)1614 MixedGeometry_createOrdinalMapping(MixedGeometry_t* mg)
1615 {
1616   return (mg != NULL) ? mg->createOrdinalMapping() : NULL;
1617 }
1618 
1619 
1620 /*
1621  * Removes the nth OrdinalMapping_t from this MixedGeometry_t and returns a
1622  * pointer to it.
1623  */
1624 LIBSBML_EXTERN
1625 OrdinalMapping_t*
MixedGeometry_removeOrdinalMapping(MixedGeometry_t * mg,unsigned int n)1626 MixedGeometry_removeOrdinalMapping(MixedGeometry_t* mg, unsigned int n)
1627 {
1628   return (mg != NULL) ? mg->removeOrdinalMapping(n) : NULL;
1629 }
1630 
1631 
1632 /*
1633  * Predicate returning @c 1 (true) if all the required attributes for this
1634  * MixedGeometry_t object have been set.
1635  */
1636 LIBSBML_EXTERN
1637 int
MixedGeometry_hasRequiredAttributes(const MixedGeometry_t * mg)1638 MixedGeometry_hasRequiredAttributes(const MixedGeometry_t * mg)
1639 {
1640   return (mg != NULL) ? static_cast<int>(mg->hasRequiredAttributes()) : 0;
1641 }
1642 
1643 
1644 /*
1645  * Predicate returning @c 1 (true) if all the required elements for this
1646  * MixedGeometry_t object have been set.
1647  */
1648 LIBSBML_EXTERN
1649 int
MixedGeometry_hasRequiredElements(const MixedGeometry_t * mg)1650 MixedGeometry_hasRequiredElements(const MixedGeometry_t * mg)
1651 {
1652   return (mg != NULL) ? static_cast<int>(mg->hasRequiredElements()) : 0;
1653 }
1654 
1655 
1656 
1657 
1658 LIBSBML_CPP_NAMESPACE_END
1659 
1660 
1661