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