File: local.cpp

package info (click to toggle)
libsbml 5.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 141,800 kB
  • ctags: 98,793
  • sloc: cpp: 804,405; xml: 206,907; ansic: 66,144; cs: 52,916; java: 25,093; python: 23,449; sh: 9,847; perl: 8,414; makefile: 7,580; ruby: 4,760; csh: 3
file content (279 lines) | stat: -rw-r--r-- 7,544 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
/**
 * \file    local.cpp
 * \brief   Perl-specific SWIG support code for wrapping libSBML API
 * \author  Ben Bornstein and Ben Kovitz
 * 
 * Copyright 2004 California Institute of Technology and
 * Japan Science and Technology Corporation.
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published
 * by the Free Software Foundation; either version 2.1 of the License, or
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  The software and
 * documentation provided hereunder is on an "as is" basis, and the
 * California Institute of Technology and Japan Science and Technology
 * Corporation have no obligations to provide maintenance, support,
 * updates, enhancements or modifications.  In no event shall the
 * California Institute of Technology or the Japan Science and Technology
 * Corporation be liable to any party for direct, indirect, special,
 * incidental or consequential damages, including lost profits, arising
 * out of the use of this software and its documentation, even if the
 * California Institute of Technology and/or Japan Science and Technology
 * Corporation have been advised of the possibility of such damage.  See
 * the GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * The original code contained here was initially developed by:
 *
 *     Ben Bornstein and Ben Kovitz
 *
 *     The SBML Team
 *     Control and Dynamical Systems, MC 107-81
 *     California Institute of Technology
 *     Pasadena, CA, 91125, USA
 *
 *     http://sbml.org
 *     mailto:sbml-team@caltech.edu
 *
 * Contributor(s):
 */

#include "sbml/SBase.h"


/**
 * @return the most specific Swig type for the given SBMLExtension object.
 */
struct swig_type_info*
GetDowncastSwigType (SBMLExtension* se)
{
	if (se == 0) return SWIGTYPE_p_SBMLExtension;
	
	const std::string pkgName = se->getName();

#include "local-downcast-extension.cpp"	

	return SWIGTYPE_p_SBMLExtension;
}


/**
 * @return the most specific Swig type for the given SBMLNamespaces object.
 */
struct swig_type_info*
GetDowncastSwigType (SBMLNamespaces* se)
{
	if (se == 0) return SWIGTYPE_p_SBMLNamespaces;
	
	const std::string pkgName = se->getPackageName();
	
#include "local-downcast-namespaces.cpp"
	
	return SWIGTYPE_p_SBMLNamespaces;
}

/**
 * @return the most specific Swig type for the given SBasePlugin object.
 */
struct swig_type_info*
GetDowncastSwigType (SBasePlugin* sbp)
{
	if (sbp == 0) return SWIGTYPE_p_SBasePlugin;
	
	const std::string pkgName = sbp->getPackageName();
	SBase* sb = sbp->getParentSBMLObject();
	if (!sb) return SWIGTYPE_p_SBasePlugin;

#include "local-downcast-plugins.cpp"
		
	return SWIGTYPE_p_SBasePlugin;
}


struct swig_type_info*
GetDowncastSwigTypeForPackage (SBase* sb, const std::string &pkgName);

/**
 * @return the most specific Swig type for the given SBase object.
 */
struct swig_type_info*
GetDowncastSwigType (SBase* sb)
{
  if (sb == 0) return SWIGTYPE_p_SBase;  
  const std::string pkgName = sb->getPackageName();
  return GetDowncastSwigTypeForPackage(sb, pkgName);
}
/**
 * @return the most specific Swig type for the given SBase object.
 */
