1 /**
2  * @file SedListOfDataSets.h
3  * @brief Definition of the SedListOfDataSets 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 SedListOfDataSets
35  * @sbmlbrief{sedml} TODO:Definition of the SedListOfDataSets class.
36  */
37 
38 
39 #ifndef SedListOfDataSets_H__
40 #define SedListOfDataSets_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/SedListOf.h>
54 #include <sedml/SedDataSet.h>
55 #include <sbml/common/libsbml-namespace.h>
56 
57 
58 LIBSEDML_CPP_NAMESPACE_BEGIN
59 
60 
61 class LIBSEDML_EXTERN SedListOfDataSets : public SedListOf
62 {
63 
64 public:
65 
66   /**
67    * Creates a new SedListOfDataSets using the given SED-ML Level and @ p
68    * version values.
69    *
70    * @param level an unsigned int, the SED-ML Level to assign to this
71    * SedListOfDataSets.
72    *
73    * @param version an unsigned int, the SED-ML Version to assign to this
74    * SedListOfDataSets.
75    *
76    * @copydetails doc_note_setting_lv_pkg
77    */
78   SedListOfDataSets(unsigned int level = SEDML_DEFAULT_LEVEL,
79                     unsigned int version = SEDML_DEFAULT_VERSION);
80 
81 
82   /**
83    * Creates a new SedListOfDataSets using the given SedNamespaces object @p
84    * sedmlns.
85    *
86    * @param sedmlns the SedNamespaces object.
87    *
88    * @copydetails doc_note_setting_lv_pkg
89    */
90   SedListOfDataSets(SedNamespaces *sedmlns);
91 
92 
93   /**
94    * Copy constructor for SedListOfDataSets.
95    *
96    * @param orig the SedListOfDataSets instance to copy.
97    */
98   SedListOfDataSets(const SedListOfDataSets& orig);
99 
100 
101   /**
102    * Assignment operator for SedListOfDataSets.
103    *
104    * @param rhs the SedListOfDataSets object whose values are to be used as the
105    * basis of the assignment.
106    */
107   SedListOfDataSets& operator=(const SedListOfDataSets& rhs);
108 
109 
110   /**
111    * Creates and returns a deep copy of this SedListOfDataSets object.
112    *
113    * @return a (deep) copy of this SedListOfDataSets object.
114    */
115   virtual SedListOfDataSets* clone() const;
116 
117 
118   /**
119    * Destructor for SedListOfDataSets.
120    */
121   virtual ~SedListOfDataSets();
122 
123 
124   /**
125    * Get a SedDataSet from the SedListOfDataSets.
126    *
127    * @param n an unsigned int representing the index of the SedDataSet to
128    * retrieve.
129    *
130    * @return the nth SedDataSet in this SedListOfDataSets or @c NULL if no such
131    * object exists.
132    *
133    * @copydetails doc_returned_unowned_pointer
134    *
135    * @see addDataSet(const SedDataSet* object)
136    * @see createDataSet()
137    * @see get(const std::string& sid)
138    * @see getNumDataSets()
139    * @see remove(const std::string& sid)
140    * @see remove(unsigned int n)
141    */
142   virtual SedDataSet* get(unsigned int n);
143 
144 
145   /**
146    * Get a SedDataSet from the SedListOfDataSets.
147    *
148    * @param n an unsigned int representing the index of the SedDataSet to
149    * retrieve.
150    *
151    * @return the nth SedDataSet in this SedListOfDataSets or @c NULL if no such
152    * object exists.
153    *
154    * @copydetails doc_returned_unowned_pointer
155    *
156    * @see addDataSet(const SedDataSet* object)
157    * @see createDataSet()
158    * @see get(const std::string& sid)
159    * @see getNumDataSets()
160    * @see remove(const std::string& sid)
161    * @see remove(unsigned int n)
162    */
163   virtual const SedDataSet* get(unsigned int n) const;
164 
165 
166   /**
167    * Get a SedDataSet from the SedListOfDataSets based on its identifier.
168    *
169    * @param sid a string representing the identifier of the SedDataSet to
170    * retrieve.
171    *
172    * @return the SedDataSet in this SedListOfDataSets with the given @p sid or
173    * @c NULL if no such SedDataSet exists.
174    *
175    * @copydetails doc_returned_unowned_pointer
176    *
177    * @see addDataSet(const SedDataSet* object)
178    * @see createDataSet()
179    * @see get(unsigned int n)
180    * @see getNumDataSets()
181    * @see remove(const std::string& sid)
182    * @see remove(unsigned int n)
183    */
184   virtual SedDataSet* get(const std::string& sid);
185 
186 
187   /**
188    * Get a SedDataSet from the SedListOfDataSets based on its identifier.
189    *
190    * @param sid a string representing the identifier of the SedDataSet to
191    * retrieve.
192    *
193    * @return the SedDataSet in this SedListOfDataSets with the given @p sid or
194    * @c NULL if no such SedDataSet exists.
195    *
196    * @copydetails doc_returned_unowned_pointer
197    *
198    * @see addDataSet(const SedDataSet* object)
199    * @see createDataSet()
200    * @see get(unsigned int n)
201    * @see getNumDataSets()
202    * @see remove(const std::string& sid)
203    * @see remove(unsigned int n)
204    */
205   virtual const SedDataSet* get(const std::string& sid) const;
206 
207 
208   /**
209    * Removes the nth SedDataSet from this SedListOfDataSets and returns a
210    * pointer to it.
211    *
212    * @param n an unsigned int representing the index of the SedDataSet to
213    * remove.
214    *
215    * @return a pointer to the nth SedDataSet in this SedListOfDataSets.
216    *
217    * @copydetails doc_warning_returns_owned_pointer
218    *
219    * @see addDataSet(const SedDataSet* object)
220    * @see createDataSet()
221    * @see get(const std::string& sid)
222    * @see get(unsigned int n)
223    * @see getNumDataSets()
224    * @see remove(const std::string& sid)
225    */
226   virtual SedDataSet* remove(unsigned int n);
227 
228 
229   /**
230    * Removes the SedDataSet from this SedListOfDataSets based on its identifier
231    * and returns a pointer to it.
232    *
233    * @param sid a string representing the identifier of the SedDataSet to
234    * remove.
235    *
236    * @return the SedDataSet in this SedListOfDataSets based on the identifier
237    * or NULL if no such SedDataSet exists.
238    *
239    * @copydetails doc_warning_returns_owned_pointer
240    *
241    * @see addDataSet(const SedDataSet* object)
242    * @see createDataSet()
243    * @see get(const std::string& sid)
244    * @see get(unsigned int n)
245    * @see getNumDataSets()
246    * @see remove(unsigned int n)
247    */
248   virtual SedDataSet* remove(const std::string& sid);
249 
250 
251   /**
252    * Adds a copy of the given SedDataSet to this SedListOfDataSets.
253    *
254    * @param sds the SedDataSet object to add.
255    *
256    * @copydetails doc_returns_success_code
257    * @li @sedmlconstant{LIBSEDML_OPERATION_SUCCESS, OperationReturnValues_t}
258    * @li @sedmlconstant{LIBSEDML_OPERATION_FAILED, OperationReturnValues_t}
259    * @li @sedmlconstant{LIBSEDML_INVALID_OBJECT, OperationReturnValues_t}
260    * @li @sedmlconstant{LIBSEDML_LEVEL_MISMATCH, OperationReturnValues_t}
261    * @li @sedmlconstant{LIBSEDML_VERSION_MISMATCH, OperationReturnValues_t}
262    * @li @sedmlconstant{LIBSEDML_PKG_VERSION_MISMATCH, OperationReturnValues_t}
263    * @li @sedmlconstant{LIBSEDML_DUPLICATE_OBJECT_ID, OperationReturnValues_t}
264    *
265    * @copydetails doc_note_object_is_copied
266    *
267    * @see createDataSet()
268    * @see get(const std::string& sid)
269    * @see get(unsigned int n)
270    * @see getNumDataSets()
271    * @see remove(const std::string& sid)
272    * @see remove(unsigned int n)
273    */
274   int addDataSet(const SedDataSet* sds);
275 
276 
277   /**
278    * Get the number of SedDataSet objects in this SedListOfDataSets.
279    *
280    * @return the number of SedDataSet objects in this SedListOfDataSets.
281    *
282    * @see addDataSet(const SedDataSet* object)
283    * @see createDataSet()
284    * @see get(const std::string& sid)
285    * @see get(unsigned int n)
286    * @see remove(const std::string& sid)
287    * @see remove(unsigned int n)
288    */
289   unsigned int getNumDataSets() const;
290 
291 
292   /**
293    * Creates a new SedDataSet object, adds it to this SedListOfDataSets object
294    * and returns the SedDataSet object created.
295    *
296    * @return a new SedDataSet object instance.
297    *
298    * @copydetails doc_returned_unowned_pointer
299    *
300    * @see addDataSet(const SedDataSet* object)
301    * @see get(const std::string& sid)
302    * @see get(unsigned int n)
303    * @see getNumDataSets()
304    * @see remove(const std::string& sid)
305    * @see remove(unsigned int n)
306    */
307   SedDataSet* createDataSet();
308 
309 
310   /**
311    * Get a SedDataSet from the SedListOfDataSets based on the DataReference to
312    * which it refers.
313    *
314    * @param sid a string representing the "dataReference" attribute of the
315    * SedDataSet object to retrieve.
316    *
317    * @return the first SedDataSet in this SedListOfDataSets based on the given
318    * dataReference attribute or NULL if no such SedDataSet exists.
319    *
320    * @copydetails doc_returned_unowned_pointer
321    */
322   const SedDataSet* getByDataReference(const std::string& sid) const;
323 
324 
325   /**
326    * Get a SedDataSet from the SedListOfDataSets based on the DataReference to
327    * which it refers.
328    *
329    * @param sid a string representing the "dataReference" attribute of the
330    * SedDataSet object to retrieve.
331    *
332    * @return the first SedDataSet in this SedListOfDataSets based on the given
333    * dataReference attribute or NULL if no such SedDataSet exists.
334    *
335    * @copydetails doc_returned_unowned_pointer
336    */
337   SedDataSet* getByDataReference(const std::string& sid);
338 
339 
340   /**
341    * Returns the XML element name of this SedListOfDataSets object.
342    *
343    * For SedListOfDataSets, the XML element name is always @c "listOfDataSets".
344    *
345    * @return the name of this element, i.e. @c "listOfDataSets".
346    */
347   virtual const std::string& getElementName() const;
348 
349 
350   /**
351    * Returns the libSEDML type code for this SedListOfDataSets object.
352    *
353    * @copydetails doc_what_are_typecodes
354    *
355    * @return the SED-ML type code for this object:
356    * @sedmlconstant{SEDML_LIST_OF, SedTypeCode_t}.
357    *
358    * @copydetails doc_warning_typecodes_not_unique
359    */
360   virtual int getTypeCode() const;
361 
362 
363   /**
364    * Returns the libSEDML type code for the SED-ML objects contained in this
365    * SedListOfDataSets object.
366    *
367    * @copydetails doc_what_are_typecodes
368    *
369    * @return the SED-ML typecode for the objects contained in this
370    * SedListOfDataSets:
371    * @sedmlconstant{SEDML_OUTPUT_DATASET, SedTypeCode_t}.
372    *
373    * @copydetails doc_warning_typecodes_not_unique
374    *
375    * @see getElementName()
376    */
377   virtual int getItemTypeCode() const;
378 
379 
380 
381 
382   #ifndef SWIG
383 
384 
385 
386 
387   #endif /* !SWIG */
388 
389 
390 protected:
391 
392 
393   /** @cond doxygenLibSEDMLInternal */
394 
395   /**
396    * Creates a new SedDataSet in this SedListOfDataSets
397    */
398   virtual SedBase* createObject(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream&
399     stream);
400 
401   /** @endcond */
402 
403 
404 };
405 
406 
407 
408 LIBSEDML_CPP_NAMESPACE_END
409 
410 
411 
412 
413 #endif /* __cplusplus */
414 
415 
416 
417 
418 #ifndef SWIG
419 
420 
421 
422 
423 LIBSEDML_CPP_NAMESPACE_BEGIN
424 
425 
426 
427 
428 BEGIN_C_DECLS
429 
430 
431 /**
432  * Get a SedDataSet_t from the SedListOf_t.
433  *
434  * @param slo the SedListOf_t structure to search.
435  *
436  * @param n an unsigned int representing the index of the SedDataSet_t to
437  * retrieve.
438  *
439  * @return the nth SedDataSet_t in this SedListOf_t or @c NULL if no such
440  * object exists.
441  *
442  * @copydetails doc_returned_unowned_pointer
443  *
444  * @memberof SedListOfDataSets_t
445  */
446 LIBSEDML_EXTERN
447 SedDataSet_t*
448 SedListOfDataSets_getDataSet(SedListOf_t* slo, unsigned int n);
449 
450 
451 /**
452  * Get a SedDataSet_t from the SedListOf_t based on its identifier.
453  *
454  * @param slo the SedListOf_t structure to search.
455  *
456  * @param sid a string representing the identifier of the SedDataSet_t to
457  * retrieve.
458  *
459  * @return the SedDataSet_t in this SedListOf_t with the given @p sid or
460  * @c NULL if no such SedDataSet_t exists.
461  *
462  * @copydetails doc_returned_unowned_pointer
463  *
464  * @memberof SedListOfDataSets_t
465  */
466 LIBSEDML_EXTERN
467 SedDataSet_t*
468 SedListOfDataSets_getById(SedListOf_t* slo, const char *sid);
469 
470 
471 /**
472  * Removes the nth SedDataSet_t from this SedListOf_t and returns a pointer to
473  * it.
474  *
475  * @param slo the SedListOf_t structure to search.
476  *
477  * @param n an unsigned int representing the index of the SedDataSet_t to
478  * remove.
479  *
480  * @return a pointer to the nth SedDataSet_t in this SedListOf_t.
481  *
482  * @copydetails doc_warning_returns_owned_pointer
483  *
484  * @memberof SedListOfDataSets_t
485  */
486 LIBSEDML_EXTERN
487 SedDataSet_t*
488 SedListOfDataSets_remove(SedListOf_t* slo, unsigned int n);
489 
490 
491 /**
492  * Removes the SedDataSet_t from this SedListOf_t based on its identifier and
493  * returns a pointer to it.
494  *
495  * @param slo the SedListOf_t structure to search.
496  *
497  * @param sid a string representing the identifier of the SedDataSet_t to
498  * remove.
499  *
500  * @return the SedDataSet_t in this SedListOf_t based on the identifier or NULL
501  * if no such SedDataSet_t exists.
502  *
503  * @copydetails doc_warning_returns_owned_pointer
504  *
505  * @memberof SedListOfDataSets_t
506  */
507 LIBSEDML_EXTERN
508 SedDataSet_t*
509 SedListOfDataSets_removeById(SedListOf_t* slo, const char* sid);
510 
511 
512 
513 
514 END_C_DECLS
515 
516 
517 
518 
519 LIBSEDML_CPP_NAMESPACE_END
520 
521 
522 
523 
524 #endif /* !SWIG */
525 
526 
527 
528 
529 #endif /* !SedListOfDataSets_H__ */
530 
531 
532