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