struct swig_type_info*
GetDowncastSwigTypeForPackage (SBase* sb, const std::string &pkgName)
{
  if (sb == 0) return SWIGTYPE_p_SBase;
  
  std::string name;
	
	if (pkgName == "core")
	{
		switch (sb->getTypeCode())
		{
			case SBML_COMPARTMENT:
				return SWIGTYPE_p_Compartment;
				
			case SBML_COMPARTMENT_TYPE:
				return SWIGTYPE_p_CompartmentType;
				
			case SBML_CONSTRAINT:
				return SWIGTYPE_p_Constraint;
				
			case SBML_DOCUMENT:
				return SWIGTYPE_p_SBMLDocument;
				
			case SBML_EVENT:
				return SWIGTYPE_p_Event;
				
			case SBML_EVENT_ASSIGNMENT:
				return SWIGTYPE_p_EventAssignment;
				
			case SBML_FUNCTION_DEFINITION:
				return SWIGTYPE_p_FunctionDefinition;
				
			case SBML_INITIAL_ASSIGNMENT:
				return SWIGTYPE_p_InitialAssignment;
				
			case SBML_KINETIC_LAW:
				return SWIGTYPE_p_KineticLaw;
				
			case SBML_LIST_OF:
				name = sb->getElementName();
				if(name == "listOf"){
					return SWIGTYPE_p_ListOf;
				}
				else if(name == "listOfCompartments"){
					return SWIGTYPE_p_ListOfCompartments;
				}
				else if(name == "listOfCompartmentTypes"){
					return SWIGTYPE_p_ListOfCompartmentTypes;
				}
				else if(name == "listOfConstraints"){
					return SWIGTYPE_p_ListOfConstraints;
				}
				else if(name == "listOfEvents"){
					return SWIGTYPE_p_ListOfEvents;
				}
				else if(name == "listOfEventAssignments"){
					return SWIGTYPE_p_ListOfEventAssignments;
				}
				else if(name == "listOfFunctionDefinitions"){
					return SWIGTYPE_p_ListOfFunctionDefinitions;
				}
				else if(name == "listOfInitialAssignments"){
					return SWIGTYPE_p_ListOfInitialAssignments;
				}
				else if(name == "listOfParameters"){
					return SWIGTYPE_p_ListOfParameters;
				}
				else if(name == "listOfLocalParameters"){
					return SWIGTYPE_p_ListOfLocalParameters;
				}
				else if(name == "listOfReactions"){
					return SWIGTYPE_p_ListOfReactions;
				}
				else if(name == "listOfRules"){
					return SWIGTYPE_p_ListOfRules;
				}
				else if(name == "listOfSpecies"){
					return SWIGTYPE_p_ListOfSpecies;
				}
				else if(name == "listOfUnknowns"){
					return SWIGTYPE_p_ListOfSpeciesReferences;
				}
				else if(name == "listOfReactants"){
					return SWIGTYPE_p_ListOfSpeciesReferences;
				}
				else if(name == "listOfProducts"){
					return SWIGTYPE_p_ListOfSpeciesReferences;
				}
				else if(name == "listOfModifiers"){
					return SWIGTYPE_p_ListOfSpeciesReferences;
				}
				else if(name == "listOfSpeciesTypes"){
					return SWIGTYPE_p_ListOfSpeciesTypes;
				}
				else if(name == "listOfUnits"){
					return SWIGTYPE_p_ListOfUnits;
				}
				else if(name == "listOfUnitDefinitions"){
					return SWIGTYPE_p_ListOfUnitDefinitions;
				}
				return SWIGTYPE_p_ListOf;
				
			case SBML_MODEL:
				return SWIGTYPE_p_Model;
				
			case SBML_PARAMETER:
				return SWIGTYPE_p_Parameter;
				
			case SBML_LOCAL_PARAMETER:
				return SWIGTYPE_p_LocalParameter;
				
			case SBML_REACTION:
				return SWIGTYPE_p_Reaction;
				
			case SBML_SPECIES:
				return SWIGTYPE_p_Species;
				
			case SBML_SPECIES_REFERENCE:
				return SWIGTYPE_p_SpeciesReference;
				
			case SBML_MODIFIER_SPECIES_REFERENCE:
				return SWIGTYPE_p_ModifierSpeciesReference;
				
			case SBML_SPECIES_TYPE:
				return SWIGTYPE_p_SpeciesType;
				
			case SBML_UNIT_DEFINITION:
				return SWIGTYPE_p_UnitDefinition;
				
			case SBML_UNIT:
				return SWIGTYPE_p_Unit;
				
			case SBML_ALGEBRAIC_RULE:
				return SWIGTYPE_p_AlgebraicRule;
				
			case SBML_ASSIGNMENT_RULE:
				return SWIGTYPE_p_AssignmentRule;
				
			case SBML_RATE_RULE:
				return SWIGTYPE_p_RateRule;
				
			case SBML_DELAY:
				return SWIGTYPE_p_Delay;
				
			case SBML_TRIGGER:
				return SWIGTYPE_p_Trigger;
				
			case SBML_STOICHIOMETRY_MATH:
				return SWIGTYPE_p_StoichiometryMath;
				
    case SBML_PRIORITY:
      return SWIGTYPE_p_Priority;

			default:
				return SWIGTYPE_p_SBase;
		}
	}

#include "local-downcast.cpp"

  return SWIGTYPE_p_SBase;
}