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 Converter to turn local parameters into global ones.
20  *
21  * @htmlinclude libsbml-facility-only-warning.html
22  *
23  * This converter essentially promotes local parameters to global parameters.
24  * It works by examining every Reaction object for LocalParameter objects,
25  * then creating Parameter objects on the model for each one found, and
26  * finally removing the original LocalParameter objects.  It creates new
27  * identifiers for the fresh Parameter objects by concatenating the
28  * identifier of the reaction with the identifier of the original
29  * LocalParameter object.
30  *
31  * This converter can be useful for software applications that do not have
32  * the ability to handle local parameters on reactions.  Such applications
33  * could check incoming models for local parameters and run those models
34  * through this converter before proceeding with other steps.
35  *
36  * @section SBMLLocalParameterConverter-usage Configuration and use of SBMLLocalParameterConverter
37  *
38  * SBMLLocalParameterConverter is enabled by creating a ConversionProperties
39  * object with the option @c 'promoteLocalParameters', and passing this
40  * properties object to SBMLDocument::convert(@if java
41  * ConversionProperties@endif).  The converter offers no other options.
42  *
43  *
44  * @section using-converters General information about the use of SBML converters
45  *
46  * The use of all the converters follows a similar approach.  First, one
47  * creates a ConversionProperties object and calls
48  * ConversionProperties::addOption(@if java ConversionOption@endif)
49  * on this object with one argument: a text string that identifies the desired
50  * converter.  (The text string is specific to each converter; consult the
51  * documentation for a given converter to find out how it should be enabled.)
52  *
53  * Next, for some converters, the caller can optionally set some
54  * converter-specific properties using additional calls to
55  * ConversionProperties::addOption(@if java ConversionOption@endif).
56  * Many converters provide the ability to
57  * configure their behavior to some extent; this is realized through the use
58  * of properties that offer different options.  The default property values
59  * for each converter can be interrogated using the method
60  * SBMLConverter::getDefaultProperties() on the converter class in question .
61  *
62  * Finally, the caller should invoke the method
63  * SBMLDocument::convert(@if java ConversionProperties@endif)
64  * with the ConversionProperties object as an argument.
65  *
66  * @subsection converter-example Example of invoking an SBML converter
67  *
68  * The following code fragment illustrates an example using
69  * SBMLReactionConverter, which is invoked using the option string
70  * @c 'replaceReactions':
71  *
72  * @if cpp
73  * @code{.cpp}
74 ConversionProperties props;
75 props.addOption('replaceReactions');
76 @endcode
77 @endif
78 @if python
79 @code{.py}
80 config = ConversionProperties()
81 if config != None:
82   config.addOption('replaceReactions')
83 @endcode
84 @endif
85 @if java
86 @code{.java}
87 ConversionProperties props = new ConversionProperties();
88 if (props != null) {
89   props.addOption('replaceReactions');
90 } else {
91   // Deal with error.
92 }
93 @endcode
94 @endif
95  *
96  * In the case of SBMLReactionConverter, there are no options to affect
97  * its behavior, so the next step is simply to invoke the converter on
98  * an SBMLDocument object.  Continuing the example code:
99  *
100  * @if cpp
101  * @code{.cpp}
102 // Assume that the variable 'document' has been set to an SBMLDocument object.
103 int status = document->convert(props);
104 if (status != LIBSBML_OPERATION_SUCCESS)
105 {
106   cerr << 'Unable to perform conversion due to the following:' << endl;
107   document->printErrors(cerr);
108 }
109 @endcode
110 @endif
111 @if python
112 @code{.py}
113   # Assume that the variable 'document' has been set to an SBMLDocument object.
114   status = document.convert(config)
115   if status != LIBSBML_OPERATION_SUCCESS:
116     # Handle error somehow.
117     print('Error: conversion failed due to the following:')
118     document.printErrors()
119 @endcode
120 @endif
121 @if java
122 @code{.java}
123   // Assume that the variable 'document' has been set to an SBMLDocument object.
124   status = document.convert(config);
125   if (status != libsbml.LIBSBML_OPERATION_SUCCESS)
126   {
127     // Handle error somehow.
128     System.out.println('Error: conversion failed due to the following:');
129     document.printErrors();
130   }
131 @endcode
132 @endif
133  *
134  * Here is an example of using a converter that offers an option. The
135  * following code invokes SBMLStripPackageConverter to remove the
136  * SBML Level&nbsp;3 @em %Layout package from a model.  It sets the name
137  * of the package to be removed by adding a value for the option named
138  * @c 'package' defined by that converter:
139  *
140  * @if cpp
141  * @code{.cpp}
142 ConversionProperties props;
143 props.addOption('stripPackage');
144 props.addOption('package', 'layout');
145 
146 int status = document->convert(props);
147 if (status != LIBSBML_OPERATION_SUCCESS)
148 {
149     cerr << 'Unable to strip the Layout package from the model';
150     cerr << 'Error returned: ' << status;
151 }
152 @endcode
153 @endif
154 @if python
155 @code{.py}
156 def strip_layout_example(document):
157   config = ConversionProperties()
158   if config != None:
159     config.addOption('stripPackage')
160     config.addOption('package', 'layout')
161     status = document.convert(config)
162     if status != LIBSBML_OPERATION_SUCCESS:
163       # Handle error somehow.
164       print('Error: unable to strip the Layout package.')
165       print('LibSBML returned error: ' + OperationReturnValue_toString(status).strip())
166   else:
167     # Handle error somehow.
168     print('Error: unable to create ConversionProperties object')
169 @endcode
170 @endif
171 @if java
172 @code{.java}
173 ConversionProperties config = new ConversionProperties();
174 if (config != None) {
175   config.addOption('stripPackage');
176   config.addOption('package', 'layout');
177   status = document.convert(config);
178   if (status != LIBSBML_OPERATION_SUCCESS) {
179     // Handle error somehow.
180     System.out.println('Error: unable to strip the Layout package');
181     document.printErrors();
182   }
183 } else {
184   // Handle error somehow.
185   System.out.println('Error: unable to create ConversionProperties object');
186 }
187 @endcode
188 @endif
189  *
190  * @subsection available-converters Available SBML converters in libSBML
191  *
192  * LibSBML provides a number of built-in converters; by convention, their
193  * names end in @em Converter. The following are the built-in converters
194  * provided by libSBML @htmlinclude libsbml-version.html:
195  *
196  * @copydetails doc_list_of_libsbml_converters
197  *
198  *
199  */
200 
201 public class SBMLLocalParameterConverter : SBMLConverter {
202 	private HandleRef swigCPtr;
203 
SBMLLocalParameterConverter(IntPtr cPtr, bool cMemoryOwn)204 	internal SBMLLocalParameterConverter(IntPtr cPtr, bool cMemoryOwn) : base(libsbmlPINVOKE.SBMLLocalParameterConverter_SWIGUpcast(cPtr), cMemoryOwn)
205 	{
206 		//super(libsbmlPINVOKE.SBMLLocalParameterConverterUpcast(cPtr), cMemoryOwn);
207 		swigCPtr = new HandleRef(this, cPtr);
208 	}
209 
getCPtr(SBMLLocalParameterConverter obj)210 	internal static HandleRef getCPtr(SBMLLocalParameterConverter obj)
211 	{
212 		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
213 	}
214 
getCPtrAndDisown(SBMLLocalParameterConverter obj)215 	internal static HandleRef getCPtrAndDisown (SBMLLocalParameterConverter obj)
216 	{
217 		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
218 
219 		if (obj != null)
220 		{
221 			ptr             = obj.swigCPtr;
222 			obj.swigCMemOwn = false;
223 		}
224 
225 		return ptr;
226 	}
227 
Dispose(bool disposing)228   protected override void Dispose(bool disposing) {
229     lock(this) {
230       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
231         if (swigCMemOwn) {
232           swigCMemOwn = false;
233           libsbmlPINVOKE.delete_SBMLLocalParameterConverter(swigCPtr);
234         }
235         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
236       }
237       base.Dispose(disposing);
238     }
239   }
240 
241 
242 /** */ /* libsbml-internal */ public
init()243  static void init() {
244     libsbmlPINVOKE.SBMLLocalParameterConverter_init();
245   }
246 
247 
248 /**
249    * Creates a new SBMLLocalParameterConverter object.
250    */ public
SBMLLocalParameterConverter()251  SBMLLocalParameterConverter() : this(libsbmlPINVOKE.new_SBMLLocalParameterConverter__SWIG_0(), true) {
252   }
253 
254 
255 /**
256    * Copy constructor; creates a copy of an SBMLLocalParameterConverter
257    * object.
258    *
259    * @param obj the SBMLLocalParameterConverter object to copy.
260    */ public
SBMLLocalParameterConverter(SBMLLocalParameterConverter obj)261  SBMLLocalParameterConverter(SBMLLocalParameterConverter obj) : this(libsbmlPINVOKE.new_SBMLLocalParameterConverter__SWIG_1(SBMLLocalParameterConverter.getCPtr(obj)), true) {
262     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
263   }
264 
265 
266 /**
267    * Creates and returns a deep copy of this SBMLLocalParameterConverter
268    * object.
269    *
270    * @return a (deep) copy of this converter.
271    */ public new
clone()272  SBMLConverter clone() {
273     global::System.IntPtr cPtr = libsbmlPINVOKE.SBMLLocalParameterConverter_clone(swigCPtr);
274     SBMLLocalParameterConverter ret = (cPtr == global::System.IntPtr.Zero) ? null : new SBMLLocalParameterConverter(cPtr, true);
275     return ret;
276   }
277 
278 
279 /**
280    * Returns @c true if this converter object's properties match the given
281    * properties.
282    *
283    * A typical use of this method involves creating a ConversionProperties
284    * object, setting the options desired, and then calling this method on
285    * an SBMLLocalParameterConverter object to find out if the object's
286    * property values match the given ones.  This method is also used by
287    * SBMLConverterRegistry::getConverterFor(@if java ConversionProperties@endif)
288    * to search across all registered converters for one matching particular
289    * properties.
290    *
291    * @param props the properties to match.
292    *
293    * @return @c true if this converter's properties match, @c false
294    * otherwise.
295    */ public new
matchesProperties(ConversionProperties props)296  bool matchesProperties(ConversionProperties props) {
297     bool ret = libsbmlPINVOKE.SBMLLocalParameterConverter_matchesProperties(swigCPtr, ConversionProperties.getCPtr(props));
298     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
299     return ret;
300   }
301 
302 
303 /**
304    * Perform the conversion.
305    *
306    * This method causes the converter to do the actual conversion work,
307    * that is, to convert the SBMLDocument object set by
308    * SBMLConverter::setDocument(@if java SBMLDocument@endif) and
309    * with the configuration options set by
310    * SBMLConverter::setProperties(@if java ConversionProperties@endif).
311    *
312    *
313  * @return integer value indicating success/failure of the
314  * function.  @if clike The value is drawn from the
315  * enumeration #OperationReturnValues_t. @endif The possible values
316  * returned by this function are:
317  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
318    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
319    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
320    */ public new
convert()321  int convert() {
322     int ret = libsbmlPINVOKE.SBMLLocalParameterConverter_convert(swigCPtr);
323     return ret;
324   }
325 
326 
327 /**
328    * Returns the default properties of this converter.
329    *
330    * A given converter exposes one or more properties that can be adjusted
331    * in order to influence the behavior of the converter.  This method
332    * returns the @em default property settings for this converter.  It is
333    * meant to be called in order to discover all the settings for the
334    * converter object.
335    *
336    * @return the ConversionProperties object describing the default properties
337    * for this converter.
338    */ public new
getDefaultProperties()339  ConversionProperties getDefaultProperties() {
340     ConversionProperties ret = new ConversionProperties(libsbmlPINVOKE.SBMLLocalParameterConverter_getDefaultProperties(swigCPtr), true);
341     return ret;
342   }
343 
344 }
345 
346 }
347