1 /**
2  * @file    GradientBase.h
3  * @brief   abstract base class for gradient definitions
4  * @author  Ralph Gauges
5  * @author  Frank T. Bergmann
6  *
7  * <!--------------------------------------------------------------------------
8  * This file is part of libSBML.  Please visit http://sbml.org for more
9  * information about SBML, and the latest version of libSBML.
10  *
11  * Copyright (C) 2020 jointly by the following organizations:
12  *     1. California Institute of Technology, Pasadena, CA, USA
13  *     2. University of Heidelberg, Heidelberg, Germany
14  *     3. University College London, London, UK
15  *
16  * Copyright (C) 2019 jointly by the following organizations:
17  *     1. California Institute of Technology, Pasadena, CA, USA
18  *     2. University of Heidelberg, Heidelberg, Germany
19  *
20  * Copyright (C) 2013-2018 jointly by the following organizations:
21  *     1. California Institute of Technology, Pasadena, CA, USA
22  *     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
23  *     3. University of Heidelberg, Heidelberg, Germany
24  *
25  * Copyright (C) 2011-2013 jointly by the following organizations:
26  *     1. California Institute of Technology, Pasadena, CA, USA
27  *     2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
28  *
29  * Copyright 2010 Ralph Gauges
30  *     Group for the modeling of biological processes
31  *     University of Heidelberg
32  *     Im Neuenheimer Feld 267
33  *     69120 Heidelberg
34  *     Germany
35  *
36  * This library is free software; you can redistribute it and/or modify it
37  * under the terms of the GNU Lesser General Public License as published by the
38  * Free Software Foundation. A copy of the license agreement is provided in the
39  * file named "LICENSE.txt" included with this software distribution and also
40  * available online as http://sbml.org/software/libsbml/license.html
41  * ------------------------------------------------------------------------ -->
42  *
43  * @class GradientBase
44  * @sbmlbrief{render} Abstract base class for linear and radial gradients.
45  *
46  * The base class implements common structures to both gradient classes.
47  * Both gradients have an id attribute which is used to reference a gradient
48  * within other render extension constructs. The id of a gradient can be used
49  * to define the fill style of 2D objects like e.g. rectangles.
50  *
51  * Further, both gradient classes have a ListOfGradientStops objects which holds
52  * the GradientStop objects that define the gradient and both classes have an
53  * attribute called spreadMethod which defines how a gradient is applied to an
54  * object.
55  */
56 
57 /**
58  * <!-- ~ ~ ~ ~ ~ Start of common documentation strings ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
59  * The following text is used as common documentation blocks copied multiple
60  * times elsewhere in this file. The use of @class is a hack needed because
61  * Doxygen's @copydetails command has limited functionality. Symbols
62  * beginning with "doc_" are marked as ignored in our Doxygen configuration.
63  * ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -->
64  *
65  *
66  * @class doc_gradientbase_spreadMethod
67  *
68  * @par
69  * The attribute "spreadMethod" on a GradientBase object is used by GradientBase
70  * elements to decide how gradients propagate over the whole element they are
71  * applied to.  The following are the allowable values for "spreadMethod":
72  * <ul>
73  * <li> @c "pad", the gradient color at the endpoint of the vector defines how
74  * the gradient is continued beyond that point (default value).
75  *
76  * <li> @c "reflect", the gradient continues from end to start and then from
77  * start to end again and again.
78  *
79  * <li> @c "repeat", the gradient pattern is repeated from start to end over
80  * and over again.
81  *
82  * </ul>
83  */
84 
85 
86 #ifndef GradientBase_H__
87 #define GradientBase_H__
88 
89 #include <sbml/common/extern.h>
90 #include <sbml/common/sbmlfwd.h>
91 #include <sbml/packages/render/common/renderfwd.h>
92 
93 #include <sbml/xml/XMLNode.h>
94 
95 #ifdef __cplusplus
96 
97 
98 #include <string>
99 
100 
101 #include <sbml/SBase.h>
102 #include <sbml/packages/render/extension/RenderExtension.h>
103 #include <sbml/packages/render/sbml/ListOfGradientStops.h>
104 #include <sbml/packages/render/sbml/GradientStop.h>
105 
106 
107 LIBSBML_CPP_NAMESPACE_BEGIN
108 
109 
110 class LinearGradient;
111 class RadialGradient;
112 
113 class LIBSBML_EXTERN GradientBase : public SBase
114 {
115 public:
116   /** @cond doxygenLibsbmlInternal */
117   enum SPREADMETHOD
118   {
119     PAD,
120     REFLECT,
121     REPEAT,
122     INVALID
123   };
124   /** @endcond */
125 
126 protected:
127   /** @cond doxygenLibsbmlInternal */
128 
129   int mSpreadMethod;
130   ListOfGradientStops mGradientStops;
131   std::string mElementName;
132 
133   /** @endcond */
134 
135 public:
136 
137   /**
138    * Creates a new GradientBase using the given SBML Level, Version and
139    * &ldquo;render&rdquo; package version.
140    *
141    * @param level an unsigned int, the SBML Level to assign to this
142    * GradientBase.
143    *
144    * @param version an unsigned int, the SBML Version to assign to this
145    * GradientBase.
146    *
147    * @param pkgVersion an unsigned int, the SBML Render Version to assign to
148    * this GradientBase.
149    *
150    * @copydetails doc_note_setting_lv_pkg
151    */
152   GradientBase(unsigned int level = RenderExtension::getDefaultLevel(),
153                unsigned int version = RenderExtension::getDefaultVersion(),
154                unsigned int pkgVersion =
155                  RenderExtension::getDefaultPackageVersion());
156 
157 
158   /**
159    * Creates a new GradientBase using the given RenderPkgNamespaces object.
160    *
161    * @copydetails doc_what_are_sbml_package_namespaces
162    *
163    * @param renderns the RenderPkgNamespaces object.
164    *
165    * @copydetails doc_note_setting_lv_pkg
166    */
167   GradientBase(RenderPkgNamespaces *renderns);
168 
169 
170   /**
171    * Creates a new GradientBase object from the given XMLNode object.
172    * The XMLNode object has to contain a valid XML representation of a
173    * GradientBase object as defined in the render extension specification.
174    * This method is normally called when render information is read from a file and
175    * should normally not have to be called explicitly.
176    *
177    * @param node the XMLNode object reference that describes the GradientBase
178    * object to be instantiated.
179    *
180    * @param l2version an integer indicating the version of SBML Level&nbsp;2
181    */
182   GradientBase(const XMLNode& node, unsigned int l2version=4);
183 
184 
185 #ifndef OMIT_DEPRECATED
186   /**
187    * Constructor which creates a GradientBase with no gradient stops.
188    * The spreadMethod attribute is set to GradientBase::PAD and the id is
189    * set to the given value.
190    * This object is not valid until it gets at least two gradient stops.
191    *
192    * @param renderns the SBMLNamespaces object for the SBML "render" package
193    * @param id The id for the gradient definition object
194    *
195    * @copydetails doc_warning_deprecated_constructor
196    */
197   GradientBase(RenderPkgNamespaces* renderns, const std::string& id);
198 #endif // OMIT_DEPRECATED
199 
200   /**
201    * Copy constructor for GradientBase.
202    *
203    * @param orig the GradientBase instance to copy.
204    */
205   GradientBase(const GradientBase& orig);
206 
207 
208   /**
209    * Assignment operator for GradientBase.
210    *
211    * @param rhs the GradientBase object whose values are to be used as the
212    * basis of the assignment.
213    */
214   GradientBase& operator=(const GradientBase& rhs);
215 
216 
217   /**
218    * Creates and returns a deep copy of this GradientBase object.
219    *
220    * @return a (deep) copy of this GradientBase object.
221    */
222   virtual GradientBase* clone() const = 0;
223 
224 
225   /**
226    * Destructor for GradientBase.
227    */
228   virtual ~GradientBase();
229 
230 
231   /**
232    * Returns the value of the "id" attribute of this GradientBase.
233    *
234    * @return the value of the "id" attribute of this GradientBase as a string.
235    */
236   virtual const std::string& getId() const;
237 
238 
239   /**
240    * Returns the value of the "name" attribute of this GradientBase.
241    *
242    * @return the value of the "name" attribute of this GradientBase as a
243    * string.
244    */
245   virtual const std::string& getName() const;
246 
247 
248   /**
249    * Returns the value of the "spreadMethod" attribute of this GradientBase.
250    *
251    * @return the value of the "spreadMethod" attribute of this GradientBase as
252    * a @if clike GradientSpreadMethod_t@else int@endif@~.
253    *
254    * @copydetails doc_gradientbase_spreadMethod
255    * @if clike The value is drawn from the enumeration
256    * GradientSpreadMethod_t.@endif@~
257    * The possible values returned by this method are:
258    * @li @sbmlconstant{GRADIENT_SPREADMETHOD_PAD, GradientSpreadMethod_t}
259    * @li @sbmlconstant{GRADIENT_SPREADMETHOD_REFLECT, GradientSpreadMethod_t}
260    * @li @sbmlconstant{GRADIENT_SPREADMETHOD_REPEAT, GradientSpreadMethod_t}
261    * @li @sbmlconstant{GRADIENT_SPREAD_METHOD_INVALID, GradientSpreadMethod_t}
262    */
263   int getSpreadMethod() const;
264 
265 
266   /**
267    * Returns the value of the "spreadMethod" attribute of this GradientBase.
268    *
269    * @return the value of the "spreadMethod" attribute of this GradientBase as
270    * a string.
271    *
272    * @copydetails doc_gradientbase_spreadMethod
273    * The possible values returned by this method are:
274    * @li @c "pad"
275    * @li @c "reflect"
276    * @li @c "repeat"
277    * @li @c "invalid"
278    * @li @c "(Unknown GradientSpreadMethod value)"
279    */
280   std::string getSpreadMethodAsString() const;
281 
282 
283   /**
284    * Returns the value of the "spreadMethod" attribute of this GradientBase.
285    *
286    * @return the value of the "spreadMethod" attribute of this GradientBase as
287    * a string.
288    *
289    * @copydetails doc_gradientbase_spreadMethod
290    * The possible values returned by this method are:
291    * @li @c "pad"
292    * @li @c "reflect"
293    * @li @c "repeat"
294    * @li @c "invalid"
295    */
296   std::string getSpreadMethodString() const;
297 
298 
299   /**
300    * Predicate returning @c true if this GradientBase's "id" attribute is set.
301    *
302    * @return @c true if this GradientBase's "id" attribute has been set,
303    * otherwise @c false is returned.
304    */
305   virtual bool isSetId() const;
306 
307 
308   /**
309    * Predicate returning @c true if this GradientBase's "name" attribute is
310    * set.
311    *
312    * @return @c true if this GradientBase's "name" attribute has been set,
313    * otherwise @c false is returned.
314    */
315   virtual bool isSetName() const;
316 
317 
318   /**
319    * Predicate returning @c true if this GradientBase's "spreadMethod"
320    * attribute is set.
321    *
322    * @return @c true if this GradientBase's "spreadMethod" attribute has been
323    * set, otherwise @c false is returned.
324    *
325    * @copydetails doc_gradientbase_spreadMethod
326    */
327   bool isSetSpreadMethod() const;
328 
329 
330   /**
331    * Sets the value of the "id" attribute of this GradientBase.
332    *
333    * @param id the string value of the "id" attribute to be set.
334    *
335    * @copydetails doc_returns_success_code
336    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
337    * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE,
338    * OperationReturnValues_t}
339    *
340    * Calling this function with @p id = @c NULL or an empty string is
341    * equivalent to calling unsetId().
342    */
343   virtual int setId(const std::string& id);
344 
345 
346   /**
347    * Sets the value of the "name" attribute of this GradientBase.
348    *
349    * @param name the string value of the "name" attribute to be set.
350    *
351    * @copydetails doc_returns_one_success_code
352    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
353    *
354    * Calling this function with @p name = @c NULL or an empty string is
355    * equivalent to calling unsetName().
356    */
357   virtual int setName(const std::string& name);
358 
359 
360   /**
361    * Sets the value of the "spreadMethod" attribute of this GradientBase.
362    *
363    * @param spreadMethod @if clike GradientSpreadMethod_t@else int@endif@~ value
364    * of the "spreadMethod" attribute to be set.
365    *
366    * @copydetails doc_returns_success_code
367    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
368    * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE,
369    * OperationReturnValues_t}
370    *
371    * @copydetails doc_gradientbase_spreadMethod
372    */
373   void setSpreadMethod(SPREADMETHOD spreadMethod);
374 
375 
376   /**
377    * Sets the value of the "spreadMethod" attribute of this GradientBase.
378    *
379    * @param spreadMethod @if clike GradientSpreadMethod_t@else int@endif@~ value
380    * of the "spreadMethod" attribute to be set.
381    *
382    * @copydetails doc_returns_success_code
383    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
384    * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE,
385    * OperationReturnValues_t}
386    *
387    * @copydetails doc_gradientbase_spreadMethod
388    */
389   int setSpreadMethod(const GradientSpreadMethod_t spreadMethod);
390 
391 
392   /**
393    * Sets the value of the "spreadMethod" attribute of this GradientBase.
394    *
395    * @param spreadMethod std::string& of the "spreadMethod" attribute to be
396    * set.
397    *
398    * @copydetails doc_returns_success_code
399    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
400    * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE,
401    * OperationReturnValues_t}
402    *
403    * @copydetails doc_gradientbase_spreadMethod
404    */
405   int setSpreadMethod(const std::string& spreadMethod);
406 
407 
408   /**
409    * Unsets the value of the "id" attribute of this GradientBase.
410    *
411    * @copydetails doc_returns_success_code
412    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
413    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
414    */
415   virtual int unsetId();
416 
417 
418   /**
419    * Unsets the value of the "name" attribute of this GradientBase.
420    *
421    * @copydetails doc_returns_success_code
422    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
423    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
424    */
425   virtual int unsetName();
426 
427 
428   /**
429    * Unsets the value of the "spreadMethod" attribute of this GradientBase.
430    *
431    * @copydetails doc_returns_one_success_code
432    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
433    *
434    * @copydetails doc_gradientbase_spreadMethod
435    */
436   int unsetSpreadMethod();
437 
438 
439   /**
440    * Returns the ListOfGradientStops from this GradientBase.
441    *
442    * @return the ListOfGradientStops from this GradientBase.
443    *
444    * @copydetails doc_returned_unowned_pointer
445    *
446    * @see addGradientStop(const GradientStop* object)
447    * @see createGradientStop()
448    * @see getGradientStop(const std::string& sid)
449    * @see getGradientStop(unsigned int n)
450    * @see getNumGradientStops()
451    * @see removeGradientStop(const std::string& sid)
452    * @see removeGradientStop(unsigned int n)
453    */
454   const ListOfGradientStops* getListOfGradientStops() const;
455 
456 
457   /**
458    * Returns the ListOfGradientStops from this GradientBase.
459    *
460    * @return the ListOfGradientStops from this GradientBase.
461    *
462    * @copydetails doc_returned_unowned_pointer
463    *
464    * @see addGradientStop(const GradientStop* object)
465    * @see createGradientStop()
466    * @see getGradientStop(const std::string& sid)
467    * @see getGradientStop(unsigned int n)
468    * @see getNumGradientStops()
469    * @see removeGradientStop(const std::string& sid)
470    * @see removeGradientStop(unsigned int n)
471    */
472   ListOfGradientStops* getListOfGradientStops();
473 
474 
475   /**
476    * Get the nth GradientStop from the GradientBase.
477    *
478    * @param n an unsigned int representing the index of the GradientStop to
479    * retrieve.
480    *
481    * @return the nth GradientStop in the ListOfGradientStops within this
482    * GradientBase.
483    * If the index @p n is invalid, @c NULL is returned.
484    *
485    * @copydetails doc_returned_unowned_pointer
486    *
487    * @see addGradientStop(const GradientStop* object)
488    * @see createGradientStop()
489    * @see getGradientStop(const std::string& sid)
490    * @see getNumGradientStops()
491    * @see removeGradientStop(const std::string& sid)
492    * @see removeGradientStop(unsigned int n)
493    */
494   GradientStop* getGradientStop(unsigned int n);
495 
496 
497   /**
498   * Get the GradientStop with the given id from the GradientBase.
499   *
500   * @param sid the id of the GradientStop to retrieve.
501   *
502   * @return the GradientStop in the ListOfGradientStops with
503   * the given @p id from this GradientBase.
504   * If no such GradientStop exists, @c NULL is returned.
505   *
506   * @copydetails doc_returned_unowned_pointer
507   *
508   * @see addGradientStop(const GradientStop* object)
509   * @see createGradientStop()
510   * @see getGradientStop(unsigned int n)
511   * @see getNumGradientStops()
512   * @see removeGradientStop(const std::string& sid)
513   * @see removeGradientStop(unsigned int n)
514   */
515   GradientStop* getGradientStop(const std::string& sid);
516 
517 
518   /**
519    * Get a GradientStop from the GradientBase.
520    *
521    * @param n an unsigned int representing the index of the GradientStop to
522    * retrieve.
523    *
524    * @return the nth GradientStop in the ListOfGradientStops within this
525    * GradientBase.
526    * If the index @p n is invalid, @c NULL is returned.
527    *
528    * @copydetails doc_returned_unowned_pointer
529    *
530    * @see addGradientStop(const GradientStop* object)
531    * @see createGradientStop()
532    * @see getGradientStop(const std::string& sid)
533    * @see getNumGradientStops()
534    * @see removeGradientStop(const std::string& sid)
535    * @see removeGradientStop(unsigned int n)
536    */
537   const GradientStop* getGradientStop(unsigned int n) const;
538 
539 
540   /**
541    * Adds a copy of the given GradientStop to this GradientBase.
542    *
543    * @param gs the GradientStop object to add.
544    *
545    * @copydetails doc_returns_success_code
546    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
547    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
548    * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
549    * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t}
550    * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t}
551    * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
552    * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t}
553    *
554    * @copydetails doc_note_object_is_copied
555    *
556    * @see createGradientStop()
557    * @see getGradientStop(const std::string& sid)
558    * @see getGradientStop(unsigned int n)
559    * @see getNumGradientStops()
560    * @see removeGradientStop(const std::string& sid)
561    * @see removeGradientStop(unsigned int n)
562    */
563   int addGradientStop(const GradientStop* gs);
564 
565 
566   /**
567    * Get the number of GradientStop objects in this GradientBase.
568    *
569    * @return the number of GradientStop objects in this GradientBase.
570    *
571    *
572    * @see addGradientStop(const GradientStop* object)
573    * @see createGradientStop()
574    * @see getGradientStop(const std::string& sid)
575    * @see getGradientStop(unsigned int n)
576    * @see removeGradientStop(const std::string& sid)
577    * @see removeGradientStop(unsigned int n)
578    */
579   unsigned int getNumGradientStops() const;
580 
581 
582   /**
583    * Creates a new GradientStop object, adds it to this GradientBase object and
584    * returns the GradientStop object created.
585    *
586    * @return a new GradientStop object instance.
587    *
588    * @copydetails doc_returned_unowned_pointer
589    *
590    * @see addGradientStop(const GradientStop* object)
591    * @see getGradientStop(const std::string& sid)
592    * @see getGradientStop(unsigned int n)
593    * @see getNumGradientStops()
594    * @see removeGradientStop(const std::string& sid)
595    * @see removeGradientStop(unsigned int n)
596    */
597   GradientStop* createGradientStop();
598 
599 
600   /**
601    * Removes the nth GradientStop from this GradientBase and returns a pointer
602    * to it.
603    *
604    * @param n an unsigned int representing the index of the GradientStop to
605    * remove.
606    *
607    * @return a pointer to the nth GradientStop in this GradientBase.
608    *
609    * @copydetails doc_warning_returns_owned_pointer
610    *
611    * @see addGradientStop(const GradientStop* object)
612    * @see createGradientStop()
613    * @see getGradientStop(const std::string& sid)
614    * @see getGradientStop(unsigned int n)
615    * @see getNumGradientStops()
616    * @see removeGradientStop(const std::string& sid)
617    */
618   GradientStop* removeGradientStop(unsigned int n);
619 
620 
621   /**
622   * Removes the GradientStop with the given id from this GradientBase
623   * and returns a pointer to it.
624   *
625   * @param sid the id of the GradientStop to remove.
626   *
627   * @return a pointer to the nth GradientStop in this GradientBase.
628   *
629   * @copydetails doc_warning_returns_owned_pointer
630   *
631   * @see addGradientStop(const GradientStop* object)
632   * @see createGradientStop()
633   * @see getGradientStop(const std::string& sid)
634   * @see getGradientStop(unsigned int n)
635   * @see getNumGradientStops()
636   * @see removeGradientStop(unsigned int n)
637   */
638   GradientStop* removeGradientStop(const std::string& sid);
639 
640 
641   /**
642    * Predicate returning @c true if this abstract GradientBase is of type
643    * LinearGradient
644    *
645    * @return @c true if this abstract GradientBase is of type LinearGradient,
646    * @c false otherwise
647    */
648   virtual bool isLinearGradient() const;
649 
650 
651   /**
652    * Predicate returning @c true if this abstract GradientBase is of type
653    * RadialGradient
654    *
655    * @return @c true if this abstract GradientBase is of type RadialGradient,
656    * @c false otherwise
657    */
658   virtual bool isRadialGradient() const;
659 
660 
661   /**
662    * Returns the XML element name of this GradientBase object.
663    *
664    * For GradientBase, the XML element name is always @c "gradientBase".
665    *
666    * @return the name of this element, i.e. @c "gradientBase".
667    */
668   virtual const std::string& getElementName() const;
669 
670 
671 
672   /** @cond doxygenLibsbmlInternal */
673 
674   /**
675    * Sets the XML name of this GradientBase object.
676    */
677   virtual void setElementName(const std::string& name);
678 
679   /** @endcond */
680 
681 
682   /**
683    * Returns the libSBML type code for this GradientBase object.
684    *
685    * @copydetails doc_what_are_typecodes
686    *
687    * @return the SBML type code for this object:
688    * @sbmlconstant{SBML_RENDER_GRADIENTDEFINITION, SBMLRenderTypeCode_t}.
689    *
690    * @copydetails doc_warning_typecodes_not_unique
691    *
692    * @see getElementName()
693    * @see getPackageName()
694    */
695   virtual int getTypeCode() const;
696 
697 
698   /**
699    * Predicate returning @c true if all the required attributes for this
700    * GradientBase object have been set.
701    *
702    * @return @c true to indicate that all the required attributes of this
703    * GradientBase have been set, otherwise @c false is returned.
704    *
705    *
706    * @note The required attributes for the GradientBase object are:
707    * @li "id"
708    */
709   virtual bool hasRequiredAttributes() const;
710 
711 
712 
713   /** @cond doxygenLibsbmlInternal */
714 
715   /**
716    * Write any contained elements
717    */
718   virtual void writeElements(XMLOutputStream& stream) const;
719 
720   /** @endcond */
721 
722 
723 
724   /** @cond doxygenLibsbmlInternal */
725 
726   /**
727    * Accepts the given SBMLVisitor
728    */
729   virtual bool accept(SBMLVisitor& v) const;
730 
731   /** @endcond */
732 
733 
734 
735   /** @cond doxygenLibsbmlInternal */
736 
737   /**
738    * Sets the parent SBMLDocument
739    */
740   virtual void setSBMLDocument(SBMLDocument* d);
741 
742   /** @endcond */
743 
744 
745 
746   /** @cond doxygenLibsbmlInternal */
747 
748   /**
749    * Connects to child elements
750    */
751   virtual void connectToChild();
752 
753   /** @endcond */
754 
755 
756 
757   /** @cond doxygenLibsbmlInternal */
758 
759   /**
760    * Enables/disables the given package with this element
761    */
762   virtual void enablePackageInternal(const std::string& pkgURI,
763                                      const std::string& pkgPrefix,
764                                      bool flag);
765 
766   /** @endcond */
767 
768 
769   /**
770    * Creates an XMLNode object from this GradientBase object.
771    *
772    * @return the XMLNode with the XML representation for the
773    * GradientBase object.
774    *
775    * This method is purely abstract and needs to be implemented
776    * by derived classes.
777    */
778   virtual XMLNode toXML() const=0;
779 
780   #ifndef SWIG
781 
782 
783 
784   /** @cond doxygenLibsbmlInternal */
785 
786   /**
787    * Returns the value of the "attributeName" attribute of this GradientBase.
788    *
789    * @param attributeName, the name of the attribute to retrieve.
790    *
791    * @param value, the address of the value to record.
792    *
793    * @copydetails doc_returns_success_code
794    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
795    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
796    */
797   virtual int getAttribute(const std::string& attributeName, bool& value)
798     const;
799 
800   /** @endcond */
801 
802 
803 
804   /** @cond doxygenLibsbmlInternal */
805 
806   /**
807    * Returns the value of the "attributeName" attribute of this GradientBase.
808    *
809    * @param attributeName, the name of the attribute to retrieve.
810    *
811    * @param value, the address of the value to record.
812    *
813    * @copydetails doc_returns_success_code
814    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
815    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
816    */
817   virtual int getAttribute(const std::string& attributeName, int& value) const;
818 
819   /** @endcond */
820 
821 
822 
823   /** @cond doxygenLibsbmlInternal */
824 
825   /**
826    * Returns the value of the "attributeName" attribute of this GradientBase.
827    *
828    * @param attributeName, the name of the attribute to retrieve.
829    *
830    * @param value, the address of the value to record.
831    *
832    * @copydetails doc_returns_success_code
833    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
834    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
835    */
836   virtual int getAttribute(const std::string& attributeName,
837                            double& value) const;
838 
839   /** @endcond */
840 
841 
842 
843   /** @cond doxygenLibsbmlInternal */
844 
845   /**
846    * Returns the value of the "attributeName" attribute of this GradientBase.
847    *
848    * @param attributeName, the name of the attribute to retrieve.
849    *
850    * @param value, the address of the value to record.
851    *
852    * @copydetails doc_returns_success_code
853    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
854    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
855    */
856   virtual int getAttribute(const std::string& attributeName,
857                            unsigned int& value) const;
858 
859   /** @endcond */
860 
861 
862 
863   /** @cond doxygenLibsbmlInternal */
864 
865   /**
866    * Returns the value of the "attributeName" attribute of this GradientBase.
867    *
868    * @param attributeName, the name of the attribute to retrieve.
869    *
870    * @param value, the address of the value to record.
871    *
872    * @copydetails doc_returns_success_code
873    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
874    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
875    */
876   virtual int getAttribute(const std::string& attributeName,
877                            std::string& value) const;
878 
879   /** @endcond */
880 
881 
882 
883   /** @cond doxygenLibsbmlInternal */
884 
885   /**
886    * Predicate returning @c true if this GradientBase's attribute
887    * "attributeName" is set.
888    *
889    * @param attributeName, the name of the attribute to query.
890    *
891    * @return @c true if this GradientBase's attribute "attributeName" has been
892    * set, otherwise @c false is returned.
893    */
894   virtual bool isSetAttribute(const std::string& attributeName) const;
895 
896   /** @endcond */
897 
898 
899 
900   /** @cond doxygenLibsbmlInternal */
901 
902   /**
903    * Sets the value of the "attributeName" attribute of this GradientBase.
904    *
905    * @param attributeName, the name of the attribute to set.
906    *
907    * @param value, the value of the attribute to set.
908    *
909    * @copydetails doc_returns_success_code
910    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
911    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
912    */
913   virtual int setAttribute(const std::string& attributeName, bool value);
914 
915   /** @endcond */
916 
917 
918 
919   /** @cond doxygenLibsbmlInternal */
920 
921   /**
922    * Sets the value of the "attributeName" attribute of this GradientBase.
923    *
924    * @param attributeName, the name of the attribute to set.
925    *
926    * @param value, the value of the attribute to set.
927    *
928    * @copydetails doc_returns_success_code
929    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
930    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
931    */
932   virtual int setAttribute(const std::string& attributeName, int value);
933 
934   /** @endcond */
935 
936 
937 
938   /** @cond doxygenLibsbmlInternal */
939 
940   /**
941    * Sets the value of the "attributeName" attribute of this GradientBase.
942    *
943    * @param attributeName, the name of the attribute to set.
944    *
945    * @param value, the value of the attribute to set.
946    *
947    * @copydetails doc_returns_success_code
948    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
949    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
950    */
951   virtual int setAttribute(const std::string& attributeName, double value);
952 
953   /** @endcond */
954 
955 
956 
957   /** @cond doxygenLibsbmlInternal */
958 
959   /**
960    * Sets the value of the "attributeName" attribute of this GradientBase.
961    *
962    * @param attributeName, the name of the attribute to set.
963    *
964    * @param value, the value of the attribute to set.
965    *
966    * @copydetails doc_returns_success_code
967    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
968    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
969    */
970   virtual int setAttribute(const std::string& attributeName,
971                            unsigned int value);
972 
973   /** @endcond */
974 
975 
976 
977   /** @cond doxygenLibsbmlInternal */
978 
979   /**
980    * Sets the value of the "attributeName" attribute of this GradientBase.
981    *
982    * @param attributeName, the name of the attribute to set.
983    *
984    * @param value, the value of the attribute to set.
985    *
986    * @copydetails doc_returns_success_code
987    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
988    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
989    */
990   virtual int setAttribute(const std::string& attributeName,
991                            const std::string& value);
992 
993   /** @endcond */
994 
995 
996 
997   /** @cond doxygenLibsbmlInternal */
998 
999   /**
1000    * Unsets the value of the "attributeName" attribute of this GradientBase.
1001    *
1002    * @param attributeName, the name of the attribute to query.
1003    *
1004    * @copydetails doc_returns_success_code
1005    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1006    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
1007    */
1008   virtual int unsetAttribute(const std::string& attributeName);
1009 
1010   /** @endcond */
1011 
1012 
1013 
1014   /** @cond doxygenLibsbmlInternal */
1015 
1016   /**
1017    * Creates and returns an new "elementName" object in this GradientBase.
1018    *
1019    * @param elementName, the name of the element to create.
1020    *
1021    * @return pointer to the element created.
1022    */
1023   virtual SBase* createChildObject(const std::string& elementName);
1024 
1025   /** @endcond */
1026 
1027 
1028 
1029   /** @cond doxygenLibsbmlInternal */
1030 
1031   /**
1032    * Adds a new "elementName" object to this GradientBase.
1033    *
1034    * @param elementName, the name of the element to create.
1035    *
1036    * @param element, pointer to the element to be added.
1037    *
1038    * @copydetails doc_returns_success_code
1039    * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1040    * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
1041    */
1042   virtual int addChildObject(const std::string& elementName,
1043                              const SBase* element);
1044 
1045   /** @endcond */
1046 
1047 
1048 
1049   /** @cond doxygenLibsbmlInternal */
1050 
1051   /**
1052    * Removes and returns the new "elementName" object with the given id in this
1053    * GradientBase.
1054    *
1055    * @param elementName, the name of the element to remove.
1056    *
1057    * @param id, the id of the element to remove.
1058    *
1059    * @return pointer to the element removed.
1060    */
1061   virtual SBase* removeChildObject(const std::string& elementName,
1062                                    const std::string& id);
1063 
1064   /** @endcond */
1065 
1066 
1067 
1068   /** @cond doxygenLibsbmlInternal */
1069 
1070   /**
1071    * Returns the number of "elementName" in this GradientBase.
1072    *
1073    * @param elementName, the name of the element to get number of.
1074    *
1075    * @return unsigned int number of elements.
1076    */
1077   virtual unsigned int getNumObjects(const std::string& elementName);
1078 
1079   /** @endcond */
1080 
1081 
1082 
1083   /** @cond doxygenLibsbmlInternal */
1084 
1085   /**
1086    * Returns the nth object of "objectName" in this GradientBase.
1087    *
1088    * @param elementName, the name of the element to get number of.
1089    *
1090    * @param index, unsigned int the index of the object to retrieve.
1091    *
1092    * @return pointer to the object.
1093    */
1094   virtual SBase* getObject(const std::string& elementName, unsigned int index);
1095 
1096   /** @endcond */
1097 
1098 
1099 
1100 
1101   #endif /* !SWIG */
1102 
1103 
1104   /**
1105    * Returns the first child element that has the given @p id in the model-wide
1106    * SId namespace, or @c NULL if no such object is found.
1107    *
1108    * @param id a string representing the id attribute of the object to
1109    * retrieve.
1110    *
1111    * @return a pointer to the SBase element with the given @p id. If no such
1112    * object is found, this method returns @c NULL.
1113    */
1114   virtual SBase* getElementBySId(const std::string& id);
1115 
1116 
1117   /**
1118    * Returns the first child element that has the given @p metaid, or @c NULL
1119    * if no such object is found.
1120    *
1121    * @param metaid a string representing the metaid attribute of the object to
1122    * retrieve.
1123    *
1124    * @return a pointer to the SBase element with the given @p metaid. If no
1125    * such object is found this method returns @c NULL.
1126    */
1127   virtual SBase* getElementByMetaId(const std::string& metaid);
1128 
1129 
1130   /**
1131    * Returns a List of all child SBase objects, including those nested to an
1132    * arbitrary depth.
1133    *
1134    * @param filter an ElementFilter that may impose restrictions on the objects
1135    * to be retrieved.
1136    *
1137    * @return a List pointer of pointers to all SBase child objects with any
1138    * restriction imposed.
1139    */
1140   virtual List* getAllElements(ElementFilter * filter = NULL);
1141 
1142 
1143 protected:
1144 
1145 
1146   /** @cond doxygenLibsbmlInternal */
1147 
1148   /**
1149    * Creates a new object from the next XMLToken on the XMLInputStream
1150    */
1151   virtual SBase* createObject(XMLInputStream& stream);
1152 
1153   /** @endcond */
1154 
1155 
1156 
1157   /** @cond doxygenLibsbmlInternal */
1158 
1159   /**
1160    * Adds the expected attributes for this element
1161    */
1162   virtual void addExpectedAttributes(ExpectedAttributes& attributes);
1163 
1164   /** @endcond */
1165 
1166 
1167 
1168   /** @cond doxygenLibsbmlInternal */
1169 
1170   /**
1171    * Reads the expected attributes into the member data variables
1172    */
1173   virtual void readAttributes(const XMLAttributes& attributes,
1174                               const ExpectedAttributes& expectedAttributes);
1175 
1176   /** @endcond */
1177 
1178 
1179 
1180   /** @cond doxygenLibsbmlInternal */
1181 
1182   /**
1183    * Writes the attributes to the stream
1184    */
1185   virtual void writeAttributes(XMLOutputStream& stream) const;
1186 
1187   /** @endcond */
1188 
1189 
1190 
1191 
1192   /** @cond doxygenLibsbmlInternal */
1193 
1194   /**
1195    * Converts the given string into a spread method.
1196    * If the string does not represnt a valid spread method, PAD is
1197    * returned.
1198    */
1199   static int getSpreadMethodForString(const std::string& s);
1200   /** @endcond */
1201 
1202 
1203   /** @cond doxygenLibsbmlInternal */
1204   /**
1205    * This method is used when writing out gradietns to XML.
1206    * I writes out the attributes and children that re common to linear and radial gradient.
1207    */
1208   static void addGradientAttributesAndChildren(const GradientBase& gradient,XMLAttributes& att,XMLNode& node);
1209   /** @endcond */
1210 
1211 
1212 };
1213 
1214 LIBSBML_CPP_NAMESPACE_END
1215 
1216 #endif /* __cplusplus */
1217 
1218 
1219 #ifndef SWIG
1220 
1221 LIBSBML_CPP_NAMESPACE_BEGIN
1222 BEGIN_C_DECLS
1223 
1224 
1225 /**
1226  * Creates a new LinearGradient (GradientBase_t) using the given SBML Level,
1227  * Version and &ldquo;render&rdquo; package version.
1228  *
1229  * @param level an unsigned int, the SBML Level to assign to this
1230  * GradientBase_t.
1231  *
1232  * @param version an unsigned int, the SBML Version to assign to this
1233  * GradientBase_t.
1234  *
1235  * @param pkgVersion an unsigned int, the SBML Render Version to assign to this
1236  * GradientBase_t.
1237  *
1238  * @copydetails doc_note_setting_lv_pkg
1239  *
1240  * @copydetails doc_warning_returns_owned_pointer
1241  *
1242  * @memberof GradientBase_t
1243  */
1244 LIBSBML_EXTERN
1245 GradientBase_t *
1246 GradientBase_createLinearGradient(unsigned int level,
1247                                   unsigned int version,
1248                                   unsigned int pkgVersion);
1249 
1250 
1251 /**
1252  * Creates a new RadialGradient (GradientBase_t) using the given SBML Level,
1253  * Version and &ldquo;render&rdquo; package version.
1254  *
1255  * @param level an unsigned int, the SBML Level to assign to this
1256  * GradientBase_t.
1257  *
1258  * @param version an unsigned int, the SBML Version to assign to this
1259  * GradientBase_t.
1260  *
1261  * @param pkgVersion an unsigned int, the SBML Render Version to assign to this
1262  * GradientBase_t.
1263  *
1264  * @copydetails doc_note_setting_lv_pkg
1265  *
1266  * @copydetails doc_warning_returns_owned_pointer
1267  *
1268  * @memberof GradientBase_t
1269  */
1270 LIBSBML_EXTERN
1271 GradientBase_t *
1272 GradientBase_createRadialGradient(unsigned int level,
1273                                   unsigned int version,
1274                                   unsigned int pkgVersion);
1275 
1276 
1277 /**
1278  * Creates and returns a deep copy of this GradientBase_t object.
1279  *
1280  * @param gb the GradientBase_t structure.
1281  *
1282  * @return a (deep) copy of this GradientBase_t object.
1283  *
1284  * @copydetails doc_warning_returns_owned_pointer
1285  *
1286  * @memberof GradientBase_t
1287  */
1288 LIBSBML_EXTERN
1289 GradientBase_t*
1290 GradientBase_clone(const GradientBase_t* gb);
1291 
1292 
1293 /**
1294  * Frees this GradientBase_t object.
1295  *
1296  * @param gb the GradientBase_t structure.
1297  *
1298  * @memberof GradientBase_t
1299  */
1300 LIBSBML_EXTERN
1301 void
1302 GradientBase_free(GradientBase_t* gb);
1303 
1304 
1305 /**
1306  * Returns the value of the "id" attribute of this GradientBase_t.
1307  *
1308  * @param gb the GradientBase_t structure whose id is sought.
1309  *
1310  * @return the value of the "id" attribute of this GradientBase_t as a pointer
1311  * to a string.
1312  *
1313  * @copydetails doc_warning_returns_owned_char
1314  *
1315  * @memberof GradientBase_t
1316  */
1317 LIBSBML_EXTERN
1318 char *
1319 GradientBase_getId(const GradientBase_t * gb);
1320 
1321 
1322 /**
1323  * Returns the value of the "name" attribute of this GradientBase_t.
1324  *
1325  * @param gb the GradientBase_t structure whose name is sought.
1326  *
1327  * @return the value of the "name" attribute of this GradientBase_t as a
1328  * pointer to a string.
1329  *
1330  * @copydetails doc_warning_returns_owned_char
1331  *
1332  * @memberof GradientBase_t
1333  */
1334 LIBSBML_EXTERN
1335 char *
1336 GradientBase_getName(const GradientBase_t * gb);
1337 
1338 
1339 /**
1340  * Returns the value of the "spreadMethod" attribute of this GradientBase_t.
1341  *
1342  * @param gb the GradientBase_t structure whose spreadMethod is sought.
1343  *
1344  * @return the value of the "spreadMethod" attribute of this GradientBase_t as
1345  * a @if clike GradientSpreadMethod_t@else int@endif@~.
1346  *
1347  * @copydetails doc_gradientbase_spreadMethod
1348  * @if clike The value is drawn from the enumeration
1349  * GradientSpreadMethod_t. @endif@~
1350  * The possible values returned by this method are:
1351  * @li @sbmlconstant{GRADIENT_SPREADMETHOD_PAD, GradientSpreadMethod_t}
1352  * @li @sbmlconstant{GRADIENT_SPREADMETHOD_REFLECT, GradientSpreadMethod_t}
1353  * @li @sbmlconstant{GRADIENT_SPREADMETHOD_REPEAT, GradientSpreadMethod_t}
1354  * @li @sbmlconstant{GRADIENT_SPREAD_METHOD_INVALID, GradientSpreadMethod_t}
1355  *
1356  * @memberof GradientBase_t
1357  */
1358 LIBSBML_EXTERN
1359 GradientSpreadMethod_t
1360 GradientBase_getSpreadMethod(const GradientBase_t * gb);
1361 
1362 
1363 /**
1364  * Returns the value of the "spreadMethod" attribute of this GradientBase_t.
1365  *
1366  * @param gb the GradientBase_t structure whose spreadMethod is sought.
1367  *
1368  * @return the value of the "spreadMethod" attribute of this GradientBase_t as
1369  * a const char *.
1370  *
1371  * @copydetails doc_returned_unowned_char
1372  *
1373  * @copydetails doc_gradientbase_spreadMethod
1374  * The possible values returned by this method are:
1375  * @li @c "pad"
1376  * @li @c "reflect"
1377  * @li @c "repeat"
1378  * @li @c "invalid"
1379  *
1380  * @memberof GradientBase_t
1381  */
1382 LIBSBML_EXTERN
1383 char *
1384 GradientBase_getSpreadMethodAsString(const GradientBase_t * gb);
1385 
1386 
1387 /**
1388  * Predicate returning @c 1 (true) if this GradientBase_t's "id" attribute is
1389  * set.
1390  *
1391  * @param gb the GradientBase_t structure.
1392  *
1393  * @return @c 1 (true) if this GradientBase_t's "id" attribute has been set,
1394  * otherwise @c 0 (false) is returned.
1395  *
1396  * @memberof GradientBase_t
1397  */
1398 LIBSBML_EXTERN
1399 int
1400 GradientBase_isSetId(const GradientBase_t * gb);
1401 
1402 
1403 /**
1404  * Predicate returning @c 1 (true) if this GradientBase_t's "name" attribute is
1405  * set.
1406  *
1407  * @param gb the GradientBase_t structure.
1408  *
1409  * @return @c 1 (true) if this GradientBase_t's "name" attribute has been set,
1410  * otherwise @c 0 (false) is returned.
1411  *
1412  * @memberof GradientBase_t
1413  */
1414 LIBSBML_EXTERN
1415 int
1416 GradientBase_isSetName(const GradientBase_t * gb);
1417 
1418 
1419 /**
1420  * Predicate returning @c 1 (true) if this GradientBase_t's "spreadMethod"
1421  * attribute is set.
1422  *
1423  * @param gb the GradientBase_t structure.
1424  *
1425  * @return @c 1 (true) if this GradientBase_t's "spreadMethod" attribute has
1426  * been set, otherwise @c 0 (false) is returned.
1427  *
1428  * @copydetails doc_gradientbase_spreadMethod
1429  *
1430  * @memberof GradientBase_t
1431  */
1432 LIBSBML_EXTERN
1433 int
1434 GradientBase_isSetSpreadMethod(const GradientBase_t * gb);
1435 
1436 
1437 /**
1438  * Sets the value of the "id" attribute of this GradientBase_t.
1439  *
1440  * @param gb the GradientBase_t structure.
1441  *
1442  * @param id const char * value of the "id" attribute to be set.
1443  *
1444  * @copydetails doc_returns_success_code
1445  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1446  * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
1447  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1448  *
1449  * Calling this function with @p id = @c NULL or an empty string is equivalent
1450  * to calling GradientBase_unsetId().
1451  *
1452  * @memberof GradientBase_t
1453  */
1454 LIBSBML_EXTERN
1455 int
1456 GradientBase_setId(GradientBase_t * gb, const char * id);
1457 
1458 
1459 /**
1460  * Sets the value of the "name" attribute of this GradientBase_t.
1461  *
1462  * @param gb the GradientBase_t structure.
1463  *
1464  * @param name const char * value of the "name" attribute to be set.
1465  *
1466  * @copydetails doc_returns_success_code
1467  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1468  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1469  *
1470  * Calling this function with @p name = @c NULL or an empty string is
1471  * equivalent to calling GradientBase_unsetName().
1472  *
1473  * @memberof GradientBase_t
1474  */
1475 LIBSBML_EXTERN
1476 int
1477 GradientBase_setName(GradientBase_t * gb, const char * name);
1478 
1479 
1480 /**
1481  * Sets the value of the "spreadMethod" attribute of this GradientBase_t.
1482  *
1483  * @param gb the GradientBase_t structure.
1484  *
1485  * @param spreadMethod @if clike GradientSpreadMethod_t@else int@endif@~
1486  * value of the "spreadMethod" attribute to be set.
1487  *
1488  * @copydetails doc_returns_success_code
1489  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1490  * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
1491  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1492  *
1493  * @copydetails doc_gradientbase_spreadMethod
1494  *
1495  * @memberof GradientBase_t
1496  */
1497 LIBSBML_EXTERN
1498 int
1499 GradientBase_setSpreadMethod(GradientBase_t * gb,
1500                              GradientSpreadMethod_t spreadMethod);
1501 
1502 
1503 /**
1504  * Sets the value of the "spreadMethod" attribute of this GradientBase_t.
1505  *
1506  * @param gb the GradientBase_t structure.
1507  *
1508  * @param spreadMethod const char * of the "spreadMethod" attribute to be set.
1509  *
1510  * @copydetails doc_returns_success_code
1511  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1512  * @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
1513  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1514  *
1515  * @copydetails doc_gradientbase_spreadMethod
1516  *
1517  * @memberof GradientBase_t
1518  */
1519 LIBSBML_EXTERN
1520 int
1521 GradientBase_setSpreadMethodAsString(GradientBase_t * gb,
1522                                      const char * spreadMethod);
1523 
1524 
1525 /**
1526  * Unsets the value of the "id" attribute of this GradientBase_t.
1527  *
1528  * @param gb the GradientBase_t structure.
1529  *
1530  * @copydetails doc_returns_success_code
1531  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1532  * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
1533  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1534  *
1535  * @memberof GradientBase_t
1536  */
1537 LIBSBML_EXTERN
1538 int
1539 GradientBase_unsetId(GradientBase_t * gb);
1540 
1541 
1542 /**
1543  * Unsets the value of the "name" attribute of this GradientBase_t.
1544  *
1545  * @param gb the GradientBase_t structure.
1546  *
1547  * @copydetails doc_returns_success_code
1548  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1549  * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
1550  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1551  *
1552  * @memberof GradientBase_t
1553  */
1554 LIBSBML_EXTERN
1555 int
1556 GradientBase_unsetName(GradientBase_t * gb);
1557 
1558 
1559 /**
1560  * Unsets the value of the "spreadMethod" attribute of this GradientBase_t.
1561  *
1562  * @param gb the GradientBase_t structure.
1563  *
1564  * @copydetails doc_returns_success_code
1565  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1566  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1567  *
1568  * @copydetails doc_gradientbase_spreadMethod
1569  *
1570  * @memberof GradientBase_t
1571  */
1572 LIBSBML_EXTERN
1573 int
1574 GradientBase_unsetSpreadMethod(GradientBase_t * gb);
1575 
1576 
1577 /**
1578  * Returns a ListOf_t * containing GradientStop_t objects from this
1579  * GradientBase_t.
1580  *
1581  * @param gb the GradientBase_t structure whose ListOfGradientStops is sought.
1582  *
1583  * @return the ListOfGradientStops from this GradientBase_t as a ListOf_t *.
1584  *
1585  * @copydetails doc_returned_unowned_pointer
1586  *
1587  * @see GradientBase_addGradientStop()
1588  * @see GradientBase_createGradientStop()
1589  * @see GradientBase_getGradientStopById()
1590  * @see GradientBase_getGradientStop()
1591  * @see GradientBase_getNumGradientStops()
1592  * @see GradientBase_removeGradientStopById()
1593  * @see GradientBase_removeGradientStop()
1594  *
1595  * @memberof GradientBase_t
1596  */
1597 LIBSBML_EXTERN
1598 ListOf_t*
1599 GradientBase_getListOfGradientStops(GradientBase_t* gb);
1600 
1601 
1602 /**
1603  * Get a GradientStop_t from the GradientBase_t.
1604  *
1605  * @param gb the GradientBase_t structure to search.
1606  *
1607  * @param n an unsigned int representing the index of the GradientStop_t to
1608  * retrieve.
1609  *
1610  * @return the nth GradientStop_t in the ListOfGradientStops within this
1611  * GradientBase.
1612  * If the index @p n is invalid, @c NULL is returned.
1613  *
1614  * @copydetails doc_returned_unowned_pointer
1615  *
1616  * @memberof GradientBase_t
1617  */
1618 LIBSBML_EXTERN
1619 GradientStop_t*
1620 GradientBase_getGradientStop(GradientBase_t* gb, unsigned int n);
1621 
1622 
1623 /**
1624  * Adds a copy of the given GradientStop_t to this GradientBase_t.
1625  *
1626  * @param gb the GradientBase_t structure to which the GradientStop_t should be
1627  * added.
1628  *
1629  * @param gs the GradientStop_t object to add.
1630  *
1631  * @copydetails doc_returns_success_code
1632  * @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
1633  * @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
1634  * @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
1635  * @li @sbmlconstant{LIBSBML_LEVEL_MISMATCH, OperationReturnValues_t}
1636  * @li @sbmlconstant{LIBSBML_VERSION_MISMATCH, OperationReturnValues_t}
1637  * @li @sbmlconstant{LIBSBML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
1638  * @li @sbmlconstant{LIBSBML_DUPLICATE_OBJECT_ID, OperationReturnValues_t}
1639  *
1640  * @memberof GradientBase_t
1641  */
1642 LIBSBML_EXTERN
1643 int
1644 GradientBase_addGradientStop(GradientBase_t* gb, const GradientStop_t* gs);
1645 
1646 
1647 /**
1648  * Get the number of GradientStop_t objects in this GradientBase_t.
1649  *
1650  * @param gb the GradientBase_t structure to query.
1651  *
1652  * @return the number of GradientStop_t objects in this GradientBase_t.
1653  *
1654  * @memberof GradientBase_t
1655  */
1656 LIBSBML_EXTERN
1657 unsigned int
1658 GradientBase_getNumGradientStops(GradientBase_t* gb);
1659 
1660 
1661 /**
1662  * Creates a new GradientStop_t object, adds it to this GradientBase_t object
1663  * and returns the GradientStop_t object created.
1664  *
1665  * @param gb the GradientBase_t structure to which the GradientStop_t should be
1666  * added.
1667  *
1668  * @return a new GradientStop_t object instance.
1669  *
1670  * @copydetails doc_returned_unowned_pointer
1671  *
1672  * @memberof GradientBase_t
1673  */
1674 LIBSBML_EXTERN
1675 GradientStop_t*
1676 GradientBase_createGradientStop(GradientBase_t* gb);
1677 
1678 
1679 /**
1680  * Removes the nth GradientStop_t from this GradientBase_t and returns a
1681  * pointer to it.
1682  *
1683  * @param gb the GradientBase_t structure to search.
1684  *
1685  * @param n an unsigned int representing the index of the GradientStop_t to
1686  * remove.
1687  *
1688  * @return a pointer to the nth GradientStop_t in this GradientBase_t.
1689  *
1690  * @copydetails doc_warning_returns_owned_pointer
1691  *
1692  * @memberof GradientBase_t
1693  */
1694 LIBSBML_EXTERN
1695 GradientStop_t*
1696 GradientBase_removeGradientStop(GradientBase_t* gb, unsigned int n);
1697 
1698 
1699 /**
1700  * Predicate returning @c 1 if this GradientBase_t is of type LinearGradient_t
1701  *
1702  * @param gb the GradientBase_t structure.
1703  *
1704  * @return @c 1 if this GradientBase_t is of type LinearGradient_t, @c 0
1705  * otherwise
1706  *
1707  * @memberof GradientBase_t
1708  */
1709 LIBSBML_EXTERN
1710 int
1711 GradientBase_isLinearGradient(const GradientBase_t * gb);
1712 
1713 
1714 /**
1715  * Predicate returning @c 1 if this GradientBase_t is of type RadialGradient_t
1716  *
1717  * @param gb the GradientBase_t structure.
1718  *
1719  * @return @c 1 if this GradientBase_t is of type RadialGradient_t, @c 0
1720  * otherwise
1721  *
1722  * @memberof GradientBase_t
1723  */
1724 LIBSBML_EXTERN
1725 int
1726 GradientBase_isRadialGradient(const GradientBase_t * gb);
1727 
1728 
1729 /**
1730  * Predicate returning @c 1 (true) if all the required attributes for this
1731  * GradientBase_t object have been set.
1732  *
1733  * @param gb the GradientBase_t structure.
1734  *
1735  * @return @c 1 (true) to indicate that all the required attributes of this
1736  * GradientBase_t have been set, otherwise @c 0 (false) is returned.
1737  *
1738  *
1739  * @note The required attributes for the GradientBase_t object are:
1740  * @li "id"
1741  *
1742  * @memberof GradientBase_t
1743  */
1744 LIBSBML_EXTERN
1745 int
1746 GradientBase_hasRequiredAttributes(const GradientBase_t * gb);
1747 
1748 
1749 
1750 
1751 END_C_DECLS
1752 
1753 
1754 
1755 
1756 LIBSBML_CPP_NAMESPACE_END
1757 
1758 
1759 
1760 
1761 #endif /* !SWIG */
1762 
1763 LIBSBML_CPP_NAMESPACE_BEGIN
1764 BEGIN_C_DECLS
1765 
1766 LIBSBML_EXTERN
1767 GradientBase::SPREADMETHOD
1768 SpreadMethod_fromString(const char* name);
1769 
1770 LIBSBML_EXTERN
1771 const char*
1772 SpreadMethod_toString(GradientBase::SPREADMETHOD method);
1773 
1774 END_C_DECLS
1775 LIBSBML_CPP_NAMESPACE_END
1776 
1777 
1778 
1779 #endif /* !GradientBase_H__ */
1780 
1781 
1782