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