1 //------------------------------------------------------------------------------ 2 // <auto-generated /> 3 // 4 // This file was automatically generated by SWIG (http://www.swig.org). 5 // Version 4.0.2 6 // 7 // Do not make changes to this file unless you know what you are doing--modify 8 // the SWIG interface file instead. 9 //------------------------------------------------------------------------------ 10 11 namespace libsbml { 12 13 using System; 14 using System.Runtime.InteropServices; 15 16 /** 17 * @sbmlpackage{core} 18 * 19 @htmlinclude pkg-marker-core.html A list of Event objects. 20 * 21 * 22 * 23 * The various ListOf___ @if conly structures @else classes@endif in SBML 24 * are merely containers used for organizing the main components of an SBML 25 * model. In libSBML's implementation, ListOf___ 26 * @if conly data structures @else classes@endif are derived from the 27 * intermediate utility @if conly structure @else class@endif ListOf, which 28 * is not defined by the SBML specifications but serves as a useful 29 * programmatic construct. ListOf is itself is in turn derived from SBase, 30 * which provides all of the various ListOf___ 31 * @if conly data structures @else classes@endif with common features 32 * defined by the SBML specification, such as 'metaid' attributes and 33 * annotations. 34 * 35 * The relationship between the lists and the rest of an SBML model is 36 * illustrated by the following (for SBML Level 2 Version 4): 37 * 38 * @htmlinclude listof-illustration.html 39 * 40 * SBML Level 3 Version 1 has essentially the same structure as 41 * Level 2 Version 4, depicted above, but SBML Level 3 42 * Version 2 allows 43 * containers to contain zero or more of the relevant object, instead of 44 * requiring at least one. As such, libsbml will write out an 45 * otherwise-empty ListOf___ element that has any optional attribute set 46 * (such as 'id' or 'metaid'), that has an optional child (such 47 * as a 'notes' or 'annotation'), or that has attributes or children set 48 * from any SBML Level 3 package, whether or not the ListOf___ has 49 * any other children. 50 * 51 * Readers may wonder about the motivations for using the ListOf___ 52 * containers in SBML. A simpler approach in XML might be to place the 53 * components all directly at the top level of the model definition. The 54 * choice made in SBML is to group them within XML elements named after 55 * %ListOf<em>Classname</em>, in part because it helps organize the 56 * components. More importantly, the fact that the container classes are 57 * derived from SBase means that software tools can add information @em about 58 * the lists themselves into each list container's 'annotation'. 59 * 60 * @see ListOfFunctionDefinitions 61 * @see ListOfUnitDefinitions 62 * @see ListOfCompartmentTypes 63 * @see ListOfSpeciesTypes 64 * @see ListOfCompartments 65 * @see ListOfSpecies 66 * @see ListOfParameters 67 * @see ListOfInitialAssignments 68 * @see ListOfRules 69 * @see ListOfConstraints 70 * @see ListOfReactions 71 * @see ListOfEvents 72 * 73 * @if conly 74 * @note In the C API for libSBML, functions that in other language APIs 75 * would be inherited by the various ListOf___ structures not shown in the 76 * pages for the individual ListOf___'s. Instead, the functions are defined 77 * on ListOf_t. <strong>Please consult the documentation for ListOf_t for 78 * the many common functions available for manipulating ListOf___ 79 * structures</strong>. The documentation for the individual ListOf___ 80 * structures (ListOfCompartments_t, ListOfReactions_t, etc.) does not reveal 81 * all of the functionality available. @endif 82 * 83 * 84 */ 85 86 public class ListOfEvents : ListOf { 87 private HandleRef swigCPtr; 88 ListOfEvents(IntPtr cPtr, bool cMemoryOwn)89 internal ListOfEvents(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.ListOfEvents_SWIGUpcast(cPtr), cMemoryOwn) 90 { 91 //super(libsbmlPINVOKE.ListOfEventsUpcast(cPtr), cMemoryOwn); 92 swigCPtr = new HandleRef(this, cPtr); 93 } 94 getCPtr(ListOfEvents obj)95 internal static HandleRef getCPtr(ListOfEvents obj) 96 { 97 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 98 } 99 getCPtrAndDisown(ListOfEvents obj)100 internal static HandleRef getCPtrAndDisown (ListOfEvents obj) 101 { 102 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 103 104 if (obj != null) 105 { 106 ptr = obj.swigCPtr; 107 obj.swigCMemOwn = false; 108 } 109 110 return ptr; 111 } 112 Dispose(bool disposing)113 protected override void Dispose(bool disposing) { 114 lock(this) { 115 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 116 if (swigCMemOwn) { 117 swigCMemOwn = false; 118 libsbmlPINVOKE.delete_ListOfEvents(swigCPtr); 119 } 120 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 121 } 122 base.Dispose(disposing); 123 } 124 } 125 126 127 /** 128 * Creates a new ListOfEvents object. 129 * 130 * The object is constructed such that it is valid for the given SBML 131 * Level and Version combination. 132 * 133 * @param level the SBML Level. 134 * 135 * @param version the Version within the SBML Level. 136 * 137 * 138 * @throws SBMLConstructorException 139 * Thrown if the given @p level and @p version combination are invalid 140 * or if this object is incompatible with the given level and version. 141 * 142 * 143 * 144 * 145 * @note Attempting to add an object to an SBMLDocument having a different 146 * combination of SBML Level, Version and XML namespaces than the object 147 * itself will result in an error at the time a caller attempts to make the 148 * addition. A parent object must have compatible Level, Version and XML 149 * namespaces. (Strictly speaking, a parent may also have more XML 150 * namespaces than a child, but the reverse is not permitted.) The 151 * restriction is necessary to ensure that an SBML model has a consistent 152 * overall structure. This requires callers to manage their objects 153 * carefully, but the benefit is increased flexibility in how models can be 154 * created by permitting callers to create objects bottom-up if desired. In 155 * situations where objects are not yet attached to parents (e.g., 156 * SBMLDocument), knowledge of the intented SBML Level and Version help 157 * libSBML determine such things as whether it is valid to assign a 158 * particular value to an attribute. 159 * 160 * 161 */ public ListOfEvents(long level, long version)162 ListOfEvents(long level, long version) : this(libsbmlPINVOKE.new_ListOfEvents__SWIG_0(level, version), true) { 163 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 164 } 165 166 167 /** 168 * Creates a new ListOfEvents object. 169 * 170 * The object is constructed such that it is valid for the SBML Level and 171 * Version combination determined by the SBMLNamespaces object in @p 172 * sbmlns. 173 * 174 * @param sbmlns an SBMLNamespaces object that is used to determine the 175 * characteristics of the ListOfEvents object to be created. 176 * 177 * 178 * @throws SBMLConstructorException 179 * Thrown if the given @p sbmlns is inconsistent or incompatible 180 * with this object. 181 * 182 * 183 * 184 * 185 * @note Attempting to add an object to an SBMLDocument having a different 186 * combination of SBML Level, Version and XML namespaces than the object 187 * itself will result in an error at the time a caller attempts to make the 188 * addition. A parent object must have compatible Level, Version and XML 189 * namespaces. (Strictly speaking, a parent may also have more XML 190 * namespaces than a child, but the reverse is not permitted.) The 191 * restriction is necessary to ensure that an SBML model has a consistent 192 * overall structure. This requires callers to manage their objects 193 * carefully, but the benefit is increased flexibility in how models can be 194 * created by permitting callers to create objects bottom-up if desired. In 195 * situations where objects are not yet attached to parents (e.g., 196 * SBMLDocument), knowledge of the intented SBML Level and Version help 197 * libSBML determine such things as whether it is valid to assign a 198 * particular value to an attribute. 199 * 200 * 201 */ public ListOfEvents(SBMLNamespaces sbmlns)202 ListOfEvents(SBMLNamespaces sbmlns) : this(libsbmlPINVOKE.new_ListOfEvents__SWIG_1(SBMLNamespaces.getCPtr(sbmlns)), true) { 203 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 204 } 205 206 207 /** 208 * Creates and returns a deep copy of this ListOfEvents object. 209 * 210 * @return the (deep) copy of this ListOfEvents object. 211 */ public new clone()212 ListOfEvents clone() { 213 global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfEvents_clone(swigCPtr); 214 ListOfEvents ret = (cPtr == global::System.IntPtr.Zero) ? null : new ListOfEvents(cPtr, true); 215 return ret; 216 } 217 218 219 /** 220 * Returns the libSBML type code for the objects contained in this ListOf 221 * (i.e., Event objects, if the list is non-empty). 222 * 223 * 224 * 225 * LibSBML attaches an identifying code to every kind of SBML object. These 226 * are integer constants known as <em>SBML type codes</em>. The names of all 227 * the codes begin with the characters <code>SBML_</code>. 228 * @if clike The set of possible type codes for core elements is defined in 229 * the enumeration #SBMLTypeCode_t, and in addition, libSBML plug-ins for 230 * SBML Level 3 packages define their own extra enumerations of type 231 * codes (e.g., #SBMLLayoutTypeCode_t for the Level 3 Layout 232 * package).@endif@if java In the Java language interface for libSBML, the 233 * type codes are defined as static integer constants in the interface class 234 * {@link libsbmlConstants}. @endif@if python In the Python language 235 * interface for libSBML, the type codes are defined as static integer 236 * constants in the interface class @link libsbml@endlink.@endif@if csharp In 237 * the C# language interface for libSBML, the type codes are defined as 238 * static integer constants in the interface class 239 * @link libsbmlcs.libsbml@endlink.@endif Note that different Level 3 240 * package plug-ins may use overlapping type codes; to identify the package 241 * to which a given object belongs, call the 242 * <code>@if conly SBase_getPackageName() 243 * @else SBase::getPackageName() 244 * @endif</code> 245 * method on the object. 246 * 247 * The exception to this is lists: all SBML-style list elements have the type 248 * @link libsbml#SBML_LIST_OF SBML_LIST_OF@endlink, regardless of what package they 249 * are from. 250 * 251 * 252 * 253 * @return the SBML type code for the objects contained in this ListOf: 254 * @link libsbml#SBML_EVENT SBML_EVENT@endlink (default). 255 * 256 * @see getElementName() 257 * @see getPackageName() 258 */ public new getItemTypeCode()259 int getItemTypeCode() { 260 int ret = libsbmlPINVOKE.ListOfEvents_getItemTypeCode(swigCPtr); 261 return ret; 262 } 263 264 265 /** 266 * Returns the XML element name of this object. 267 * 268 * For ListOfEvents, the XML element name is @c 'listOfEvents'. 269 * 270 * @return the name of this element, i.e., @c 'listOfEvents'. 271 */ public new getElementName()272 string getElementName() { 273 string ret = libsbmlPINVOKE.ListOfEvents_getElementName(swigCPtr); 274 return ret; 275 } 276 277 278 /** 279 * Get an Event from the ListOfEvents. 280 * 281 * @param n the index number of the Event to get. 282 * 283 * @return the <code>n</code>th Event in this ListOfEvents. 284 * 285 * @see size() 286 */ public new get(long n)287 Event get(long n) { 288 global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfEvents_get__SWIG_0(swigCPtr, n); 289 Event ret = (cPtr == global::System.IntPtr.Zero) ? null : new Event(cPtr, false); 290 return ret; 291 } 292 293 294 /** 295 * Get an Event from the ListOfEvents 296 * based on its identifier. 297 * 298 * @param sid a string representing the identifier 299 * of the Event to get. 300 * 301 * @return Event in this ListOfEvents 302 * with the given @p sid or @c null if no such 303 * Event exists. 304 * 305 * @see get(unsigned int n) 306 * @see size() 307 */ public new get(string sid)308 Event get(string sid) { 309 global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfEvents_get__SWIG_2(swigCPtr, sid); 310 Event ret = (cPtr == global::System.IntPtr.Zero) ? null : new Event(cPtr, false); 311 return ret; 312 } 313 314 315 /** 316 * Removes the nth item from this ListOfEvents items and returns a pointer to 317 * it. 318 * 319 * The caller owns the returned item and is responsible for deleting it. 320 * 321 * @param n the index of the item to remove. 322 * 323 * @see size() 324 */ public new remove(long n)325 Event remove(long n) { 326 global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfEvents_remove__SWIG_0(swigCPtr, n); 327 Event ret = (cPtr == global::System.IntPtr.Zero) ? null : new Event(cPtr, true); 328 return ret; 329 } 330 331 332 /** 333 * Removes item in this ListOfEvents items with the given identifier. 334 * 335 * The caller owns the returned item and is responsible for deleting it. 336 * If none of the items in this list have the identifier @p sid, then 337 * @c null is returned. 338 * 339 * @param sid the identifier of the item to remove. 340 * 341 * @return the item removed. As mentioned above, the caller owns the 342 * returned item. 343 */ public new remove(string sid)344 Event remove(string sid) { 345 global::System.IntPtr cPtr = libsbmlPINVOKE.ListOfEvents_remove__SWIG_1(swigCPtr, sid); 346 Event ret = (cPtr == global::System.IntPtr.Zero) ? null : new Event(cPtr, true); 347 return ret; 348 } 349 350 } 351 352 } 353