1 /**
2  * @file CSGPrimitive.cpp
3  * @brief Implementation of the CSGPrimitive 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/CSGPrimitive.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 CSGPrimitive using the given SBML Level, Version and
60  * &ldquo;spatial&rdquo; package version.
61  */
CSGPrimitive(unsigned int level,unsigned int version,unsigned int pkgVersion)62 CSGPrimitive::CSGPrimitive(unsigned int level,
63                            unsigned int version,
64                            unsigned int pkgVersion)
65   : CSGNode(level, version, pkgVersion)
66   , mPrimitiveType (SPATIAL_PRIMITIVEKIND_INVALID)
67 {
68   setSBMLNamespacesAndOwn(new SpatialPkgNamespaces(level, version,
69     pkgVersion));
70 }
71 
72 
73 /*
74  * Creates a new CSGPrimitive using the given SpatialPkgNamespaces object.
75  */
CSGPrimitive(SpatialPkgNamespaces * spatialns)76 CSGPrimitive::CSGPrimitive(SpatialPkgNamespaces *spatialns)
77   : CSGNode(spatialns)
78   , mPrimitiveType (SPATIAL_PRIMITIVEKIND_INVALID)
79 {
80   setElementNamespace(spatialns->getURI());
81   loadPlugins(spatialns);
82 }
83 
84 
85 /*
86  * Copy constructor for CSGPrimitive.
87  */
CSGPrimitive(const CSGPrimitive & orig)88 CSGPrimitive::CSGPrimitive(const CSGPrimitive& orig)
89   : CSGNode( orig )
90   , mPrimitiveType ( orig.mPrimitiveType )
91 {
92 }
93 
94 
95 /*
96  * Assignment operator for CSGPrimitive.
97  */
98 CSGPrimitive&
operator =(const CSGPrimitive & rhs)99 CSGPrimitive::operator=(const CSGPrimitive& rhs)
100 {
101   if (&rhs != this)
102   {
103     CSGNode::operator=(rhs);
104     mPrimitiveType = rhs.mPrimitiveType;
105   }
106 
107   return *this;
108 }
109 
110 
111 /*
112  * Creates and returns a deep copy of this CSGPrimitive object.
113  */
114 CSGPrimitive*
clone() const115 CSGPrimitive::clone() const
116 {
117   return new CSGPrimitive(*this);
118 }
119 
120 
121 /*
122  * Destructor for CSGPrimitive.
123  */
~CSGPrimitive()124 CSGPrimitive::~CSGPrimitive()
125 {
126 }
127 
128 
129 /*
130  * Returns the value of the "primitiveType" attribute of this CSGPrimitive.
131  */
132 PrimitiveKind_t
getPrimitiveType() const133 CSGPrimitive::getPrimitiveType() const
134 {
135   return mPrimitiveType;
136 }
137 
138 
139 /*
140  * Returns the value of the "primitiveType" attribute of this CSGPrimitive.
141  */
142 std::string
getPrimitiveTypeAsString() const143 CSGPrimitive::getPrimitiveTypeAsString() const
144 {
145   return PrimitiveKind_toString(mPrimitiveType);
146 }
147 
148 
149 /*
150  * Predicate returning @c true if this CSGPrimitive's "primitiveType" attribute
151  * is set.
152  */
153 bool
isSetPrimitiveType() const154 CSGPrimitive::isSetPrimitiveType() const
155 {
156   return (mPrimitiveType != SPATIAL_PRIMITIVEKIND_INVALID);
157 }
158 
159 
160 /*
161  * Sets the value of the "primitiveType" attribute of this CSGPrimitive.
162  */
163 int
setPrimitiveType(const PrimitiveKind_t primitiveType)164 CSGPrimitive::setPrimitiveType(const PrimitiveKind_t primitiveType)
165 {
166   if (PrimitiveKind_isValid(primitiveType) == 0)
167   {
168     mPrimitiveType = SPATIAL_PRIMITIVEKIND_INVALID;
169     return LIBSBML_INVALID_ATTRIBUTE_VALUE;
170   }
171   else
172   {
173     mPrimitiveType = primitiveType;
174     return LIBSBML_OPERATION_SUCCESS;
175   }
176 }
177 
178 
179 /*
180  * Sets the value of the "primitiveType" attribute of this CSGPrimitive.
181  */
182 int
setPrimitiveType(const std::string & primitiveType)183 CSGPrimitive::setPrimitiveType(const std::string& primitiveType)
184 {
185   if (PrimitiveKind_isValidString(primitiveType.c_str()) == 0)
186   {
187     mPrimitiveType = SPATIAL_PRIMITIVEKIND_INVALID;
188     return LIBSBML_INVALID_ATTRIBUTE_VALUE;
189   }
190   else
191   {
192     mPrimitiveType = PrimitiveKind_fromString(primitiveType.c_str());
193     return LIBSBML_OPERATION_SUCCESS;
194   }
195 }
196 
197 
198 /*
199  * Unsets the value of the "primitiveType" attribute of this CSGPrimitive.
200  */
201 int
unsetPrimitiveType()202 CSGPrimitive::unsetPrimitiveType()
203 {
204   mPrimitiveType = SPATIAL_PRIMITIVEKIND_INVALID;
205   return LIBSBML_OPERATION_SUCCESS;
206 }
207 
208 
209 /*
210  * Returns the XML element name of this CSGPrimitive object.
211  */
212 const std::string&
getElementName() const213 CSGPrimitive::getElementName() const
214 {
215   static const string name = "csgPrimitive";
216   return name;
217 }
218 
219 
220 /*
221  * Returns the libSBML type code for this CSGPrimitive object.
222  */
223 int
getTypeCode() const224 CSGPrimitive::getTypeCode() const
225 {
226   return SBML_SPATIAL_CSGPRIMITIVE;
227 }
228 
229 
230 /*
231  * Predicate returning @c true if all the required attributes for this
232  * CSGPrimitive object have been set.
233  */
234 bool
hasRequiredAttributes() const235 CSGPrimitive::hasRequiredAttributes() const
236 {
237   bool allPresent = CSGNode::hasRequiredAttributes();
238 
239   if (isSetPrimitiveType() == false)
240   {
241     allPresent = false;
242   }
243 
244   return allPresent;
245 }
246 
247 
248 
249 /** @cond doxygenLibsbmlInternal */
250 
251 /*
252  * Write any contained elements
253  */
254 void
writeElements(XMLOutputStream & stream) const255 CSGPrimitive::writeElements(XMLOutputStream& stream) const
256 {
257   CSGNode::writeElements(stream);
258 
259   SBase::writeExtensionElements(stream);
260 }
261 
262 /** @endcond */
263 
264 
265 
266 /** @cond doxygenLibsbmlInternal */
267 
268 /*
269  * Accepts the given SBMLVisitor
270  */
271 bool
accept(SBMLVisitor & v) const272 CSGPrimitive::accept(SBMLVisitor& v) const
273 {
274   return v.visit(*this);
275 }
276 
277 /** @endcond */
278 
279 
280 
281 /** @cond doxygenLibsbmlInternal */
282 
283 /*
284  * Sets the parent SBMLDocument
285  */
286 void
setSBMLDocument(SBMLDocument * d)287 CSGPrimitive::setSBMLDocument(SBMLDocument* d)
288 {
289   CSGNode::setSBMLDocument(d);
290 }
291 
292 /** @endcond */
293 
294 
295 
296 /** @cond doxygenLibsbmlInternal */
297 
298 /*
299  * Enables/disables the given package with this element
300  */
301 void
enablePackageInternal(const std::string & pkgURI,const std::string & pkgPrefix,bool flag)302 CSGPrimitive::enablePackageInternal(const std::string& pkgURI,
303                                     const std::string& pkgPrefix,
304                                     bool flag)
305 {
306   CSGNode::enablePackageInternal(pkgURI, pkgPrefix, flag);
307 }
308 
309 /** @endcond */
310 
311 
312 
313 /** @cond doxygenLibsbmlInternal */
314 
315 /*
316  * Gets the value of the "attributeName" attribute of this CSGPrimitive.
317  */
318 int
getAttribute(const std::string & attributeName,bool & value) const319 CSGPrimitive::getAttribute(const std::string& attributeName,
320                            bool& value) const
321 {
322   int return_value = CSGNode::getAttribute(attributeName, value);
323 
324   return return_value;
325 }
326 
327 /** @endcond */
328 
329 
330 
331 /** @cond doxygenLibsbmlInternal */
332 
333 /*
334  * Gets the value of the "attributeName" attribute of this CSGPrimitive.
335  */
336 int
getAttribute(const std::string & attributeName,int & value) const337 CSGPrimitive::getAttribute(const std::string& attributeName, int& value) const
338 {
339   int return_value = CSGNode::getAttribute(attributeName, value);
340 
341   return return_value;
342 }
343 
344 /** @endcond */
345 
346 
347 
348 /** @cond doxygenLibsbmlInternal */
349 
350 /*
351  * Gets the value of the "attributeName" attribute of this CSGPrimitive.
352  */
353 int
getAttribute(const std::string & attributeName,double & value) const354 CSGPrimitive::getAttribute(const std::string& attributeName,
355                            double& value) const
356 {
357   int return_value = CSGNode::getAttribute(attributeName, value);
358 
359   return return_value;
360 }
361 
362 /** @endcond */
363 
364 
365 
366 /** @cond doxygenLibsbmlInternal */
367 
368 /*
369  * Gets the value of the "attributeName" attribute of this CSGPrimitive.
370  */
371 int
getAttribute(const std::string & attributeName,unsigned int & value) const372 CSGPrimitive::getAttribute(const std::string& attributeName,
373                            unsigned int& value) const
374 {
375   int return_value = CSGNode::getAttribute(attributeName, value);
376 
377   return return_value;
378 }
379 
380 /** @endcond */
381 
382 
383 
384 /** @cond doxygenLibsbmlInternal */
385 
386 /*
387  * Gets the value of the "attributeName" attribute of this CSGPrimitive.
388  */
389 int
getAttribute(const std::string & attributeName,std::string & value) const390 CSGPrimitive::getAttribute(const std::string& attributeName,
391                            std::string& value) const
392 {
393   int return_value = CSGNode::getAttribute(attributeName, value);
394 
395   if (return_value == LIBSBML_OPERATION_SUCCESS)
396   {
397     return return_value;
398   }
399 
400   if (attributeName == "primitiveType")
401   {
402     value = getPrimitiveTypeAsString();
403     return_value = LIBSBML_OPERATION_SUCCESS;
404   }
405 
406   return return_value;
407 }
408 
409 /** @endcond */
410 
411 
412 
413 /** @cond doxygenLibsbmlInternal */
414 
415 /*
416  * Predicate returning @c true if this CSGPrimitive's attribute "attributeName"
417  * is set.
418  */
419 bool
isSetAttribute(const std::string & attributeName) const420 CSGPrimitive::isSetAttribute(const std::string& attributeName) const
421 {
422   bool value = CSGNode::isSetAttribute(attributeName);
423 
424   if (attributeName == "primitiveType")
425   {
426     value = isSetPrimitiveType();
427   }
428 
429   return value;
430 }
431 
432 /** @endcond */
433 
434 
435 
436 /** @cond doxygenLibsbmlInternal */
437 
438 /*
439  * Sets the value of the "attributeName" attribute of this CSGPrimitive.
440  */
441 int
setAttribute(const std::string & attributeName,bool value)442 CSGPrimitive::setAttribute(const std::string& attributeName, bool value)
443 {
444   int return_value = CSGNode::setAttribute(attributeName, value);
445 
446   return return_value;
447 }
448 
449 /** @endcond */
450 
451 
452 
453 /** @cond doxygenLibsbmlInternal */
454 
455 /*
456  * Sets the value of the "attributeName" attribute of this CSGPrimitive.
457  */
458 int
setAttribute(const std::string & attributeName,int value)459 CSGPrimitive::setAttribute(const std::string& attributeName, int value)
460 {
461   int return_value = CSGNode::setAttribute(attributeName, value);
462 
463   return return_value;
464 }
465 
466 /** @endcond */
467 
468 
469 
470 /** @cond doxygenLibsbmlInternal */
471 
472 /*
473  * Sets the value of the "attributeName" attribute of this CSGPrimitive.
474  */
475 int
setAttribute(const std::string & attributeName,double value)476 CSGPrimitive::setAttribute(const std::string& attributeName, double value)
477 {
478   int return_value = CSGNode::setAttribute(attributeName, value);
479 
480   return return_value;
481 }
482 
483 /** @endcond */
484 
485 
486 
487 /** @cond doxygenLibsbmlInternal */
488 
489 /*
490  * Sets the value of the "attributeName" attribute of this CSGPrimitive.
491  */
492 int
setAttribute(const std::string & attributeName,unsigned int value)493 CSGPrimitive::setAttribute(const std::string& attributeName,
494                            unsigned int value)
495 {
496   int return_value = CSGNode::setAttribute(attributeName, value);
497 
498   return return_value;
499 }
500 
501 /** @endcond */
502 
503 
504 
505 /** @cond doxygenLibsbmlInternal */
506 
507 /*
508  * Sets the value of the "attributeName" attribute of this CSGPrimitive.
509  */
510 int
setAttribute(const std::string & attributeName,const std::string & value)511 CSGPrimitive::setAttribute(const std::string& attributeName,
512                            const std::string& value)
513 {
514   int return_value = CSGNode::setAttribute(attributeName, value);
515 
516   if (attributeName == "primitiveType")
517   {
518     return_value = setPrimitiveType(value);
519   }
520 
521   return return_value;
522 }
523 
524 /** @endcond */
525 
526 
527 
528 /** @cond doxygenLibsbmlInternal */
529 
530 /*
531  * Unsets the value of the "attributeName" attribute of this CSGPrimitive.
532  */
533 int
unsetAttribute(const std::string & attributeName)534 CSGPrimitive::unsetAttribute(const std::string& attributeName)
535 {
536   int value = CSGNode::unsetAttribute(attributeName);
537 
538   if (attributeName == "primitiveType")
539   {
540     value = unsetPrimitiveType();
541   }
542 
543   return value;
544 }
545 
546 /** @endcond */
547 
548 
549 
550 /** @cond doxygenLibsbmlInternal */
551 
552 /*
553  * Creates a new object from the next XMLToken on the XMLInputStream
554  */
555 SBase*
createObject(XMLInputStream & stream)556 CSGPrimitive::createObject(XMLInputStream& stream)
557 {
558   SBase* obj = CSGNode::createObject(stream);
559 
560   connectToChild();
561 
562   return obj;
563 }
564 
565 /** @endcond */
566 
567 
568 
569 /** @cond doxygenLibsbmlInternal */
570 
571 /*
572  * Adds the expected attributes for this element
573  */
574 void
addExpectedAttributes(ExpectedAttributes & attributes)575 CSGPrimitive::addExpectedAttributes(ExpectedAttributes& attributes)
576 {
577   CSGNode::addExpectedAttributes(attributes);
578 
579   attributes.add("primitiveType");
580 }
581 
582 /** @endcond */
583 
584 
585 
586 /** @cond doxygenLibsbmlInternal */
587 
588 /*
589  * Reads the expected attributes into the member data variables
590  */
591 void
readAttributes(const XMLAttributes & attributes,const ExpectedAttributes & expectedAttributes)592 CSGPrimitive::readAttributes(const XMLAttributes& attributes,
593                              const ExpectedAttributes& expectedAttributes)
594 {
595   unsigned int level = getLevel();
596   unsigned int version = getVersion();
597   unsigned int pkgVersion = getPackageVersion();
598   unsigned int numErrs;
599   bool assigned = false;
600   SBMLErrorLog* log = getErrorLog();
601 
602   CSGNode::readAttributes(attributes, expectedAttributes);
603 
604   if (log)
605   {
606     numErrs = log->getNumErrors();
607 
608     for (int n = numErrs-1; n >= 0; n--)
609     {
610       if (log->getError(n)->getErrorId() == UnknownPackageAttribute)
611       {
612         const std::string details = log->getError(n)->getMessage();
613         log->remove(UnknownPackageAttribute);
614         log->logPackageError("spatial", SpatialCSGPrimitiveAllowedAttributes,
615           pkgVersion, level, version, details, getLine(), getColumn());
616       }
617       else if (log->getError(n)->getErrorId() == UnknownCoreAttribute)
618       {
619         const std::string details = log->getError(n)->getMessage();
620         log->remove(UnknownCoreAttribute);
621         log->logPackageError("spatial",
622           SpatialCSGPrimitiveAllowedCoreAttributes, pkgVersion, level, version,
623             details, getLine(), getColumn());
624       }
625     }
626   }
627 
628   //
629   // primitiveType enum (use = "required" )
630   //
631 
632   std::string primitiveType;
633   assigned = attributes.readInto("primitiveType", primitiveType);
634 
635   if (assigned == true)
636   {
637     if (primitiveType.empty() == true)
638     {
639       logEmptyString(primitiveType, level, version, "<csgPrimitive>");
640     }
641     else
642     {
643       mPrimitiveType = PrimitiveKind_fromString(primitiveType.c_str());
644 
645       if (PrimitiveKind_isValid(mPrimitiveType) == 0)
646       {
647         std::string msg = "The primitiveType on the <csgPrimitive> ";
648 
649         if (isSetId())
650         {
651           msg += "with id '" + getId() + "'";
652         }
653 
654         msg += "is '" + primitiveType + "', which is not a valid option.";
655 
656         log->logPackageError("spatial",
657           SpatialCSGPrimitivePrimitiveTypeMustBePrimitiveKindEnum, pkgVersion,
658             level, version, msg, getLine(), getColumn());
659       }
660     }
661   }
662   else
663   {
664     std::string message = "Spatial attribute 'primitiveType' is missing.";
665     log->logPackageError("spatial", SpatialCSGPrimitiveAllowedAttributes,
666       pkgVersion, level, version, message, getLine(), getColumn());
667   }
668 }
669 
670 /** @endcond */
671 
672 
673 
674 /** @cond doxygenLibsbmlInternal */
675 
676 /*
677  * Writes the attributes to the stream
678  */
679 void
writeAttributes(XMLOutputStream & stream) const680 CSGPrimitive::writeAttributes(XMLOutputStream& stream) const
681 {
682   CSGNode::writeAttributes(stream);
683 
684   if (isSetPrimitiveType() == true)
685   {
686     stream.writeAttribute("primitiveType", getPrefix(),
687       PrimitiveKind_toString(mPrimitiveType));
688   }
689 
690   SBase::writeExtensionAttributes(stream);
691 }
692 
693 /** @endcond */
694 
695 
696 
697 
698 #endif /* __cplusplus */
699 
700 
701 /*
702  * Creates a new CSGPrimitive_t using the given SBML Level, Version and
703  * &ldquo;spatial&rdquo; package version.
704  */
705 LIBSBML_EXTERN
706 CSGPrimitive_t *
CSGPrimitive_create(unsigned int level,unsigned int version,unsigned int pkgVersion)707 CSGPrimitive_create(unsigned int level,
708                     unsigned int version,
709                     unsigned int pkgVersion)
710 {
711   return new CSGPrimitive(level, version, pkgVersion);
712 }
713 
714 
715 /*
716  * Creates and returns a deep copy of this CSGPrimitive_t object.
717  */
718 LIBSBML_EXTERN
719 CSGPrimitive_t*
CSGPrimitive_clone(const CSGPrimitive_t * csgp)720 CSGPrimitive_clone(const CSGPrimitive_t* csgp)
721 {
722   if (csgp != NULL)
723   {
724     return static_cast<CSGPrimitive_t*>(csgp->clone());
725   }
726   else
727   {
728     return NULL;
729   }
730 }
731 
732 
733 /*
734  * Frees this CSGPrimitive_t object.
735  */
736 LIBSBML_EXTERN
737 void
CSGPrimitive_free(CSGPrimitive_t * csgp)738 CSGPrimitive_free(CSGPrimitive_t* csgp)
739 {
740   if (csgp != NULL)
741   {
742     delete csgp;
743   }
744 }
745 
746 
747 /*
748  * Returns the value of the "primitiveType" attribute of this CSGPrimitive_t.
749  */
750 LIBSBML_EXTERN
751 PrimitiveKind_t
CSGPrimitive_getPrimitiveType(const CSGPrimitive_t * csgp)752 CSGPrimitive_getPrimitiveType(const CSGPrimitive_t * csgp)
753 {
754   if (csgp == NULL)
755   {
756     return SPATIAL_PRIMITIVEKIND_INVALID;
757   }
758 
759   return csgp->getPrimitiveType();
760 }
761 
762 
763 /*
764  * Returns the value of the "primitiveType" attribute of this CSGPrimitive_t.
765  */
766 LIBSBML_EXTERN
767 char *
CSGPrimitive_getPrimitiveTypeAsString(const CSGPrimitive_t * csgp)768 CSGPrimitive_getPrimitiveTypeAsString(const CSGPrimitive_t * csgp)
769 {
770   return (char*)(PrimitiveKind_toString(csgp->getPrimitiveType()));
771 }
772 
773 
774 /*
775  * Predicate returning @c 1 (true) if this CSGPrimitive_t's "primitiveType"
776  * attribute is set.
777  */
778 LIBSBML_EXTERN
779 int
CSGPrimitive_isSetPrimitiveType(const CSGPrimitive_t * csgp)780 CSGPrimitive_isSetPrimitiveType(const CSGPrimitive_t * csgp)
781 {
782   return (csgp != NULL) ? static_cast<int>(csgp->isSetPrimitiveType()) : 0;
783 }
784 
785 
786 /*
787  * Sets the value of the "primitiveType" attribute of this CSGPrimitive_t.
788  */
789 LIBSBML_EXTERN
790 int
CSGPrimitive_setPrimitiveType(CSGPrimitive_t * csgp,PrimitiveKind_t primitiveType)791 CSGPrimitive_setPrimitiveType(CSGPrimitive_t * csgp,
792                               PrimitiveKind_t primitiveType)
793 {
794   return (csgp != NULL) ? csgp->setPrimitiveType(primitiveType) :
795     LIBSBML_INVALID_OBJECT;
796 }
797 
798 
799 /*
800  * Sets the value of the "primitiveType" attribute of this CSGPrimitive_t.
801  */
802 LIBSBML_EXTERN
803 int
CSGPrimitive_setPrimitiveTypeAsString(CSGPrimitive_t * csgp,const char * primitiveType)804 CSGPrimitive_setPrimitiveTypeAsString(CSGPrimitive_t * csgp,
805                                       const char * primitiveType)
806 {
807   return (csgp != NULL) ? csgp->setPrimitiveType(primitiveType):
808     LIBSBML_INVALID_OBJECT;
809 }
810 
811 
812 /*
813  * Unsets the value of the "primitiveType" attribute of this CSGPrimitive_t.
814  */
815 LIBSBML_EXTERN
816 int
CSGPrimitive_unsetPrimitiveType(CSGPrimitive_t * csgp)817 CSGPrimitive_unsetPrimitiveType(CSGPrimitive_t * csgp)
818 {
819   return (csgp != NULL) ? csgp->unsetPrimitiveType() : LIBSBML_INVALID_OBJECT;
820 }
821 
822 
823 /*
824  * Predicate returning @c 1 (true) if all the required attributes for this
825  * CSGPrimitive_t object have been set.
826  */
827 LIBSBML_EXTERN
828 int
CSGPrimitive_hasRequiredAttributes(const CSGPrimitive_t * csgp)829 CSGPrimitive_hasRequiredAttributes(const CSGPrimitive_t * csgp)
830 {
831   return (csgp != NULL) ? static_cast<int>(csgp->hasRequiredAttributes()) : 0;
832 }
833 
834 
835 
836 
837 LIBSBML_CPP_NAMESPACE_END
838 
839 
840