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 Registry where package extensions are registered. 20 * 21 * @htmlinclude not-sbml-warning.html 22 * 23 * This class provides a central registry of all extensions known to libSBML. 24 * Each package extension must be registered with the registry. The registry 25 * class is accessed by various classes to retrieve information about known 26 * package extensions and to create additional attributes and/or elements by 27 * factory objects of the package extensions. 28 * 29 * 30 * 31 * The package extension registry is implemented as a singleton instance of 32 * SBMLExtensionRegistry. The class provides only utility functionality; 33 * implementations of SBML packages do not need to implement any subclasses or 34 * methods of this class. SBMLExtensionRegistry is useful for its facilities 35 * to query the known packages, and to enable or disable packages selectively. 36 * 37 * 38 */ 39 40 public class SBMLExtensionRegistry : global::System.IDisposable { 41 private HandleRef swigCPtr; 42 protected bool swigCMemOwn; 43 SBMLExtensionRegistry(IntPtr cPtr, bool cMemoryOwn)44 internal SBMLExtensionRegistry(IntPtr cPtr, bool cMemoryOwn) 45 { 46 swigCMemOwn = cMemoryOwn; 47 swigCPtr = new HandleRef(this, cPtr); 48 } 49 getCPtr(SBMLExtensionRegistry obj)50 internal static HandleRef getCPtr(SBMLExtensionRegistry obj) 51 { 52 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 53 } 54 getCPtrAndDisown(SBMLExtensionRegistry obj)55 internal static HandleRef getCPtrAndDisown (SBMLExtensionRegistry obj) 56 { 57 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 58 59 if (obj != null) 60 { 61 ptr = obj.swigCPtr; 62 obj.swigCMemOwn = false; 63 } 64 65 return ptr; 66 } 67 ~SBMLExtensionRegistry()68 ~SBMLExtensionRegistry() { 69 Dispose(false); 70 } 71 Dispose()72 public void Dispose() { 73 Dispose(true); 74 global::System.GC.SuppressFinalize(this); 75 } 76 Dispose(bool disposing)77 protected virtual void Dispose(bool disposing) { 78 lock(this) { 79 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 80 if (swigCMemOwn) { 81 swigCMemOwn = false; 82 throw new global::System.MethodAccessException("C++ destructor does not have public access"); 83 } 84 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 85 } 86 } 87 } 88 89 90 /** 91 * Returns a singleton instance of the registry. 92 * 93 * Callers need to obtain a copy of the package extension registry before 94 * they can invoke its methods. The registry is implemented as a 95 * singleton, and this is the method callers can use to get a copy of it. 96 * 97 * @return the instance of the SBMLExtensionRegistry object. 98 */ public getInstance()99 static SBMLExtensionRegistry getInstance() { 100 SBMLExtensionRegistry ret = new SBMLExtensionRegistry(libsbmlPINVOKE.SBMLExtensionRegistry_getInstance(), false); 101 return ret; 102 } 103 104 105 /** 106 * Add the given SBMLExtension object to this SBMLExtensionRegistry. 107 * 108 * @param ext the SBMLExtension object to be added. 109 * 110 * 111 * @return integer value indicating success/failure of the 112 * function. @if clike The value is drawn from the 113 * enumeration #OperationReturnValues_t. @endif The possible values 114 * returned by this function are: 115 * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink 116 * @li @link libsbml#LIBSBML_PKG_CONFLICT LIBSBML_PKG_CONFLICT@endlink 117 * @li @link libsbml#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE@endlink 118 */ public addExtension(SBMLExtension ext)119 int addExtension(SBMLExtension ext) { 120 int ret = libsbmlPINVOKE.SBMLExtensionRegistry_addExtension(swigCPtr, SBMLExtension.getCPtr(ext)); 121 return ret; 122 } 123 124 125 /** 126 * Returns an SBMLExtension object with the given package URI or package 127 * name. 128 * 129 * @param package a string representing the URI or name of the SBML package 130 * whose package extension is being sought. 131 * 132 * @return a clone of the SBMLExtension object with the given package URI 133 * or name. 134 * 135 * @note The caller is responsible for freeing the object returned. Since 136 * the object is a clone, freeing it will not result in the deletion of the 137 * original package extension object. 138 */ public getExtension(string package)139 SBMLExtension getExtension(string package) { 140 SBMLExtension ret 141 = (SBMLExtension) libsbml.DowncastExtension(libsbmlPINVOKE.SBMLExtensionRegistry_getExtension(swigCPtr, package), false); 142 return ret; 143 } 144 145 146 /** 147 * Removes SBML Level 2 namespaces from the namespace list. 148 * 149 * @if clike 150 * This will call all overridden 151 * <code>SBMLExtension::removeL2Namespaces()</code> methods. 152 * @endif 153 * 154 * @param xmlns an XMLNamespaces object listing one or more namespaces 155 * to be removed. 156 */ public removeL2Namespaces(XMLNamespaces xmlns)157 void removeL2Namespaces(XMLNamespaces xmlns) { 158 libsbmlPINVOKE.SBMLExtensionRegistry_removeL2Namespaces(swigCPtr, XMLNamespaces.getCPtr(xmlns)); 159 } 160 161 162 /** 163 * Adds SBML Level 2 namespaces to the namespace list. 164 * 165 * @if clike 166 * This will call all overridden 167 * <code>SBMLExtension::addL2Namespaces()</code> methods. 168 * @endif 169 * 170 * @param xmlns an XMLNamespaces object providing one or more namespaces to 171 * be added. 172 */ public addL2Namespaces(XMLNamespaces xmlns)173 void addL2Namespaces(XMLNamespaces xmlns) { 174 libsbmlPINVOKE.SBMLExtensionRegistry_addL2Namespaces(swigCPtr, XMLNamespaces.getCPtr(xmlns)); 175 } 176 177 178 /** 179 * Enables package extensions that support serialization to SBML annotations. 180 * 181 * SBML Level 2 does not have a package mechanism in the way that SBML 182 * Level 3 does. However, SBML annotations can be used to store SBML 183 * constructs. In fact, a widely-used approach to developing SBML 184 * Level 3 packages involves first using them as annotations. 185 * 186 * @param doc the SBMLDocument object for which this should be enabled. 187 */ public enableL2NamespaceForDocument(SBMLDocument doc)188 void enableL2NamespaceForDocument(SBMLDocument doc) { 189 libsbmlPINVOKE.SBMLExtensionRegistry_enableL2NamespaceForDocument(swigCPtr, SBMLDocument.getCPtr(doc)); 190 } 191 192 193 /** 194 * Disables unused packages. 195 * 196 * This method walks through all extensions in the list of plugins of the 197 * given SBML document @p doc, and disables all that are not being used. 198 * 199 * @param doc the SBMLDocument object whose unused package extensions 200 * should be disabled. 201 */ public disableUnusedPackages(SBMLDocument doc)202 void disableUnusedPackages(SBMLDocument doc) { 203 libsbmlPINVOKE.SBMLExtensionRegistry_disableUnusedPackages(swigCPtr, SBMLDocument.getCPtr(doc)); 204 } 205 206 207 /** 208 * Disables the package with the given URI or name. 209 * 210 * @param package a string representing the URI or name of the SBML package 211 * whose package extension is to be disabled. 212 */ public disablePackage(string package)213 static void disablePackage(string package) { 214 libsbmlPINVOKE.SBMLExtensionRegistry_disablePackage(package); 215 } 216 217 218 /** 219 * Returns @c true if the named package is enabled. 220 * 221 * @param package the name or URI of a package to test. 222 * 223 * @return @c true if the package is enabled, @c false otherwise. 224 */ public isPackageEnabled(string package)225 static bool isPackageEnabled(string package) { 226 bool ret = libsbmlPINVOKE.SBMLExtensionRegistry_isPackageEnabled(package); 227 return ret; 228 } 229 230 231 /** 232 * Enables the package with the given URI / name. 233 * 234 * @param package the name or URI of a package to enable. 235 */ public enablePackage(string package)236 static void enablePackage(string package) { 237 libsbmlPINVOKE.SBMLExtensionRegistry_enablePackage(package); 238 } 239 240 241 /** 242 * Returns the number of extensions that have a given extension point. 243 * 244 * @param extPoint the SBaseExtensionPoint object. 245 * 246 * @return the number of SBMLExtension-derived objects with the given 247 * extension point. 248 */ public getNumExtension(SBaseExtensionPoint extPoint)249 long getNumExtension(SBaseExtensionPoint extPoint) { return (long)libsbmlPINVOKE.SBMLExtensionRegistry_getNumExtension(swigCPtr, SBaseExtensionPoint.getCPtr(extPoint)); } 250 251 252 /** 253 * Enables or disable the package with the given URI. 254 * 255 * @param uri the URI of the target package. 256 * @param isEnabled @c true to enable the package, @c false to disable. 257 * 258 * @return @c false if @p isEnabled is @c false or the given package is not 259 * registered, otherwise this method returns @c true. 260 */ public setEnabled(string uri, bool isEnabled)261 bool setEnabled(string uri, bool isEnabled) { 262 bool ret = libsbmlPINVOKE.SBMLExtensionRegistry_setEnabled(swigCPtr, uri, isEnabled); 263 return ret; 264 } 265 266 267 /** 268 * Returns @c true if the given extension is enabled. 269 * 270 * @param uri the URI of the target package. 271 * 272 * @return @c false if the given package is disabled or not registered, 273 * @c true otherwise. 274 */ public isEnabled(string uri)275 bool isEnabled(string uri) { 276 bool ret = libsbmlPINVOKE.SBMLExtensionRegistry_isEnabled(swigCPtr, uri); 277 return ret; 278 } 279 280 281 /** 282 * Returns @c true if a package extension is registered for the 283 * corresponding package URI. 284 * 285 * @param uri the URI of the target package. 286 * 287 * @return @c true if the package with the given URI is registered, 288 * otherwise returns @c false. 289 */ public isRegistered(string uri)290 bool isRegistered(string uri) { 291 bool ret = libsbmlPINVOKE.SBMLExtensionRegistry_isRegistered(swigCPtr, uri); 292 return ret; 293 } 294 295 296 /** 297 * Returns a list of registered packages. 298 * 299 * This method returns a vector of strings containing the nicknames of the 300 * SBML packages for which package extensions are registered with this copy 301 * of libSBML. The vector will contain <code>string</code> objects. 302 * 303 * @return a vector of strings of the registered package names. 304 */ public getAllRegisteredPackageNames()305 static SWIGTYPE_p_std__vectorT_std__string_t getAllRegisteredPackageNames() { 306 SWIGTYPE_p_std__vectorT_std__string_t ret = new SWIGTYPE_p_std__vectorT_std__string_t(libsbmlPINVOKE.SBMLExtensionRegistry_getAllRegisteredPackageNames(), true); 307 return ret; 308 } 309 310 311 /** 312 * Returns the number of registered packages. 313 * 314 * @return a count of the registered package extensions. 315 * 316 * @if clike 317 * @see getRegisteredPackageNames() 318 * @endif 319 */ public getNumRegisteredPackages()320 static long getNumRegisteredPackages() { return (long)libsbmlPINVOKE.SBMLExtensionRegistry_getNumRegisteredPackages(); } 321 322 323 /** 324 * Returns the nth registered package. 325 * 326 * @param index zero-based index of the package name to return. 327 * 328 * @return the package name with the given index, or @c null if none 329 * such exists. 330 * 331 * @see getNumRegisteredPackages() 332 */ public getRegisteredPackageName(long index)333 static string getRegisteredPackageName(long index) { 334 string ret = libsbmlPINVOKE.SBMLExtensionRegistry_getRegisteredPackageName(index); 335 return ret; 336 } 337 338 339 /** */ public getASTPlugins()340 SWIGTYPE_p_std__vectorT_ASTBasePlugin_p_t getASTPlugins() { 341 SWIGTYPE_p_std__vectorT_ASTBasePlugin_p_t ret = new SWIGTYPE_p_std__vectorT_ASTBasePlugin_p_t(libsbmlPINVOKE.SBMLExtensionRegistry_getASTPlugins(swigCPtr), true); 342 return ret; 343 } 344 345 346 /** */ public getNumASTPlugins()347 long getNumASTPlugins() { return (long)libsbmlPINVOKE.SBMLExtensionRegistry_getNumASTPlugins(swigCPtr); } 348 349 350 /** */ public getASTPlugin(long i)351 ASTBasePlugin getASTPlugin(long i) { 352 ASTBasePlugin ret = (ASTBasePlugin) libsbml.DowncastASTBasePlugin(libsbmlPINVOKE.SBMLExtensionRegistry_getASTPlugin(swigCPtr, i), false); 353 return ret; 354 } 355 356 } 357 358 } 359