1 /**
2  * @file SedChangeAttribute.h
3  * @brief Definition of the SedChangeAttribute class.
4  * @author DEVISER
5  *
6  * <!--------------------------------------------------------------------------
7  * This file is part of libSEDML. Please visit http://sed-ml.org for more
8  * information about SED-ML. The latest version of libSEDML can be found on
9  * github: https://github.com/fbergmann/libSEDML/
10  *
11 
12  * Copyright (c) 2013-2019, Frank T. Bergmann
13  * All rights reserved.
14  *
15 
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions are met:
18  *
19 
20  * 1. Redistributions of source code must retain the above copyright notice,
21  * this
22  * list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright notice,
24  * this list of conditions and the following disclaimer in the documentation
25  * and/or other materials provided with the distribution.
26  *
27  * This library is free software; you can redistribute it and/or modify it
28  * under the terms of the GNU Lesser General Public License as published by the
29  * Free Software Foundation. A copy of the license agreement is provided in the
30  * file named "LICENSE.txt" included with this software distribution and also
31  * available online as http://sbml.org/software/libsbml/license.html
32  * ------------------------------------------------------------------------ -->
33  *
34  * @class SedChangeAttribute
35  * @sbmlbrief{sedml} TODO:Definition of the SedChangeAttribute class.
36  */
37 
38 
39 #ifndef SedChangeAttribute_H__
40 #define SedChangeAttribute_H__
41 
42 
43 #include <sedml/common/extern.h>
44 #include <sedml/common/sedmlfwd.h>
45 
46 
47 #ifdef __cplusplus
48 
49 
50 #include <string>
51 
52 
53 #include <sedml/SedChange.h>
54 #include <sbml/common/libsbml-namespace.h>
55 
56 
57 LIBSEDML_CPP_NAMESPACE_BEGIN
58 
59 
60 class LIBSEDML_EXTERN SedChangeAttribute : public SedChange
61 {
62 protected:
63 
64   /** @cond doxygenLibSEDMLInternal */
65 
66   std::string mNewValue;
67 
68   /** @endcond */
69 
70 public:
71 
72   /**
73    * Creates a new SedChangeAttribute using the given SED-ML Level and @ p
74    * version values.
75    *
76    * @param level an unsigned int, the SED-ML Level to assign to this
77    * SedChangeAttribute.
78    *
79    * @param version an unsigned int, the SED-ML Version to assign to this
80    * SedChangeAttribute.
81    *
82    * @copydetails doc_note_setting_lv_pkg
83    */
84   SedChangeAttribute(unsigned int level = SEDML_DEFAULT_LEVEL,
85                      unsigned int version = SEDML_DEFAULT_VERSION);
86 
87 
88   /**
89    * Creates a new SedChangeAttribute using the given SedNamespaces object @p
90    * sedmlns.
91    *
92    * @param sedmlns the SedNamespaces object.
93    *
94    * @copydetails doc_note_setting_lv_pkg
95    */
96   SedChangeAttribute(SedNamespaces *sedmlns);
97 
98 
99   /**
100    * Copy constructor for SedChangeAttribute.
101    *
102    * @param orig the SedChangeAttribute instance to copy.
103    */
104   SedChangeAttribute(const SedChangeAttribute& orig);
105 
106 
107   /**
108    * Assignment operator for SedChangeAttribute.
109    *
110    * @param rhs the SedChangeAttribute object whose values are to be used as
111    * the basis of the assignment.
112    */
113   SedChangeAttribute& operator=(const SedChangeAttribute& rhs);
114 
115 
116   /**
117    * Creates and returns a deep copy of this SedChangeAttribute object.
118    *
119    * @return a (deep) copy of this SedChangeAttribute object.
120    */
121   virtual SedChangeAttribute* clone() const;
122 
123 
124   /**
125    * Destructor for SedChangeAttribute.
126    */
127   virtual ~SedChangeAttribute();
128 
129 
130   /**
131    * Returns the value of the "newValue" attribute of this SedChangeAttribute.
132    *
133    * @return the value of the "newValue" attribute of this SedChangeAttribute
134    * as a string.
135    */
136   const std::string& getNewValue() const;
137 
138 
139   /**
140    * Predicate returning @c true if this SedChangeAttribute's "newValue"
141    * attribute is set.
142    *
143    * @return @c true if this SedChangeAttribute's "newValue" attribute has been
144    * set, otherwise @c false is returned.
145    */
146   bool isSetNewValue() const;
147 
148 
149   /**
150    * Sets the value of the "newValue" attribute of this SedChangeAttribute.
151    *
152    * @param newValue std::string& value of the "newValue" attribute to be set.
153    *
154    * @copydetails doc_returns_one_success_code
155    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
156    *
157    * Calling this function with @p newValue = @c NULL or an empty string is
158    * equivalent to calling unsetNewValue().
159    */
160   int setNewValue(const std::string& newValue);
161 
162 
163   /**
164    * Unsets the value of the "newValue" attribute of this SedChangeAttribute.
165    *
166    * @copydetails doc_returns_success_code
167    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
168    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
169    */
170   int unsetNewValue();
171 
172 
173   /**
174    * Returns the XML element name of this SedChangeAttribute object.
175    *
176    * For SedChangeAttribute, the XML element name is always
177    * @c "changeAttribute".
178    *
179    * @return the name of this element, i.e. @c "changeAttribute".
180    */
181   virtual const std::string& getElementName() const;
182 
183 
184   /**
185    * Returns the libSEDML type code for this SedChangeAttribute object.
186    *
187    * @copydetails doc_what_are_typecodes
188    *
189    * @return the SED-ML type code for this object:
190    * @sedmlconstant{SEDML_CHANGE_ATTRIBUTE, SedTypeCode_t}.
191    *
192    * @copydetails doc_warning_typecodes_not_unique
193    *
194    * @see getElementName()
195    */
196   virtual int getTypeCode() const;
197 
198 
199   /**
200    * Predicate returning @c true if all the required attributes for this
201    * SedChangeAttribute object have been set.
202    *
203    * @return @c true to indicate that all the required attributes of this
204    * SedChangeAttribute have been set, otherwise @c false is returned.
205    *
206    *
207    * @note The required attributes for the SedChangeAttribute object are:
208    * @li "newValue"
209    */
210   virtual bool hasRequiredAttributes() const;
211 
212 
213 
214   /** @cond doxygenLibSEDMLInternal */
215 
216   /**
217    * Write any contained elements
218    */
219   virtual void writeElements(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream&
220     stream) const;
221 
222   /** @endcond */
223 
224 
225 
226   /** @cond doxygenLibSEDMLInternal */
227 
228   /**
229    * Accepts the given SedVisitor
230    */
231   virtual bool accept(SedVisitor& v) const;
232 
233   /** @endcond */
234 
235 
236 
237   /** @cond doxygenLibSEDMLInternal */
238 
239   /**
240    * Sets the parent SedDocument
241    */
242   virtual void setSedDocument(SedDocument* d);
243 
244   /** @endcond */
245 
246 
247 
248 
249   #ifndef SWIG
250 
251 
252 
253   /** @cond doxygenLibSEDMLInternal */
254 
255   /**
256    * Gets the value of the "attributeName" attribute of this
257    * SedChangeAttribute.
258    *
259    * @param attributeName, the name of the attribute to retrieve.
260    *
261    * @param value, the address of the value to record.
262    *
263    * @copydetails doc_returns_success_code
264    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
265    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
266    */
267   virtual int getAttribute(const std::string& attributeName, bool& value)
268     const;
269 
270   /** @endcond */
271 
272 
273 
274   /** @cond doxygenLibSEDMLInternal */
275 
276   /**
277    * Gets the value of the "attributeName" attribute of this
278    * SedChangeAttribute.
279    *
280    * @param attributeName, the name of the attribute to retrieve.
281    *
282    * @param value, the address of the value to record.
283    *
284    * @copydetails doc_returns_success_code
285    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
286    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
287    */
288   virtual int getAttribute(const std::string& attributeName, int& value) const;
289 
290   /** @endcond */
291 
292 
293 
294   /** @cond doxygenLibSEDMLInternal */
295 
296   /**
297    * Gets the value of the "attributeName" attribute of this
298    * SedChangeAttribute.
299    *
300    * @param attributeName, the name of the attribute to retrieve.
301    *
302    * @param value, the address of the value to record.
303    *
304    * @copydetails doc_returns_success_code
305    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
306    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
307    */
308   virtual int getAttribute(const std::string& attributeName,
309                            double& value) const;
310 
311   /** @endcond */
312 
313 
314 
315   /** @cond doxygenLibSEDMLInternal */
316 
317   /**
318    * Gets the value of the "attributeName" attribute of this
319    * SedChangeAttribute.
320    *
321    * @param attributeName, the name of the attribute to retrieve.
322    *
323    * @param value, the address of the value to record.
324    *
325    * @copydetails doc_returns_success_code
326    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
327    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
328    */
329   virtual int getAttribute(const std::string& attributeName,
330                            unsigned int& value) const;
331 
332   /** @endcond */
333 
334 
335 
336   /** @cond doxygenLibSEDMLInternal */
337 
338   /**
339    * Gets the value of the "attributeName" attribute of this
340    * SedChangeAttribute.
341    *
342    * @param attributeName, the name of the attribute to retrieve.
343    *
344    * @param value, the address of the value to record.
345    *
346    * @copydetails doc_returns_success_code
347    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
348    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
349    */
350   virtual int getAttribute(const std::string& attributeName,
351                            std::string& value) const;
352 
353   /** @endcond */
354 
355 
356 
357   /** @cond doxygenLibSEDMLInternal */
358 
359   /**
360    * Predicate returning @c true if this SedChangeAttribute's attribute
361    * "attributeName" is set.
362    *
363    * @param attributeName, the name of the attribute to query.
364    *
365    * @return @c true if this SedChangeAttribute's attribute "attributeName" has
366    * been set, otherwise @c false is returned.
367    */
368   virtual bool isSetAttribute(const std::string& attributeName) const;
369 
370   /** @endcond */
371 
372 
373 
374   /** @cond doxygenLibSEDMLInternal */
375 
376   /**
377    * Sets the value of the "attributeName" attribute of this
378    * SedChangeAttribute.
379    *
380    * @param attributeName, the name of the attribute to set.
381    *
382    * @param value, the value of the attribute to set.
383    *
384    * @copydetails doc_returns_success_code
385    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
386    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
387    */
388   virtual int setAttribute(const std::string& attributeName, bool value);
389 
390   /** @endcond */
391 
392 
393 
394   /** @cond doxygenLibSEDMLInternal */
395 
396   /**
397    * Sets the value of the "attributeName" attribute of this
398    * SedChangeAttribute.
399    *
400    * @param attributeName, the name of the attribute to set.
401    *
402    * @param value, the value of the attribute to set.
403    *
404    * @copydetails doc_returns_success_code
405    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
406    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
407    */
408   virtual int setAttribute(const std::string& attributeName, int value);
409 
410   /** @endcond */
411 
412 
413 
414   /** @cond doxygenLibSEDMLInternal */
415 
416   /**
417    * Sets the value of the "attributeName" attribute of this
418    * SedChangeAttribute.
419    *
420    * @param attributeName, the name of the attribute to set.
421    *
422    * @param value, the value of the attribute to set.
423    *
424    * @copydetails doc_returns_success_code
425    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
426    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
427    */
428   virtual int setAttribute(const std::string& attributeName, double value);
429 
430   /** @endcond */
431 
432 
433 
434   /** @cond doxygenLibSEDMLInternal */
435 
436   /**
437    * Sets the value of the "attributeName" attribute of this
438    * SedChangeAttribute.
439    *
440    * @param attributeName, the name of the attribute to set.
441    *
442    * @param value, the value of the attribute to set.
443    *
444    * @copydetails doc_returns_success_code
445    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
446    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
447    */
448   virtual int setAttribute(const std::string& attributeName,
449                            unsigned int value);
450 
451   /** @endcond */
452 
453 
454 
455   /** @cond doxygenLibSEDMLInternal */
456 
457   /**
458    * Sets the value of the "attributeName" attribute of this
459    * SedChangeAttribute.
460    *
461    * @param attributeName, the name of the attribute to set.
462    *
463    * @param value, the value of the attribute to set.
464    *
465    * @copydetails doc_returns_success_code
466    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
467    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
468    */
469   virtual int setAttribute(const std::string& attributeName,
470                            const std::string& value);
471 
472   /** @endcond */
473 
474 
475 
476   /** @cond doxygenLibSEDMLInternal */
477 
478   /**
479    * Unsets the value of the "attributeName" attribute of this
480    * SedChangeAttribute.
481    *
482    * @param attributeName, the name of the attribute to query.
483    *
484    * @copydetails doc_returns_success_code
485    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
486    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
487    */
488   virtual int unsetAttribute(const std::string& attributeName);
489 
490   /** @endcond */
491 
492 
493 
494 
495   #endif /* !SWIG */
496 
497 
498 protected:
499 
500 
501   /** @cond doxygenLibSEDMLInternal */
502 
503   /**
504    * Creates a new object from the next XMLToken on the XMLInputStream
505    */
506   virtual SedBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream&
507     stream);
508 
509   /** @endcond */
510 
511 
512 
513   /** @cond doxygenLibSEDMLInternal */
514 
515   /**
516    * Adds the expected attributes for this element
517    */
518   virtual void addExpectedAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER
519     ExpectedAttributes& attributes);
520 
521   /** @endcond */
522 
523 
524 
525   /** @cond doxygenLibSEDMLInternal */
526 
527   /**
528    * Reads the expected attributes into the member data variables
529    */
530   virtual void readAttributes(
531                               const LIBSBML_CPP_NAMESPACE_QUALIFIER
532                                 XMLAttributes& attributes,
533                               const LIBSBML_CPP_NAMESPACE_QUALIFIER
534                                 ExpectedAttributes& expectedAttributes);
535 
536   /** @endcond */
537 
538 
539 
540   /** @cond doxygenLibSEDMLInternal */
541 
542   /**
543    * Writes the attributes to the stream
544    */
545   virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream&
546     stream) const;
547 
548   /** @endcond */
549 
550 
551 };
552 
553 
554 
555 LIBSEDML_CPP_NAMESPACE_END
556 
557 
558 
559 
560 #endif /* __cplusplus */
561 
562 
563 
564 
565 #ifndef SWIG
566 
567 
568 
569 
570 LIBSEDML_CPP_NAMESPACE_BEGIN
571 
572 
573 
574 
575 BEGIN_C_DECLS
576 
577 
578 /**
579  * Creates a new SedChangeAttribute_t using the given SED-ML Level and @ p
580  * version values.
581  *
582  * @param level an unsigned int, the SED-ML Level to assign to this
583  * SedChangeAttribute_t.
584  *
585  * @param version an unsigned int, the SED-ML Version to assign to this
586  * SedChangeAttribute_t.
587  *
588  * @copydetails doc_note_setting_lv_pkg
589  *
590  * @copydetails doc_returned_owned_pointer
591  *
592  * @memberof SedChangeAttribute_t
593  */
594 LIBSEDML_EXTERN
595 SedChangeAttribute_t *
596 SedChangeAttribute_create(unsigned int level, unsigned int version);
597 
598 
599 /**
600  * Creates and returns a deep copy of this SedChangeAttribute_t object.
601  *
602  * @param sca the SedChangeAttribute_t structure.
603  *
604  * @return a (deep) copy of this SedChangeAttribute_t object.
605  *
606  * @copydetails doc_returned_owned_pointer
607  *
608  * @memberof SedChangeAttribute_t
609  */
610 LIBSEDML_EXTERN
611 SedChangeAttribute_t*
612 SedChangeAttribute_clone(const SedChangeAttribute_t* sca);
613 
614 
615 /**
616  * Frees this SedChangeAttribute_t object.
617  *
618  * @param sca the SedChangeAttribute_t structure.
619  *
620  * @memberof SedChangeAttribute_t
621  */
622 LIBSEDML_EXTERN
623 void
624 SedChangeAttribute_free(SedChangeAttribute_t* sca);
625 
626 
627 /**
628  * Returns the value of the "newValue" attribute of this SedChangeAttribute_t.
629  *
630  * @param sca the SedChangeAttribute_t structure whose newValue is sought.
631  *
632  * @return the value of the "newValue" attribute of this SedChangeAttribute_t
633  * as a pointer to a string.
634  *
635  * @copydetails doc_returned_owned_char
636  *
637  * @memberof SedChangeAttribute_t
638  */
639 LIBSEDML_EXTERN
640 char *
641 SedChangeAttribute_getNewValue(const SedChangeAttribute_t * sca);
642 
643 
644 /**
645  * Predicate returning @c 1 (true) if this SedChangeAttribute_t's "newValue"
646  * attribute is set.
647  *
648  * @param sca the SedChangeAttribute_t structure.
649  *
650  * @return @c 1 (true) if this SedChangeAttribute_t's "newValue" attribute has
651  * been set, otherwise @c 0 (false) is returned.
652  *
653  * @memberof SedChangeAttribute_t
654  */
655 LIBSEDML_EXTERN
656 int
657 SedChangeAttribute_isSetNewValue(const SedChangeAttribute_t * sca);
658 
659 
660 /**
661  * Sets the value of the "newValue" attribute of this SedChangeAttribute_t.
662  *
663  * @param sca the SedChangeAttribute_t structure.
664  *
665  * @param newValue const char * value of the "newValue" attribute to be set.
666  *
667  * @copydetails doc_returns_success_code
668  * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
669  * @li @sedmlconstant{LIBSEDML_INVALID_OBJECT, OperationReturnValues_t}
670  *
671  * Calling this function with @p newValue = @c NULL or an empty string is
672  * equivalent to calling SedChangeAttribute_unsetNewValue().
673  *
674  * @memberof SedChangeAttribute_t
675  */
676 LIBSEDML_EXTERN
677 int
678 SedChangeAttribute_setNewValue(SedChangeAttribute_t * sca,
679                                const char * newValue);
680 
681 
682 /**
683  * Unsets the value of the "newValue" attribute of this SedChangeAttribute_t.
684  *
685  * @param sca the SedChangeAttribute_t structure.
686  *
687  * @copydetails doc_returns_success_code
688  * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
689  * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
690  * @li @sedmlconstant{LIBSEDML_INVALID_OBJECT, OperationReturnValues_t}
691  *
692  * @memberof SedChangeAttribute_t
693  */
694 LIBSEDML_EXTERN
695 int
696 SedChangeAttribute_unsetNewValue(SedChangeAttribute_t * sca);
697 
698 
699 /**
700  * Predicate returning @c 1 (true) if all the required attributes for this
701  * SedChangeAttribute_t object have been set.
702  *
703  * @param sca the SedChangeAttribute_t structure.
704  *
705  * @return @c 1 (true) to indicate that all the required attributes of this
706  * SedChangeAttribute_t have been set, otherwise @c 0 (false) is returned.
707  *
708  *
709  * @note The required attributes for the SedChangeAttribute_t object are:
710  * @li "newValue"
711  *
712  * @memberof SedChangeAttribute_t
713  */
714 LIBSEDML_EXTERN
715 int
716 SedChangeAttribute_hasRequiredAttributes(const SedChangeAttribute_t * sca);
717 
718 
719 
720 
721 END_C_DECLS
722 
723 
724 
725 
726 LIBSEDML_CPP_NAMESPACE_END
727 
728 
729 
730 
731 #endif /* !SWIG */
732 
733 
734 
735 
736 #endif /* !SedChangeAttribute_H__ */
737 
738 
739