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