OR-Tools  9.2
knapsack_solver_python_wrap.cc
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.1
4  *
5  * This file is not intended to be easily readable and contains a number of
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG
8  * interface file instead.
9  * ----------------------------------------------------------------------------- */
10 
11 
12 #ifndef SWIGPYTHON
13 #define SWIGPYTHON
14 #endif
15 
16 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
17 
18 
19 #ifdef __cplusplus
20 /* SwigValueWrapper is described in swig.swg */
21 template<typename T> class SwigValueWrapper {
22  struct SwigMovePointer {
23  T *ptr;
24  SwigMovePointer(T *p) : ptr(p) { }
25  ~SwigMovePointer() { delete ptr; }
26  SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
27  } pointer;
28  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
29  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
30 public:
31  SwigValueWrapper() : pointer(0) { }
32  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
33  operator T&() const { return *pointer.ptr; }
34  T *operator&() { return pointer.ptr; }
35 };
36 
37 template <typename T> T SwigValueInit() {
38  return T();
39 }
40 #endif
41 
42 /* -----------------------------------------------------------------------------
43  * This section contains generic SWIG labels for method/variable
44  * declarations/attributes, and other compiler dependent labels.
45  * ----------------------------------------------------------------------------- */
46 
47 /* template workaround for compilers that cannot correctly implement the C++ standard */
48 #ifndef SWIGTEMPLATEDISAMBIGUATOR
49 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
50 # define SWIGTEMPLATEDISAMBIGUATOR template
51 # elif defined(__HP_aCC)
52 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
53 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
54 # define SWIGTEMPLATEDISAMBIGUATOR template
55 # else
56 # define SWIGTEMPLATEDISAMBIGUATOR
57 # endif
58 #endif
59 
60 /* inline attribute */
61 #ifndef SWIGINLINE
62 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
63 # define SWIGINLINE inline
64 # else
65 # define SWIGINLINE
66 # endif
67 #endif
68 
69 /* attribute recognised by some compilers to avoid 'unused' warnings */
70 #ifndef SWIGUNUSED
71 # if defined(__GNUC__)
72 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
73 # define SWIGUNUSED __attribute__ ((__unused__))
74 # else
75 # define SWIGUNUSED
76 # endif
77 # elif defined(__ICC)
78 # define SWIGUNUSED __attribute__ ((__unused__))
79 # else
80 # define SWIGUNUSED
81 # endif
82 #endif
83 
84 #ifndef SWIG_MSC_UNSUPPRESS_4505
85 # if defined(_MSC_VER)
86 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
87 # endif
88 #endif
89 
90 #ifndef SWIGUNUSEDPARM
91 # ifdef __cplusplus
92 # define SWIGUNUSEDPARM(p)
93 # else
94 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
95 # endif
96 #endif
97 
98 /* internal SWIG method */
99 #ifndef SWIGINTERN
100 # define SWIGINTERN static SWIGUNUSED
101 #endif
102 
103 /* internal inline SWIG method */
104 #ifndef SWIGINTERNINLINE
105 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
106 #endif
107 
108 /* exporting methods */
109 #if defined(__GNUC__)
110 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
111 # ifndef GCC_HASCLASSVISIBILITY
112 # define GCC_HASCLASSVISIBILITY
113 # endif
114 # endif
115 #endif
116 
117 #ifndef SWIGEXPORT
118 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
119 # if defined(STATIC_LINKED)
120 # define SWIGEXPORT
121 # else
122 # define SWIGEXPORT __declspec(dllexport)
123 # endif
124 # else
125 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
126 # define SWIGEXPORT __attribute__ ((visibility("default")))
127 # else
128 # define SWIGEXPORT
129 # endif
130 # endif
131 #endif
132 
133 /* calling conventions for Windows */
134 #ifndef SWIGSTDCALL
135 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
136 # define SWIGSTDCALL __stdcall
137 # else
138 # define SWIGSTDCALL
139 # endif
140 #endif
141 
142 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
143 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
144 # define _CRT_SECURE_NO_DEPRECATE
145 #endif
146 
147 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
148 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
149 # define _SCL_SECURE_NO_DEPRECATE
150 #endif
151 
152 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
153 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
154 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
155 #endif
156 
157 /* Intel's compiler complains if a variable which was never initialised is
158  * cast to void, which is a common idiom which we use to indicate that we
159  * are aware a variable isn't used. So we just silence that warning.
160  * See: https://github.com/swig/swig/issues/192 for more discussion.
161  */
162 #ifdef __INTEL_COMPILER
163 # pragma warning disable 592
164 #endif
165 
166 
167 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
168 /* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
169 # include <math.h>
170 #endif
171 
172 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
173 /* Use debug wrappers with the Python release dll */
174 # undef _DEBUG
175 # include <Python.h>
176 # define _DEBUG 1
177 #else
178 # include <Python.h>
179 #endif
180 
181 /* -----------------------------------------------------------------------------
182  * swigrun.swg
183  *
184  * This file contains generic C API SWIG runtime support for pointer
185  * type checking.
186  * ----------------------------------------------------------------------------- */
187 
188 /* This should only be incremented when either the layout of swig_type_info changes,
189  or for whatever reason, the runtime changes incompatibly */
190 #define SWIG_RUNTIME_VERSION "4"
191 
192 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
193 #ifdef SWIG_TYPE_TABLE
194 # define SWIG_QUOTE_STRING(x) #x
195 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
196 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
197 #else
198 # define SWIG_TYPE_TABLE_NAME
199 #endif
200 
201 /*
202  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
203  creating a static or dynamic library from the SWIG runtime code.
204  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
205 
206  But only do this if strictly necessary, ie, if you have problems
207  with your compiler or suchlike.
208 */
209 
210 #ifndef SWIGRUNTIME
211 # define SWIGRUNTIME SWIGINTERN
212 #endif
213 
214 #ifndef SWIGRUNTIMEINLINE
215 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
216 #endif
217 
218 /* Generic buffer size */
219 #ifndef SWIG_BUFFER_SIZE
220 # define SWIG_BUFFER_SIZE 1024
221 #endif
222 
223 /* Flags for pointer conversions */
224 #define SWIG_POINTER_DISOWN 0x1
225 #define SWIG_CAST_NEW_MEMORY 0x2
226 #define SWIG_POINTER_NO_NULL 0x4
227 
228 /* Flags for new pointer objects */
229 #define SWIG_POINTER_OWN 0x1
230 
231 
232 /*
233  Flags/methods for returning states.
234 
235  The SWIG conversion methods, as ConvertPtr, return an integer
236  that tells if the conversion was successful or not. And if not,
237  an error code can be returned (see swigerrors.swg for the codes).
238 
239  Use the following macros/flags to set or process the returning
240  states.
241 
242  In old versions of SWIG, code such as the following was usually written:
243 
244  if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
245  // success code
246  } else {
247  //fail code
248  }
249 
250  Now you can be more explicit:
251 
252  int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
253  if (SWIG_IsOK(res)) {
254  // success code
255  } else {
256  // fail code
257  }
258 
259  which is the same really, but now you can also do
260 
261  Type *ptr;
262  int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
263  if (SWIG_IsOK(res)) {
264  // success code
265  if (SWIG_IsNewObj(res) {
266  ...
267  delete *ptr;
268  } else {
269  ...
270  }
271  } else {
272  // fail code
273  }
274 
275  I.e., now SWIG_ConvertPtr can return new objects and you can
276  identify the case and take care of the deallocation. Of course that
277  also requires SWIG_ConvertPtr to return new result values, such as
278 
279  int SWIG_ConvertPtr(obj, ptr,...) {
280  if (<obj is ok>) {
281  if (<need new object>) {
282  *ptr = <ptr to new allocated object>;
283  return SWIG_NEWOBJ;
284  } else {
285  *ptr = <ptr to old object>;
286  return SWIG_OLDOBJ;
287  }
288  } else {
289  return SWIG_BADOBJ;
290  }
291  }
292 
293  Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
294  more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
295  SWIG errors code.
296 
297  Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
298  allows to return the 'cast rank', for example, if you have this
299 
300  int food(double)
301  int fooi(int);
302 
303  and you call
304 
305  food(1) // cast rank '1' (1 -> 1.0)
306  fooi(1) // cast rank '0'
307 
308  just use the SWIG_AddCast()/SWIG_CheckState()
309 */
310 
311 #define SWIG_OK (0)
312 #define SWIG_ERROR (-1)
313 #define SWIG_IsOK(r) (r >= 0)
314 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
315 
316 /* The CastRankLimit says how many bits are used for the cast rank */
317 #define SWIG_CASTRANKLIMIT (1 << 8)
318 /* The NewMask denotes the object was created (using new/malloc) */
319 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
320 /* The TmpMask is for in/out typemaps that use temporal objects */
321 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
322 /* Simple returning values */
323 #define SWIG_BADOBJ (SWIG_ERROR)
324 #define SWIG_OLDOBJ (SWIG_OK)
325 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
326 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
327 /* Check, add and del mask methods */
328 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
329 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
330 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
331 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
332 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
333 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
334 
335 /* Cast-Rank Mode */
336 #if defined(SWIG_CASTRANK_MODE)
337 # ifndef SWIG_TypeRank
338 # define SWIG_TypeRank unsigned long
339 # endif
340 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
341 # define SWIG_MAXCASTRANK (2)
342 # endif
343 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
344 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
345 SWIGINTERNINLINE int SWIG_AddCast(int r) {
346  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
347 }
349  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
350 }
351 #else /* no cast-rank mode */
352 # define SWIG_AddCast(r) (r)
353 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
354 #endif
355 
356 
357 #include <string.h>
358 
359 #ifdef __cplusplus
360 extern "C" {
361 #endif
362 
363 typedef void *(*swig_converter_func)(void *, int *);
364 typedef struct swig_type_info *(*swig_dycast_func)(void **);
365 
366 /* Structure to store information on one type */
367 typedef struct swig_type_info {
368  const char *name; /* mangled name of this type */
369  const char *str; /* human readable name of this type */
370  swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
371  struct swig_cast_info *cast; /* linked list of types that can cast into this type */
372  void *clientdata; /* language specific type data */
373  int owndata; /* flag if the structure owns the clientdata */
375 
376 /* Structure to store a type and conversion function used for casting */
377 typedef struct swig_cast_info {
378  swig_type_info *type; /* pointer to type that is equivalent to this type */
379  swig_converter_func converter; /* function to cast the void pointers */
380  struct swig_cast_info *next; /* pointer to next cast in linked list */
381  struct swig_cast_info *prev; /* pointer to the previous cast */
383 
384 /* Structure used to store module information
385  * Each module generates one structure like this, and the runtime collects
386  * all of these structures and stores them in a circularly linked list.*/
387 typedef struct swig_module_info {
388  swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
389  size_t size; /* Number of types in this module */
390  struct swig_module_info *next; /* Pointer to next element in circularly linked list */
391  swig_type_info **type_initial; /* Array of initially generated type structures */
392  swig_cast_info **cast_initial; /* Array of initially generated casting structures */
393  void *clientdata; /* Language specific module data */
395 
396 /*
397  Compare two type names skipping the space characters, therefore
398  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
399 
400  Return 0 when the two name types are equivalent, as in
401  strncmp, but skipping ' '.
402 */
403 SWIGRUNTIME int
404 SWIG_TypeNameComp(const char *f1, const char *l1,
405  const char *f2, const char *l2) {
406  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
407  while ((*f1 == ' ') && (f1 != l1)) ++f1;
408  while ((*f2 == ' ') && (f2 != l2)) ++f2;
409  if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
410  }
411  return (int)((l1 - f1) - (l2 - f2));
412 }
413 
414 /*
415  Check type equivalence in a name list like <name1>|<name2>|...
416  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
417 */
418 SWIGRUNTIME int
419 SWIG_TypeCmp(const char *nb, const char *tb) {
420  int equiv = 1;
421  const char* te = tb + strlen(tb);
422  const char* ne = nb;
423  while (equiv != 0 && *ne) {
424  for (nb = ne; *ne; ++ne) {
425  if (*ne == '|') break;
426  }
427  equiv = SWIG_TypeNameComp(nb, ne, tb, te);
428  if (*ne) ++ne;
429  }
430  return equiv;
431 }
432 
433 /*
434  Check type equivalence in a name list like <name1>|<name2>|...
435  Return 0 if not equal, 1 if equal
436 */
437 SWIGRUNTIME int
438 SWIG_TypeEquiv(const char *nb, const char *tb) {
439  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
440 }
441 
442 /*
443  Check the typename
444 */
446 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
447  if (ty) {
448  swig_cast_info *iter = ty->cast;
449  while (iter) {
450  if (strcmp(iter->type->name, c) == 0) {
451  if (iter == ty->cast)
452  return iter;
453  /* Move iter to the top of the linked list */
454  iter->prev->next = iter->next;
455  if (iter->next)
456  iter->next->prev = iter->prev;
457  iter->next = ty->cast;
458  iter->prev = 0;
459  if (ty->cast) ty->cast->prev = iter;
460  ty->cast = iter;
461  return iter;
462  }
463  iter = iter->next;
464  }
465  }
466  return 0;
467 }
468 
469 /*
470  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
471 */
474  if (ty) {
475  swig_cast_info *iter = ty->cast;
476  while (iter) {
477  if (iter->type == from) {
478  if (iter == ty->cast)
479  return iter;
480  /* Move iter to the top of the linked list */
481  iter->prev->next = iter->next;
482  if (iter->next)
483  iter->next->prev = iter->prev;
484  iter->next = ty->cast;
485  iter->prev = 0;
486  if (ty->cast) ty->cast->prev = iter;
487  ty->cast = iter;
488  return iter;
489  }
490  iter = iter->next;
491  }
492  }
493  return 0;
494 }
495 
496 /*
497  Cast a pointer up an inheritance hierarchy
498 */
499 SWIGRUNTIMEINLINE void *
500 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
501  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
502 }
503 
504 /*
505  Dynamic pointer casting. Down an inheritance hierarchy
506 */
509  swig_type_info *lastty = ty;
510  if (!ty || !ty->dcast) return ty;
511  while (ty && (ty->dcast)) {
512  ty = (*ty->dcast)(ptr);
513  if (ty) lastty = ty;
514  }
515  return lastty;
516 }
517 
518 /*
519  Return the name associated with this type
520 */
521 SWIGRUNTIMEINLINE const char *
523  return ty->name;
524 }
525 
526 /*
527  Return the pretty name associated with this type,
528  that is an unmangled type name in a form presentable to the user.
529 */
530 SWIGRUNTIME const char *
532  /* The "str" field contains the equivalent pretty names of the
533  type, separated by vertical-bar characters. We choose
534  to print the last name, as it is often (?) the most
535  specific. */
536  if (!type) return NULL;
537  if (type->str != NULL) {
538  const char *last_name = type->str;
539  const char *s;
540  for (s = type->str; *s; s++)
541  if (*s == '|') last_name = s+1;
542  return last_name;
543  }
544  else
545  return type->name;
546 }
547 
548 /*
549  Set the clientdata field for a type
550 */
551 SWIGRUNTIME void
553  swig_cast_info *cast = ti->cast;
554  /* if (ti->clientdata == clientdata) return; */
555  ti->clientdata = clientdata;
556 
557  while (cast) {
558  if (!cast->converter) {
559  swig_type_info *tc = cast->type;
560  if (!tc->clientdata) {
562  }
563  }
564  cast = cast->next;
565  }
566 }
567 SWIGRUNTIME void
570  ti->owndata = 1;
571 }
572 
573 /*
574  Search for a swig_type_info structure only by mangled name
575  Search is a O(log #types)
576 
577  We start searching at module start, and finish searching when start == end.
578  Note: if start == end at the beginning of the function, we go all the way around
579  the circular list.
580 */
583  swig_module_info *end,
584  const char *name) {
585  swig_module_info *iter = start;
586  do {
587  if (iter->size) {
588  size_t l = 0;
589  size_t r = iter->size - 1;
590  do {
591  /* since l+r >= 0, we can (>> 1) instead (/ 2) */
592  size_t i = (l + r) >> 1;
593  const char *iname = iter->types[i]->name;
594  if (iname) {
595  int compare = strcmp(name, iname);
596  if (compare == 0) {
597  return iter->types[i];
598  } else if (compare < 0) {
599  if (i) {
600  r = i - 1;
601  } else {
602  break;
603  }
604  } else if (compare > 0) {
605  l = i + 1;
606  }
607  } else {
608  break; /* should never happen */
609  }
610  } while (l <= r);
611  }
612  iter = iter->next;
613  } while (iter != end);
614  return 0;
615 }
616 
617 /*
618  Search for a swig_type_info structure for either a mangled name or a human readable name.
619  It first searches the mangled names of the types, which is a O(log #types)
620  If a type is not found it then searches the human readable names, which is O(#types).
621 
622  We start searching at module start, and finish searching when start == end.
623  Note: if start == end at the beginning of the function, we go all the way around
624  the circular list.
625 */
628  swig_module_info *end,
629  const char *name) {
630  /* STEP 1: Search the name field using binary search */
631  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
632  if (ret) {
633  return ret;
634  } else {
635  /* STEP 2: If the type hasn't been found, do a complete search
636  of the str field (the human readable name) */
637  swig_module_info *iter = start;
638  do {
639  size_t i = 0;
640  for (; i < iter->size; ++i) {
641  if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
642  return iter->types[i];
643  }
644  iter = iter->next;
645  } while (iter != end);
646  }
647 
648  /* neither found a match */
649  return 0;
650 }
651 
652 /*
653  Pack binary data into a string
654 */
655 SWIGRUNTIME char *
656 SWIG_PackData(char *c, void *ptr, size_t sz) {
657  static const char hex[17] = "0123456789abcdef";
658  const unsigned char *u = (unsigned char *) ptr;
659  const unsigned char *eu = u + sz;
660  for (; u != eu; ++u) {
661  unsigned char uu = *u;
662  *(c++) = hex[(uu & 0xf0) >> 4];
663  *(c++) = hex[uu & 0xf];
664  }
665  return c;
666 }
667 
668 /*
669  Unpack binary data from a string
670 */
671 SWIGRUNTIME const char *
672 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
673  unsigned char *u = (unsigned char *) ptr;
674  const unsigned char *eu = u + sz;
675  for (; u != eu; ++u) {
676  char d = *(c++);
677  unsigned char uu;
678  if ((d >= '0') && (d <= '9'))
679  uu = (unsigned char)((d - '0') << 4);
680  else if ((d >= 'a') && (d <= 'f'))
681  uu = (unsigned char)((d - ('a'-10)) << 4);
682  else
683  return (char *) 0;
684  d = *(c++);
685  if ((d >= '0') && (d <= '9'))
686  uu |= (unsigned char)(d - '0');
687  else if ((d >= 'a') && (d <= 'f'))
688  uu |= (unsigned char)(d - ('a'-10));
689  else
690  return (char *) 0;
691  *u = uu;
692  }
693  return c;
694 }
695 
696 /*
697  Pack 'void *' into a string buffer.
698 */
699 SWIGRUNTIME char *
700 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
701  char *r = buff;
702  if ((2*sizeof(void *) + 2) > bsz) return 0;
703  *(r++) = '_';
704  r = SWIG_PackData(r,&ptr,sizeof(void *));
705  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
706  strcpy(r,name);
707  return buff;
708 }
709 
710 SWIGRUNTIME const char *
711 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
712  if (*c != '_') {
713  if (strcmp(c,"NULL") == 0) {
714  *ptr = (void *) 0;
715  return name;
716  } else {
717  return 0;
718  }
719  }
720  return SWIG_UnpackData(++c,ptr,sizeof(void *));
721 }
722 
723 SWIGRUNTIME char *
724 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
725  char *r = buff;
726  size_t lname = (name ? strlen(name) : 0);
727  if ((2*sz + 2 + lname) > bsz) return 0;
728  *(r++) = '_';
729  r = SWIG_PackData(r,ptr,sz);
730  if (lname) {
731  strncpy(r,name,lname+1);
732  } else {
733  *r = 0;
734  }
735  return buff;
736 }
737 
738 SWIGRUNTIME const char *
739 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
740  if (*c != '_') {
741  if (strcmp(c,"NULL") == 0) {
742  memset(ptr,0,sz);
743  return name;
744  } else {
745  return 0;
746  }
747  }
748  return SWIG_UnpackData(++c,ptr,sz);
749 }
750 
751 #ifdef __cplusplus
752 }
753 #endif
754 
755 /* Errors in SWIG */
756 #define SWIG_UnknownError -1
757 #define SWIG_IOError -2
758 #define SWIG_RuntimeError -3
759 #define SWIG_IndexError -4
760 #define SWIG_TypeError -5
761 #define SWIG_DivisionByZero -6
762 #define SWIG_OverflowError -7
763 #define SWIG_SyntaxError -8
764 #define SWIG_ValueError -9
765 #define SWIG_SystemError -10
766 #define SWIG_AttributeError -11
767 #define SWIG_MemoryError -12
768 #define SWIG_NullReferenceError -13
769 
770 
771 
772 /* Compatibility macros for Python 3 */
773 #if PY_VERSION_HEX >= 0x03000000
774 
775 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
776 #define PyInt_Check(x) PyLong_Check(x)
777 #define PyInt_AsLong(x) PyLong_AsLong(x)
778 #define PyInt_FromLong(x) PyLong_FromLong(x)
779 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
780 #define PyString_Check(name) PyBytes_Check(name)
781 #define PyString_FromString(x) PyUnicode_FromString(x)
782 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
783 #define PyString_AsString(str) PyBytes_AsString(str)
784 #define PyString_Size(str) PyBytes_Size(str)
785 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
786 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
787 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
788 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
789 
790 #endif
791 
792 #ifndef Py_TYPE
793 # define Py_TYPE(op) ((op)->ob_type)
794 #endif
795 
796 /* SWIG APIs for compatibility of both Python 2 & 3 */
797 
798 #if PY_VERSION_HEX >= 0x03000000
799 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
800 #else
801 # define SWIG_Python_str_FromFormat PyString_FromFormat
802 #endif
803 
804 
805 /* Warning: This function will allocate a new string in Python 3,
806  * so please call SWIG_Python_str_DelForPy3(x) to free the space.
807  */
808 SWIGINTERN char*
810 {
811 #if PY_VERSION_HEX >= 0x03000000
812  char *newstr = 0;
813  str = PyUnicode_AsUTF8String(str);
814  if (str) {
815  char *cstr;
816  Py_ssize_t len;
817  PyBytes_AsStringAndSize(str, &cstr, &len);
818  newstr = (char *) malloc(len+1);
819  memcpy(newstr, cstr, len+1);
820  Py_XDECREF(str);
821  }
822  return newstr;
823 #else
824  return PyString_AsString(str);
825 #endif
826 }
827 
828 #if PY_VERSION_HEX >= 0x03000000
829 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
830 #else
831 # define SWIG_Python_str_DelForPy3(x)
832 #endif
833 
834 
835 SWIGINTERN PyObject*
837 {
838 #if PY_VERSION_HEX >= 0x03000000
839  return PyUnicode_FromString(c);
840 #else
841  return PyString_FromString(c);
842 #endif
843 }
844 
845 #ifndef PyObject_DEL
846 # define PyObject_DEL PyObject_Del
847 #endif
848 
849 // SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
850 // interface files check for it.
851 # define SWIGPY_USE_CAPSULE
852 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
853 
854 #if PY_VERSION_HEX < 0x03020000
855 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
856 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
857 #define Py_hash_t long
858 #endif
859 
860 /* -----------------------------------------------------------------------------
861  * error manipulation
862  * ----------------------------------------------------------------------------- */
863 
864 SWIGRUNTIME PyObject*
866  PyObject* type = 0;
867  switch(code) {
868  case SWIG_MemoryError:
869  type = PyExc_MemoryError;
870  break;
871  case SWIG_IOError:
872  type = PyExc_IOError;
873  break;
874  case SWIG_RuntimeError:
875  type = PyExc_RuntimeError;
876  break;
877  case SWIG_IndexError:
878  type = PyExc_IndexError;
879  break;
880  case SWIG_TypeError:
881  type = PyExc_TypeError;
882  break;
883  case SWIG_DivisionByZero:
884  type = PyExc_ZeroDivisionError;
885  break;
886  case SWIG_OverflowError:
887  type = PyExc_OverflowError;
888  break;
889  case SWIG_SyntaxError:
890  type = PyExc_SyntaxError;
891  break;
892  case SWIG_ValueError:
893  type = PyExc_ValueError;
894  break;
895  case SWIG_SystemError:
896  type = PyExc_SystemError;
897  break;
898  case SWIG_AttributeError:
899  type = PyExc_AttributeError;
900  break;
901  default:
902  type = PyExc_RuntimeError;
903  }
904  return type;
905 }
906 
907 
908 SWIGRUNTIME void
909 SWIG_Python_AddErrorMsg(const char* mesg)
910 {
911  PyObject *type = 0;
912  PyObject *value = 0;
913  PyObject *traceback = 0;
914 
915  if (PyErr_Occurred())
916  PyErr_Fetch(&type, &value, &traceback);
917  if (value) {
918  PyObject *old_str = PyObject_Str(value);
919  const char *tmp = SWIG_Python_str_AsChar(old_str);
920  PyErr_Clear();
921  Py_XINCREF(type);
922  if (tmp)
923  PyErr_Format(type, "%s %s", tmp, mesg);
924  else
925  PyErr_Format(type, "%s", mesg);
927  Py_DECREF(old_str);
928  Py_DECREF(value);
929  } else {
930  PyErr_SetString(PyExc_RuntimeError, mesg);
931  }
932 }
933 
934 SWIGRUNTIME int
936 {
937  PyObject *error;
938  if (obj)
939  return 0;
940  error = PyErr_Occurred();
941  return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
942 }
943 
944 SWIGRUNTIME void
946 {
947  if (SWIG_Python_TypeErrorOccurred(NULL)) {
948  /* Use existing TypeError to preserve stacktrace and enhance with given message */
949  PyObject *newvalue;
950  PyObject *type = NULL, *value = NULL, *traceback = NULL;
951  PyErr_Fetch(&type, &value, &traceback);
952 #if PY_VERSION_HEX >= 0x03000000
953  newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
954 #else
955  newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
956 #endif
957  Py_XDECREF(value);
958  PyErr_Restore(type, newvalue, traceback);
959  } else {
960  /* Raise TypeError using given message */
961  PyErr_SetString(PyExc_TypeError, message);
962  }
963 }
964 
965 #if defined(SWIG_PYTHON_NO_THREADS)
966 # if defined(SWIG_PYTHON_THREADS)
967 # undef SWIG_PYTHON_THREADS
968 # endif
969 #endif
970 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
971 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
972 # define SWIG_PYTHON_USE_GIL
973 # endif
974 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
975 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
976 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
977 # endif
978 # ifdef __cplusplus /* C++ code */
979  class SWIG_Python_Thread_Block {
980  bool status;
981  PyGILState_STATE state;
982  public:
983  void end() { if (status) { PyGILState_Release(state); status = false;} }
984  SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
985  ~SWIG_Python_Thread_Block() { end(); }
986  };
987  class SWIG_Python_Thread_Allow {
988  bool status;
989  PyThreadState *save;
990  public:
991  void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
992  SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
993  ~SWIG_Python_Thread_Allow() { end(); }
994  };
995 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
996 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
997 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
998 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
999 # else /* C code */
1000 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1001 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1002 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1003 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1004 # endif
1005 # else /* Old thread way, not implemented, user must provide it */
1006 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1007 # define SWIG_PYTHON_INITIALIZE_THREADS
1008 # endif
1009 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1010 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1011 # endif
1012 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1013 # define SWIG_PYTHON_THREAD_END_BLOCK
1014 # endif
1015 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1016 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1017 # endif
1018 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1019 # define SWIG_PYTHON_THREAD_END_ALLOW
1020 # endif
1021 # endif
1022 #else /* No thread support */
1023 # define SWIG_PYTHON_INITIALIZE_THREADS
1024 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1025 # define SWIG_PYTHON_THREAD_END_BLOCK
1026 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1027 # define SWIG_PYTHON_THREAD_END_ALLOW
1028 #endif
1029 
1030 /* -----------------------------------------------------------------------------
1031  * Python API portion that goes into the runtime
1032  * ----------------------------------------------------------------------------- */
1033 
1034 #ifdef __cplusplus
1035 extern "C" {
1036 #endif
1037 
1038 /* -----------------------------------------------------------------------------
1039  * Constant declarations
1040  * ----------------------------------------------------------------------------- */
1041 
1042 /* Constant Types */
1043 #define SWIG_PY_POINTER 4
1044 #define SWIG_PY_BINARY 5
1045 
1046 /* Constant information structure */
1047 typedef struct swig_const_info {
1048  int type;
1049  const char *name;
1050  long lvalue;
1051  double dvalue;
1052  void *pvalue;
1054 } swig_const_info;
1055 
1056 #ifdef __cplusplus
1057 }
1058 #endif
1059 
1060 
1061 /* -----------------------------------------------------------------------------
1062  * pyrun.swg
1063  *
1064  * This file contains the runtime support for Python modules
1065  * and includes code for managing global variables and pointer
1066  * type checking.
1067  *
1068  * ----------------------------------------------------------------------------- */
1069 
1070 #if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1071 # error "This version of SWIG only supports Python >= 2.7"
1072 #endif
1073 
1074 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1075 # error "This version of SWIG only supports Python 3 >= 3.2"
1076 #endif
1077 
1078 /* Common SWIG API */
1079 
1080 /* for raw pointers */
1081 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1082 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1083 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1084 
1085 #ifdef SWIGPYTHON_BUILTIN
1086 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1087 #else
1088 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1089 #endif
1090 
1091 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1092 
1093 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1094 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1095 #define swig_owntype int
1096 
1097 /* for raw packed data */
1098 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1099 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1100 
1101 /* for class or struct pointers */
1102 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1103 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1104 
1105 /* for C or C++ function pointers */
1106 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1107 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1108 
1109 /* for C++ member pointers, ie, member methods */
1110 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1111 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1112 
1113 
1114 /* Runtime API */
1115 
1116 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1117 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1118 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1119 
1120 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1121 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1122 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1123 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1124 #define SWIG_fail goto fail
1125 
1126 
1127 /* Runtime API implementation */
1128 
1129 /* Error manipulation */
1130 
1131 SWIGINTERN void
1132 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1134  PyErr_SetObject(errtype, obj);
1135  Py_DECREF(obj);
1137 }
1138 
1139 SWIGINTERN void
1140 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1142  PyErr_SetString(errtype, msg);
1144 }
1145 
1146 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1147 
1148 /* Set a constant value */
1149 
1150 #if defined(SWIGPYTHON_BUILTIN)
1151 
1152 SWIGINTERN void
1153 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1154  PyObject *s = PyString_InternFromString(key);
1155  PyList_Append(seq, s);
1156  Py_DECREF(s);
1157 }
1158 
1159 SWIGINTERN void
1160 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1161  PyDict_SetItemString(d, name, obj);
1162  Py_DECREF(obj);
1163  if (public_interface)
1164  SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1165 }
1166 
1167 #else
1168 
1169 SWIGINTERN void
1170 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1171  PyDict_SetItemString(d, name, obj);
1172  Py_DECREF(obj);
1173 }
1174 
1175 #endif
1176 
1177 /* Append a value to the result obj */
1178 
1179 SWIGINTERN PyObject*
1180 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1181  if (!result) {
1182  result = obj;
1183  } else if (result == Py_None) {
1184  Py_DECREF(result);
1185  result = obj;
1186  } else {
1187  if (!PyList_Check(result)) {
1188  PyObject *o2 = result;
1189  result = PyList_New(1);
1190  PyList_SetItem(result, 0, o2);
1191  }
1192  PyList_Append(result,obj);
1193  Py_DECREF(obj);
1194  }
1195  return result;
1196 }
1197 
1198 /* Unpack the argument tuple */
1199 
1200 SWIGINTERN Py_ssize_t
1201 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1202 {
1203  if (!args) {
1204  if (!min && !max) {
1205  return 1;
1206  } else {
1207  PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1208  name, (min == max ? "" : "at least "), (int)min);
1209  return 0;
1210  }
1211  }
1212  if (!PyTuple_Check(args)) {
1213  if (min <= 1 && max >= 1) {
1214  Py_ssize_t i;
1215  objs[0] = args;
1216  for (i = 1; i < max; ++i) {
1217  objs[i] = 0;
1218  }
1219  return 2;
1220  }
1221  PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1222  return 0;
1223  } else {
1224  Py_ssize_t l = PyTuple_GET_SIZE(args);
1225  if (l < min) {
1226  PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1227  name, (min == max ? "" : "at least "), (int)min, (int)l);
1228  return 0;
1229  } else if (l > max) {
1230  PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1231  name, (min == max ? "" : "at most "), (int)max, (int)l);
1232  return 0;
1233  } else {
1234  Py_ssize_t i;
1235  for (i = 0; i < l; ++i) {
1236  objs[i] = PyTuple_GET_ITEM(args, i);
1237  }
1238  for (; l < max; ++l) {
1239  objs[l] = 0;
1240  }
1241  return i + 1;
1242  }
1243  }
1244 }
1245 
1246 /* A functor is a function object with one single object argument */
1247 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1248 
1249 /*
1250  Helper for static pointer initialization for both C and C++ code, for example
1251  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1252 */
1253 #ifdef __cplusplus
1254 #define SWIG_STATIC_POINTER(var) var
1255 #else
1256 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1257 #endif
1258 
1259 /* -----------------------------------------------------------------------------
1260  * Pointer declarations
1261  * ----------------------------------------------------------------------------- */
1262 
1263 /* Flags for new pointer objects */
1264 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1265 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1266 
1267 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1268 
1269 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1270 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1271 
1272 #ifdef __cplusplus
1273 extern "C" {
1274 #endif
1275 
1276 /* The python void return value */
1277 
1278 SWIGRUNTIMEINLINE PyObject *
1280 {
1281  PyObject *none = Py_None;
1282  Py_INCREF(none);
1283  return none;
1284 }
1285 
1286 /* SwigPyClientData */
1287 
1288 typedef struct {
1289  PyObject *klass;
1290  PyObject *newraw;
1291  PyObject *newargs;
1292  PyObject *destroy;
1293  int delargs;
1295  PyTypeObject *pytype;
1297 
1298 SWIGRUNTIMEINLINE int
1300 {
1302  int fail = data ? data->implicitconv : 0;
1303  if (fail)
1304  PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
1305  return fail;
1306 }
1307 
1308 SWIGRUNTIMEINLINE PyObject *
1310  SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1311  PyObject *klass = data ? data->klass : 0;
1312  return (klass ? klass : PyExc_RuntimeError);
1313 }
1314 
1315 
1317 SwigPyClientData_New(PyObject* obj)
1318 {
1319  if (!obj) {
1320  return 0;
1321  } else {
1323  /* the klass element */
1324  data->klass = obj;
1325  Py_INCREF(data->klass);
1326  /* the newraw method and newargs arguments used to create a new raw instance */
1327  if (PyClass_Check(obj)) {
1328  data->newraw = 0;
1329  data->newargs = obj;
1330  Py_INCREF(obj);
1331  } else {
1332  data->newraw = PyObject_GetAttrString(data->klass, "__new__");
1333  if (data->newraw) {
1334  Py_INCREF(data->newraw);
1335  data->newargs = PyTuple_New(1);
1336  PyTuple_SetItem(data->newargs, 0, obj);
1337  } else {
1338  data->newargs = obj;
1339  }
1340  Py_INCREF(data->newargs);
1341  }
1342  /* the destroy method, aka as the C++ delete method */
1343  data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
1344  if (PyErr_Occurred()) {
1345  PyErr_Clear();
1346  data->destroy = 0;
1347  }
1348  if (data->destroy) {
1349  int flags;
1350  Py_INCREF(data->destroy);
1351  flags = PyCFunction_GET_FLAGS(data->destroy);
1352  data->delargs = !(flags & (METH_O));
1353  } else {
1354  data->delargs = 0;
1355  }
1356  data->implicitconv = 0;
1357  data->pytype = 0;
1358  return data;
1359  }
1360 }
1361 
1362 SWIGRUNTIME void
1364  Py_XDECREF(data->newraw);
1365  Py_XDECREF(data->newargs);
1366  Py_XDECREF(data->destroy);
1367 }
1368 
1369 /* =============== SwigPyObject =====================*/
1370 
1371 typedef struct {
1372  PyObject_HEAD
1373  void *ptr;
1375  int own;
1376  PyObject *next;
1377 #ifdef SWIGPYTHON_BUILTIN
1378  PyObject *dict;
1379 #endif
1380 } SwigPyObject;
1381 
1382 
1383 #ifdef SWIGPYTHON_BUILTIN
1384 
1385 SWIGRUNTIME PyObject *
1386 SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1387 {
1388  SwigPyObject *sobj = (SwigPyObject *)v;
1389 
1390  if (!sobj->dict)
1391  sobj->dict = PyDict_New();
1392 
1393  Py_INCREF(sobj->dict);
1394  return sobj->dict;
1395 }
1396 
1397 #endif
1398 
1399 SWIGRUNTIME PyObject *
1401 {
1402  return PyLong_FromVoidPtr(v->ptr);
1403 }
1404 
1405 SWIGRUNTIME PyObject *
1406 SwigPyObject_format(const char* fmt, SwigPyObject *v)
1407 {
1408  PyObject *res = NULL;
1409  PyObject *args = PyTuple_New(1);
1410  if (args) {
1411  if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1412  PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1413  if (ofmt) {
1414 #if PY_VERSION_HEX >= 0x03000000
1415  res = PyUnicode_Format(ofmt,args);
1416 #else
1417  res = PyString_Format(ofmt,args);
1418 #endif
1419  Py_DECREF(ofmt);
1420  }
1421  Py_DECREF(args);
1422  }
1423  }
1424  return res;
1425 }
1426 
1427 SWIGRUNTIME PyObject *
1429 {
1430  return SwigPyObject_format("%o",v);
1431 }
1432 
1433 SWIGRUNTIME PyObject *
1435 {
1436  return SwigPyObject_format("%x",v);
1437 }
1438 
1439 SWIGRUNTIME PyObject *
1441 {
1442  const char *name = SWIG_TypePrettyName(v->ty);
1443  PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1444  if (v->next) {
1445  PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1446 # if PY_VERSION_HEX >= 0x03000000
1447  PyObject *joined = PyUnicode_Concat(repr, nrep);
1448  Py_DecRef(repr);
1449  Py_DecRef(nrep);
1450  repr = joined;
1451 # else
1452  PyString_ConcatAndDel(&repr,nrep);
1453 # endif
1454  }
1455  return repr;
1456 }
1457 
1458 /* We need a version taking two PyObject* parameters so it's a valid
1459  * PyCFunction to use in swigobject_methods[]. */
1460 SWIGRUNTIME PyObject *
1461 SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1462 {
1463  return SwigPyObject_repr((SwigPyObject*)v);
1464 }
1465 
1466 SWIGRUNTIME int
1468 {
1469  void *i = v->ptr;
1470  void *j = w->ptr;
1471  return (i < j) ? -1 : ((i > j) ? 1 : 0);
1472 }
1473 
1474 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1475 SWIGRUNTIME PyObject*
1477 {
1478  PyObject* res;
1479  if( op != Py_EQ && op != Py_NE ) {
1480  Py_INCREF(Py_NotImplemented);
1481  return Py_NotImplemented;
1482  }
1483  res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1484  return res;
1485 }
1486 
1487 
1488 SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1489 
1490 #ifdef SWIGPYTHON_BUILTIN
1491 static swig_type_info *SwigPyObject_stype = 0;
1492 SWIGRUNTIME PyTypeObject*
1493 SwigPyObject_type(void) {
1494  SwigPyClientData *cd;
1495  assert(SwigPyObject_stype);
1496  cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1497  assert(cd);
1498  assert(cd->pytype);
1499  return cd->pytype;
1500 }
1501 #else
1502 SWIGRUNTIME PyTypeObject*
1504  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1505  return type;
1506 }
1507 #endif
1508 
1510 SwigPyObject_Check(PyObject *op) {
1511 #ifdef SWIGPYTHON_BUILTIN
1512  PyTypeObject *target_tp = SwigPyObject_type();
1513  if (PyType_IsSubtype(op->ob_type, target_tp))
1514  return 1;
1515  return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1516 #else
1517  return (Py_TYPE(op) == SwigPyObject_type())
1518  || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1519 #endif
1520 }
1521 
1522 SWIGRUNTIME PyObject *
1523 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1524 
1525 SWIGRUNTIME void
1527 {
1528  SwigPyObject *sobj = (SwigPyObject *) v;
1529  PyObject *next = sobj->next;
1530  if (sobj->own == SWIG_POINTER_OWN) {
1531  swig_type_info *ty = sobj->ty;
1532  SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1533  PyObject *destroy = data ? data->destroy : 0;
1534  if (destroy) {
1535  /* destroy is always a VARARGS method */
1536  PyObject *res;
1537 
1538  /* PyObject_CallFunction() has the potential to silently drop
1539  the active exception. In cases of unnamed temporary
1540  variable or where we just finished iterating over a generator
1541  StopIteration will be active right now, and this needs to
1542  remain true upon return from SwigPyObject_dealloc. So save
1543  and restore. */
1544 
1545  PyObject *type = NULL, *value = NULL, *traceback = NULL;
1546  PyErr_Fetch(&type, &value, &traceback);
1547 
1548  if (data->delargs) {
1549  /* we need to create a temporary object to carry the destroy operation */
1550  PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1551  res = SWIG_Python_CallFunctor(destroy, tmp);
1552  Py_DECREF(tmp);
1553  } else {
1554  PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1555  PyObject *mself = PyCFunction_GET_SELF(destroy);
1556  res = ((*meth)(mself, v));
1557  }
1558  if (!res)
1559  PyErr_WriteUnraisable(destroy);
1560 
1561  PyErr_Restore(type, value, traceback);
1562 
1563  Py_XDECREF(res);
1564  }
1565 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1566  else {
1567  const char *name = SWIG_TypePrettyName(ty);
1568  printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1569  }
1570 #endif
1571  }
1572  Py_XDECREF(next);
1573  PyObject_DEL(v);
1574 }
1575 
1576 SWIGRUNTIME PyObject*
1577 SwigPyObject_append(PyObject* v, PyObject* next)
1578 {
1579  SwigPyObject *sobj = (SwigPyObject *) v;
1580  if (!SwigPyObject_Check(next)) {
1581  PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
1582  return NULL;
1583  }
1584  sobj->next = next;
1585  Py_INCREF(next);
1586  return SWIG_Py_Void();
1587 }
1588 
1589 SWIGRUNTIME PyObject*
1590 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1591 {
1592  SwigPyObject *sobj = (SwigPyObject *) v;
1593  if (sobj->next) {
1594  Py_INCREF(sobj->next);
1595  return sobj->next;
1596  } else {
1597  return SWIG_Py_Void();
1598  }
1599 }
1600 
1601 SWIGINTERN PyObject*
1602 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1603 {
1604  SwigPyObject *sobj = (SwigPyObject *)v;
1605  sobj->own = 0;
1606  return SWIG_Py_Void();
1607 }
1608 
1609 SWIGINTERN PyObject*
1610 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1611 {
1612  SwigPyObject *sobj = (SwigPyObject *)v;
1613  sobj->own = SWIG_POINTER_OWN;
1614  return SWIG_Py_Void();
1615 }
1616 
1617 SWIGINTERN PyObject*
1618 SwigPyObject_own(PyObject *v, PyObject *args)
1619 {
1620  PyObject *val = 0;
1621  if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
1622  return NULL;
1623  } else {
1624  SwigPyObject *sobj = (SwigPyObject *)v;
1625  PyObject *obj = PyBool_FromLong(sobj->own);
1626  if (val) {
1627  if (PyObject_IsTrue(val)) {
1628  SwigPyObject_acquire(v,args);
1629  } else {
1630  SwigPyObject_disown(v,args);
1631  }
1632  }
1633  return obj;
1634  }
1635 }
1636 
1637 static PyMethodDef
1639  {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"},
1640  {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"},
1641  {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"},
1642  {"append", SwigPyObject_append, METH_O, "appends another 'this' object"},
1643  {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"},
1644  {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"},
1645  {0, 0, 0, 0}
1646 };
1647 
1648 SWIGRUNTIME PyTypeObject*
1650  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1651 
1652  static PyNumberMethods SwigPyObject_as_number = {
1653  (binaryfunc)0, /*nb_add*/
1654  (binaryfunc)0, /*nb_subtract*/
1655  (binaryfunc)0, /*nb_multiply*/
1656  /* nb_divide removed in Python 3 */
1657 #if PY_VERSION_HEX < 0x03000000
1658  (binaryfunc)0, /*nb_divide*/
1659 #endif
1660  (binaryfunc)0, /*nb_remainder*/
1661  (binaryfunc)0, /*nb_divmod*/
1662  (ternaryfunc)0,/*nb_power*/
1663  (unaryfunc)0, /*nb_negative*/
1664  (unaryfunc)0, /*nb_positive*/
1665  (unaryfunc)0, /*nb_absolute*/
1666  (inquiry)0, /*nb_nonzero*/
1667  0, /*nb_invert*/
1668  0, /*nb_lshift*/
1669  0, /*nb_rshift*/
1670  0, /*nb_and*/
1671  0, /*nb_xor*/
1672  0, /*nb_or*/
1673 #if PY_VERSION_HEX < 0x03000000
1674  0, /*nb_coerce*/
1675 #endif
1676  (unaryfunc)SwigPyObject_long, /*nb_int*/
1677 #if PY_VERSION_HEX < 0x03000000
1678  (unaryfunc)SwigPyObject_long, /*nb_long*/
1679 #else
1680  0, /*nb_reserved*/
1681 #endif
1682  (unaryfunc)0, /*nb_float*/
1683 #if PY_VERSION_HEX < 0x03000000
1684  (unaryfunc)SwigPyObject_oct, /*nb_oct*/
1685  (unaryfunc)SwigPyObject_hex, /*nb_hex*/
1686 #endif
1687 #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
1688  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
1689 #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1690  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1691 #else
1692  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1693 #endif
1694  };
1695 
1696  static PyTypeObject swigpyobject_type;
1697  static int type_init = 0;
1698  if (!type_init) {
1699  const PyTypeObject tmp = {
1700 #if PY_VERSION_HEX >= 0x03000000
1701  PyVarObject_HEAD_INIT(NULL, 0)
1702 #else
1703  PyObject_HEAD_INIT(NULL)
1704  0, /* ob_size */
1705 #endif
1706  "SwigPyObject", /* tp_name */
1707  sizeof(SwigPyObject), /* tp_basicsize */
1708  0, /* tp_itemsize */
1709  (destructor)SwigPyObject_dealloc, /* tp_dealloc */
1710  0, /* tp_print */
1711  (getattrfunc)0, /* tp_getattr */
1712  (setattrfunc)0, /* tp_setattr */
1713 #if PY_VERSION_HEX >= 0x03000000
1714  0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1715 #else
1716  (cmpfunc)SwigPyObject_compare, /* tp_compare */
1717 #endif
1718  (reprfunc)SwigPyObject_repr, /* tp_repr */
1719  &SwigPyObject_as_number, /* tp_as_number */
1720  0, /* tp_as_sequence */
1721  0, /* tp_as_mapping */
1722  (hashfunc)0, /* tp_hash */
1723  (ternaryfunc)0, /* tp_call */
1724  0, /* tp_str */
1725  PyObject_GenericGetAttr, /* tp_getattro */
1726  0, /* tp_setattro */
1727  0, /* tp_as_buffer */
1728  Py_TPFLAGS_DEFAULT, /* tp_flags */
1729  swigobject_doc, /* tp_doc */
1730  0, /* tp_traverse */
1731  0, /* tp_clear */
1732  (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1733  0, /* tp_weaklistoffset */
1734  0, /* tp_iter */
1735  0, /* tp_iternext */
1736  swigobject_methods, /* tp_methods */
1737  0, /* tp_members */
1738  0, /* tp_getset */
1739  0, /* tp_base */
1740  0, /* tp_dict */
1741  0, /* tp_descr_get */
1742  0, /* tp_descr_set */
1743  0, /* tp_dictoffset */
1744  0, /* tp_init */
1745  0, /* tp_alloc */
1746  0, /* tp_new */
1747  0, /* tp_free */
1748  0, /* tp_is_gc */
1749  0, /* tp_bases */
1750  0, /* tp_mro */
1751  0, /* tp_cache */
1752  0, /* tp_subclasses */
1753  0, /* tp_weaklist */
1754  0, /* tp_del */
1755  0, /* tp_version_tag */
1756 #if PY_VERSION_HEX >= 0x03040000
1757  0, /* tp_finalize */
1758 #endif
1759 #ifdef COUNT_ALLOCS
1760  0, /* tp_allocs */
1761  0, /* tp_frees */
1762  0, /* tp_maxalloc */
1763  0, /* tp_prev */
1764  0 /* tp_next */
1765 #endif
1766  };
1767  swigpyobject_type = tmp;
1768  type_init = 1;
1769  if (PyType_Ready(&swigpyobject_type) < 0)
1770  return NULL;
1771  }
1772  return &swigpyobject_type;
1773 }
1774 
1775 SWIGRUNTIME PyObject *
1776 SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1777 {
1778  SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1779  if (sobj) {
1780  sobj->ptr = ptr;
1781  sobj->ty = ty;
1782  sobj->own = own;
1783  sobj->next = 0;
1784  }
1785  return (PyObject *)sobj;
1786 }
1787 
1788 /* -----------------------------------------------------------------------------
1789  * Implements a simple Swig Packed type, and use it instead of string
1790  * ----------------------------------------------------------------------------- */
1791 
1792 typedef struct {
1793  PyObject_HEAD
1794  void *pack;
1796  size_t size;
1797 } SwigPyPacked;
1798 
1799 SWIGRUNTIME PyObject *
1801 {
1802  char result[SWIG_BUFFER_SIZE];
1803  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1804  return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1805  } else {
1806  return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1807  }
1808 }
1809 
1810 SWIGRUNTIME PyObject *
1812 {
1813  char result[SWIG_BUFFER_SIZE];
1814  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1815  return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
1816  } else {
1817  return SWIG_Python_str_FromChar(v->ty->name);
1818  }
1819 }
1820 
1821 SWIGRUNTIME int
1823 {
1824  size_t i = v->size;
1825  size_t j = w->size;
1826  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1827  return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size);
1828 }
1829 
1830 SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
1831 
1832 SWIGRUNTIME PyTypeObject*
1834  static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
1835  return type;
1836 }
1837 
1839 SwigPyPacked_Check(PyObject *op) {
1840  return ((op)->ob_type == SwigPyPacked_TypeOnce())
1841  || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
1842 }
1843 
1844 SWIGRUNTIME void
1846 {
1847  if (SwigPyPacked_Check(v)) {
1848  SwigPyPacked *sobj = (SwigPyPacked *) v;
1849  free(sobj->pack);
1850  }
1851  PyObject_DEL(v);
1852 }
1853 
1854 SWIGRUNTIME PyTypeObject*
1856  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1857  static PyTypeObject swigpypacked_type;
1858  static int type_init = 0;
1859  if (!type_init) {
1860  const PyTypeObject tmp = {
1861 #if PY_VERSION_HEX>=0x03000000
1862  PyVarObject_HEAD_INIT(NULL, 0)
1863 #else
1864  PyObject_HEAD_INIT(NULL)
1865  0, /* ob_size */
1866 #endif
1867  "SwigPyPacked", /* tp_name */
1868  sizeof(SwigPyPacked), /* tp_basicsize */
1869  0, /* tp_itemsize */
1870  (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
1871  0, /* tp_print */
1872  (getattrfunc)0, /* tp_getattr */
1873  (setattrfunc)0, /* tp_setattr */
1874 #if PY_VERSION_HEX>=0x03000000
1875  0, /* tp_reserved in 3.0.1 */
1876 #else
1877  (cmpfunc)SwigPyPacked_compare, /* tp_compare */
1878 #endif
1879  (reprfunc)SwigPyPacked_repr, /* tp_repr */
1880  0, /* tp_as_number */
1881  0, /* tp_as_sequence */
1882  0, /* tp_as_mapping */
1883  (hashfunc)0, /* tp_hash */
1884  (ternaryfunc)0, /* tp_call */
1885  (reprfunc)SwigPyPacked_str, /* tp_str */
1886  PyObject_GenericGetAttr, /* tp_getattro */
1887  0, /* tp_setattro */
1888  0, /* tp_as_buffer */
1889  Py_TPFLAGS_DEFAULT, /* tp_flags */
1890  swigpacked_doc, /* tp_doc */
1891  0, /* tp_traverse */
1892  0, /* tp_clear */
1893  0, /* tp_richcompare */
1894  0, /* tp_weaklistoffset */
1895  0, /* tp_iter */
1896  0, /* tp_iternext */
1897  0, /* tp_methods */
1898  0, /* tp_members */
1899  0, /* tp_getset */
1900  0, /* tp_base */
1901  0, /* tp_dict */
1902  0, /* tp_descr_get */
1903  0, /* tp_descr_set */
1904  0, /* tp_dictoffset */
1905  0, /* tp_init */
1906  0, /* tp_alloc */
1907  0, /* tp_new */
1908  0, /* tp_free */
1909  0, /* tp_is_gc */
1910  0, /* tp_bases */
1911  0, /* tp_mro */
1912  0, /* tp_cache */
1913  0, /* tp_subclasses */
1914  0, /* tp_weaklist */
1915  0, /* tp_del */
1916  0, /* tp_version_tag */
1917 #if PY_VERSION_HEX >= 0x03040000
1918  0, /* tp_finalize */
1919 #endif
1920 #ifdef COUNT_ALLOCS
1921  0, /* tp_allocs */
1922  0, /* tp_frees */
1923  0, /* tp_maxalloc */
1924  0, /* tp_prev */
1925  0 /* tp_next */
1926 #endif
1927  };
1928  swigpypacked_type = tmp;
1929  type_init = 1;
1930  if (PyType_Ready(&swigpypacked_type) < 0)
1931  return NULL;
1932  }
1933  return &swigpypacked_type;
1934 }
1935 
1936 SWIGRUNTIME PyObject *
1937 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
1938 {
1939  SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
1940  if (sobj) {
1941  void *pack = malloc(size);
1942  if (pack) {
1943  memcpy(pack, ptr, size);
1944  sobj->pack = pack;
1945  sobj->ty = ty;
1946  sobj->size = size;
1947  } else {
1948  PyObject_DEL((PyObject *) sobj);
1949  sobj = 0;
1950  }
1951  }
1952  return (PyObject *) sobj;
1953 }
1954 
1956 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
1957 {
1958  if (SwigPyPacked_Check(obj)) {
1959  SwigPyPacked *sobj = (SwigPyPacked *)obj;
1960  if (sobj->size != size) return 0;
1961  memcpy(ptr, sobj->pack, size);
1962  return sobj->ty;
1963  } else {
1964  return 0;
1965  }
1966 }
1967 
1968 /* -----------------------------------------------------------------------------
1969  * pointers/data manipulation
1970  * ----------------------------------------------------------------------------- */
1971 
1972 static PyObject *Swig_This_global = NULL;
1973 
1974 SWIGRUNTIME PyObject *
1976 {
1977  if (Swig_This_global == NULL)
1979  return Swig_This_global;
1980 }
1981 
1982 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1983 
1984 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
1985 #if PY_VERSION_HEX>=0x03000000
1986 #define SWIG_PYTHON_SLOW_GETSET_THIS
1987 #endif
1988 
1990 SWIG_Python_GetSwigThis(PyObject *pyobj)
1991 {
1992  PyObject *obj;
1993 
1994  if (SwigPyObject_Check(pyobj))
1995  return (SwigPyObject *) pyobj;
1996 
1997 #ifdef SWIGPYTHON_BUILTIN
1998  (void)obj;
1999 # ifdef PyWeakref_CheckProxy
2000  if (PyWeakref_CheckProxy(pyobj)) {
2001  pyobj = PyWeakref_GET_OBJECT(pyobj);
2002  if (pyobj && SwigPyObject_Check(pyobj))
2003  return (SwigPyObject*) pyobj;
2004  }
2005 # endif
2006  return NULL;
2007 #else
2008 
2009  obj = 0;
2010 
2011 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2012  if (PyInstance_Check(pyobj)) {
2013  obj = _PyInstance_Lookup(pyobj, SWIG_This());
2014  } else {
2015  PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2016  if (dictptr != NULL) {
2017  PyObject *dict = *dictptr;
2018  obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2019  } else {
2020 #ifdef PyWeakref_CheckProxy
2021  if (PyWeakref_CheckProxy(pyobj)) {
2022  PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2023  return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2024  }
2025 #endif
2026  obj = PyObject_GetAttr(pyobj,SWIG_This());
2027  if (obj) {
2028  Py_DECREF(obj);
2029  } else {
2030  if (PyErr_Occurred()) PyErr_Clear();
2031  return 0;
2032  }
2033  }
2034  }
2035 #else
2036  obj = PyObject_GetAttr(pyobj,SWIG_This());
2037  if (obj) {
2038  Py_DECREF(obj);
2039  } else {
2040  if (PyErr_Occurred()) PyErr_Clear();
2041  return 0;
2042  }
2043 #endif
2044  if (obj && !SwigPyObject_Check(obj)) {
2045  /* a PyObject is called 'this', try to get the 'real this'
2046  SwigPyObject from it */
2047  return SWIG_Python_GetSwigThis(obj);
2048  }
2049  return (SwigPyObject *)obj;
2050 #endif
2051 }
2052 
2053 /* Acquire a pointer value */
2054 
2055 SWIGRUNTIME int
2056 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2057  if (own == SWIG_POINTER_OWN) {
2059  if (sobj) {
2060  int oldown = sobj->own;
2061  sobj->own = own;
2062  return oldown;
2063  }
2064  }
2065  return 0;
2066 }
2067 
2068 /* Convert a pointer value */
2069 
2070 SWIGRUNTIME int
2071 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2072  int res;
2073  SwigPyObject *sobj;
2074  int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
2075 
2076  if (!obj)
2077  return SWIG_ERROR;
2078  if (obj == Py_None && !implicit_conv) {
2079  if (ptr)
2080  *ptr = 0;
2082  }
2083 
2084  res = SWIG_ERROR;
2085 
2086  sobj = SWIG_Python_GetSwigThis(obj);
2087  if (own)
2088  *own = 0;
2089  while (sobj) {
2090  void *vptr = sobj->ptr;
2091  if (ty) {
2092  swig_type_info *to = sobj->ty;
2093  if (to == ty) {
2094  /* no type cast needed */
2095  if (ptr) *ptr = vptr;
2096  break;
2097  } else {
2098  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2099  if (!tc) {
2100  sobj = (SwigPyObject *)sobj->next;
2101  } else {
2102  if (ptr) {
2103  int newmemory = 0;
2104  *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2105  if (newmemory == SWIG_CAST_NEW_MEMORY) {
2106  assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2107  if (own)
2108  *own = *own | SWIG_CAST_NEW_MEMORY;
2109  }
2110  }
2111  break;
2112  }
2113  }
2114  } else {
2115  if (ptr) *ptr = vptr;
2116  break;
2117  }
2118  }
2119  if (sobj) {
2120  if (own)
2121  *own = *own | sobj->own;
2122  if (flags & SWIG_POINTER_DISOWN) {
2123  sobj->own = 0;
2124  }
2125  res = SWIG_OK;
2126  } else {
2127  if (implicit_conv) {
2128  SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2129  if (data && !data->implicitconv) {
2130  PyObject *klass = data->klass;
2131  if (klass) {
2132  PyObject *impconv;
2133  data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2134  impconv = SWIG_Python_CallFunctor(klass, obj);
2135  data->implicitconv = 0;
2136  if (PyErr_Occurred()) {
2137  PyErr_Clear();
2138  impconv = 0;
2139  }
2140  if (impconv) {
2141  SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2142  if (iobj) {
2143  void *vptr;
2144  res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2145  if (SWIG_IsOK(res)) {
2146  if (ptr) {
2147  *ptr = vptr;
2148  /* transfer the ownership to 'ptr' */
2149  iobj->own = 0;
2150  res = SWIG_AddCast(res);
2151  res = SWIG_AddNewMask(res);
2152  } else {
2153  res = SWIG_AddCast(res);
2154  }
2155  }
2156  }
2157  Py_DECREF(impconv);
2158  }
2159  }
2160  }
2161  if (!SWIG_IsOK(res) && obj == Py_None) {
2162  if (ptr)
2163  *ptr = 0;
2164  if (PyErr_Occurred())
2165  PyErr_Clear();
2166  res = SWIG_OK;
2167  }
2168  }
2169  }
2170  return res;
2171 }
2172 
2173 /* Convert a function ptr value */
2174 
2175 SWIGRUNTIME int
2176 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2177  if (!PyCFunction_Check(obj)) {
2178  return SWIG_ConvertPtr(obj, ptr, ty, 0);
2179  } else {
2180  void *vptr = 0;
2181  swig_cast_info *tc;
2182 
2183  /* here we get the method pointer for callbacks */
2184  const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2185  const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2186  if (desc)
2187  desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2188  if (!desc)
2189  return SWIG_ERROR;
2190  tc = SWIG_TypeCheck(desc,ty);
2191  if (tc) {
2192  int newmemory = 0;
2193  *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2194  assert(!newmemory); /* newmemory handling not yet implemented */
2195  } else {
2196  return SWIG_ERROR;
2197  }
2198  return SWIG_OK;
2199  }
2200 }
2201 
2202 /* Convert a packed pointer value */
2203 
2204 SWIGRUNTIME int
2205 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2206  swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2207  if (!to) return SWIG_ERROR;
2208  if (ty) {
2209  if (to != ty) {
2210  /* check type cast? */
2211  swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2212  if (!tc) return SWIG_ERROR;
2213  }
2214  }
2215  return SWIG_OK;
2216 }
2217 
2218 /* -----------------------------------------------------------------------------
2219  * Create a new pointer object
2220  * ----------------------------------------------------------------------------- */
2221 
2222 /*
2223  Create a new instance object, without calling __init__, and set the
2224  'this' attribute.
2225 */
2226 
2227 SWIGRUNTIME PyObject*
2229 {
2230  PyObject *inst = 0;
2231  PyObject *newraw = data->newraw;
2232  if (newraw) {
2233  inst = PyObject_Call(newraw, data->newargs, NULL);
2234  if (inst) {
2235 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2236  PyObject **dictptr = _PyObject_GetDictPtr(inst);
2237  if (dictptr != NULL) {
2238  PyObject *dict = *dictptr;
2239  if (dict == NULL) {
2240  dict = PyDict_New();
2241  *dictptr = dict;
2242  PyDict_SetItem(dict, SWIG_This(), swig_this);
2243  }
2244  }
2245 #else
2246  PyObject *key = SWIG_This();
2247  PyObject_SetAttr(inst, key, swig_this);
2248 #endif
2249  }
2250  } else {
2251 #if PY_VERSION_HEX >= 0x03000000
2252  PyObject *empty_args = PyTuple_New(0);
2253  if (empty_args) {
2254  PyObject *empty_kwargs = PyDict_New();
2255  if (empty_kwargs) {
2256  inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
2257  Py_DECREF(empty_kwargs);
2258  if (inst) {
2259  PyObject_SetAttr(inst, SWIG_This(), swig_this);
2260  Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2261  }
2262  }
2263  Py_DECREF(empty_args);
2264  }
2265 #else
2266  PyObject *dict = PyDict_New();
2267  if (dict) {
2268  PyDict_SetItem(dict, SWIG_This(), swig_this);
2269  inst = PyInstance_NewRaw(data->newargs, dict);
2270  Py_DECREF(dict);
2271  }
2272 #endif
2273  }
2274  return inst;
2275 }
2276 
2277 SWIGRUNTIME void
2278 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2279 {
2280  PyObject *dict;
2281 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2282  PyObject **dictptr = _PyObject_GetDictPtr(inst);
2283  if (dictptr != NULL) {
2284  dict = *dictptr;
2285  if (dict == NULL) {
2286  dict = PyDict_New();
2287  *dictptr = dict;
2288  }
2289  PyDict_SetItem(dict, SWIG_This(), swig_this);
2290  return;
2291  }
2292 #endif
2293  dict = PyObject_GetAttrString(inst, "__dict__");
2294  PyDict_SetItem(dict, SWIG_This(), swig_this);
2295  Py_DECREF(dict);
2296 }
2297 
2298 
2299 SWIGINTERN PyObject *
2301  PyObject *obj[2];
2302  if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2303  return NULL;
2304  } else {
2305  SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2306  if (sthis) {
2307  SwigPyObject_append((PyObject*) sthis, obj[1]);
2308  } else {
2309  SWIG_Python_SetSwigThis(obj[0], obj[1]);
2310  }
2311  return SWIG_Py_Void();
2312  }
2313 }
2314 
2315 /* Create a new pointer object */
2316 
2317 SWIGRUNTIME PyObject *
2318 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2319  SwigPyClientData *clientdata;
2320  PyObject * robj;
2321  int own;
2322 
2323  if (!ptr)
2324  return SWIG_Py_Void();
2325 
2326  clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2327  own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2328  if (clientdata && clientdata->pytype) {
2329  SwigPyObject *newobj;
2330  if (flags & SWIG_BUILTIN_TP_INIT) {
2331  newobj = (SwigPyObject*) self;
2332  if (newobj->ptr) {
2333  PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2334  while (newobj->next)
2335  newobj = (SwigPyObject *) newobj->next;
2336  newobj->next = next_self;
2337  newobj = (SwigPyObject *)next_self;
2338 #ifdef SWIGPYTHON_BUILTIN
2339  newobj->dict = 0;
2340 #endif
2341  }
2342  } else {
2343  newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2344 #ifdef SWIGPYTHON_BUILTIN
2345  newobj->dict = 0;
2346 #endif
2347  }
2348  if (newobj) {
2349  newobj->ptr = ptr;
2350  newobj->ty = type;
2351  newobj->own = own;
2352  newobj->next = 0;
2353  return (PyObject*) newobj;
2354  }
2355  return SWIG_Py_Void();
2356  }
2357 
2358  assert(!(flags & SWIG_BUILTIN_TP_INIT));
2359 
2360  robj = SwigPyObject_New(ptr, type, own);
2361  if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2362  PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2363  Py_DECREF(robj);
2364  robj = inst;
2365  }
2366  return robj;
2367 }
2368 
2369 /* Create a new packed object */
2370 
2371 SWIGRUNTIMEINLINE PyObject *
2372 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2373  return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2374 }
2375 
2376 /* -----------------------------------------------------------------------------*
2377  * Get type list
2378  * -----------------------------------------------------------------------------*/
2379 
2380 #ifdef SWIG_LINK_RUNTIME
2381 void *SWIG_ReturnGlobalTypeList(void *);
2382 #endif
2383 
2386  static void *type_pointer = (void *)0;
2387  /* first check if module already created */
2388  if (!type_pointer) {
2389 #ifdef SWIG_LINK_RUNTIME
2390  type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2391 #else
2392  type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2393  if (PyErr_Occurred()) {
2394  PyErr_Clear();
2395  type_pointer = (void *)0;
2396  }
2397 #endif
2398  }
2399  return (swig_module_info *) type_pointer;
2400 }
2401 
2402 SWIGRUNTIME void
2404 {
2405  swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2406  swig_type_info **types = swig_module->types;
2407  size_t i;
2408  for (i =0; i < swig_module->size; ++i) {
2409  swig_type_info *ty = types[i];
2410  if (ty->owndata) {
2412  if (data) SwigPyClientData_Del(data);
2413  }
2414  }
2415  Py_DECREF(SWIG_This());
2416  Swig_This_global = NULL;
2417 }
2418 
2419 SWIGRUNTIME void
2421 #if PY_VERSION_HEX >= 0x03000000
2422  /* Add a dummy module object into sys.modules */
2423  PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
2424 #else
2425  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2426  PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2427 #endif
2428  PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2429  if (pointer && module) {
2430  PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2431  } else {
2432  Py_XDECREF(pointer);
2433  }
2434 }
2435 
2436 /* The python cached type query */
2437 SWIGRUNTIME PyObject *
2439  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2440  return cache;
2441 }
2442 
2444 SWIG_Python_TypeQuery(const char *type)
2445 {
2446  PyObject *cache = SWIG_Python_TypeCache();
2447  PyObject *key = SWIG_Python_str_FromChar(type);
2448  PyObject *obj = PyDict_GetItem(cache, key);
2449  swig_type_info *descriptor;
2450  if (obj) {
2451  descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2452  } else {
2454  descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2455  if (descriptor) {
2456  obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2457  PyDict_SetItem(cache, key, obj);
2458  Py_DECREF(obj);
2459  }
2460  }
2461  Py_DECREF(key);
2462  return descriptor;
2463 }
2464 
2465 /*
2466  For backward compatibility only
2467 */
2468 #define SWIG_POINTER_EXCEPTION 0
2469 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2470 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2471 
2472 SWIGRUNTIME int
2473 SWIG_Python_AddErrMesg(const char* mesg, int infront)
2474 {
2475  if (PyErr_Occurred()) {
2476  PyObject *type = 0;
2477  PyObject *value = 0;
2478  PyObject *traceback = 0;
2479  PyErr_Fetch(&type, &value, &traceback);
2480  if (value) {
2481  PyObject *old_str = PyObject_Str(value);
2482  const char *tmp = SWIG_Python_str_AsChar(old_str);
2483  const char *errmesg = tmp ? tmp : "Invalid error message";
2484  Py_XINCREF(type);
2485  PyErr_Clear();
2486  if (infront) {
2487  PyErr_Format(type, "%s %s", mesg, errmesg);
2488  } else {
2489  PyErr_Format(type, "%s %s", errmesg, mesg);
2490  }
2492  Py_DECREF(old_str);
2493  }
2494  return 1;
2495  } else {
2496  return 0;
2497  }
2498 }
2499 
2500 SWIGRUNTIME int
2502 {
2503  if (PyErr_Occurred()) {
2504  /* add information about failing argument */
2505  char mesg[256];
2506  PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2507  return SWIG_Python_AddErrMesg(mesg, 1);
2508  } else {
2509  return 0;
2510  }
2511 }
2512 
2513 SWIGRUNTIMEINLINE const char *
2514 SwigPyObject_GetDesc(PyObject *self)
2515 {
2516  SwigPyObject *v = (SwigPyObject *)self;
2517  swig_type_info *ty = v ? v->ty : 0;
2518  return ty ? ty->str : "";
2519 }
2520 
2521 SWIGRUNTIME void
2522 SWIG_Python_TypeError(const char *type, PyObject *obj)
2523 {
2524  if (type) {
2525 #if defined(SWIG_COBJECT_TYPES)
2526  if (obj && SwigPyObject_Check(obj)) {
2527  const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2528  if (otype) {
2529  PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2530  type, otype);
2531  return;
2532  }
2533  } else
2534 #endif
2535  {
2536  const char *otype = (obj ? obj->ob_type->tp_name : 0);
2537  if (otype) {
2538  PyObject *str = PyObject_Str(obj);
2539  const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2540  if (cstr) {
2541  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2542  type, otype, cstr);
2544  } else {
2545  PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2546  type, otype);
2547  }
2548  Py_XDECREF(str);
2549  return;
2550  }
2551  }
2552  PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2553  } else {
2554  PyErr_Format(PyExc_TypeError, "unexpected type is received");
2555  }
2556 }
2557 
2558 
2559 /* Convert a pointer value, signal an exception on a type mismatch */
2560 SWIGRUNTIME void *
2561 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2562  void *result;
2563  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2564  PyErr_Clear();
2565 #if SWIG_POINTER_EXCEPTION
2566  if (flags) {
2568  SWIG_Python_ArgFail(argnum);
2569  }
2570 #endif
2571  }
2572  return result;
2573 }
2574 
2575 #ifdef SWIGPYTHON_BUILTIN
2576 SWIGRUNTIME int
2577 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2578  PyTypeObject *tp = obj->ob_type;
2579  PyObject *descr;
2580  PyObject *encoded_name;
2581  descrsetfunc f;
2582  int res = -1;
2583 
2584 # ifdef Py_USING_UNICODE
2585  if (PyString_Check(name)) {
2586  name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2587  if (!name)
2588  return -1;
2589  } else if (!PyUnicode_Check(name))
2590 # else
2591  if (!PyString_Check(name))
2592 # endif
2593  {
2594  PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2595  return -1;
2596  } else {
2597  Py_INCREF(name);
2598  }
2599 
2600  if (!tp->tp_dict) {
2601  if (PyType_Ready(tp) < 0)
2602  goto done;
2603  }
2604 
2605  descr = _PyType_Lookup(tp, name);
2606  f = NULL;
2607  if (descr != NULL)
2608  f = descr->ob_type->tp_descr_set;
2609  if (!f) {
2610  if (PyString_Check(name)) {
2611  encoded_name = name;
2612  Py_INCREF(name);
2613  } else {
2614  encoded_name = PyUnicode_AsUTF8String(name);
2615  if (!encoded_name)
2616  return -1;
2617  }
2618  PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2619  Py_DECREF(encoded_name);
2620  } else {
2621  res = f(descr, obj, value);
2622  }
2623 
2624  done:
2625  Py_DECREF(name);
2626  return res;
2627 }
2628 #endif
2629 
2630 
2631 #ifdef __cplusplus
2632 }
2633 #endif
2634 
2635 
2636 
2637 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2638 
2639 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2640 
2641 
2642 
2643 #ifdef __cplusplus
2644 extern "C" {
2645 #endif
2646 
2647 /* Method creation and docstring support functions */
2648 
2649 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
2650 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2651 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2652 
2653 #ifdef __cplusplus
2654 }
2655 #endif
2656 
2657 
2658  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
2659 
2660 
2661 /* -------- TYPES TABLE (BEGIN) -------- */
2662 
2663 #define SWIGTYPE_p_char swig_types[0]
2664 #define SWIGTYPE_p_int swig_types[1]
2665 #define SWIGTYPE_p_long swig_types[2]
2666 #define SWIGTYPE_p_operations_research__KnapsackSolver swig_types[3]
2667 #define SWIGTYPE_p_short swig_types[4]
2668 #define SWIGTYPE_p_signed_char swig_types[5]
2669 #define SWIGTYPE_p_unsigned_char swig_types[6]
2670 #define SWIGTYPE_p_unsigned_int swig_types[7]
2671 #define SWIGTYPE_p_unsigned_long swig_types[8]
2672 #define SWIGTYPE_p_unsigned_short swig_types[9]
2674 static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0};
2675 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2676 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2677 
2678 /* -------- TYPES TABLE (END) -------- */
2679 
2680 #ifdef SWIG_TypeQuery
2681 # undef SWIG_TypeQuery
2682 #endif
2683 #define SWIG_TypeQuery SWIG_Python_TypeQuery
2684 
2685 /*-----------------------------------------------
2686  @(target):= _pywrapknapsack_solver.so
2687  ------------------------------------------------*/
2688 #if PY_VERSION_HEX >= 0x03000000
2689 # define SWIG_init PyInit__pywrapknapsack_solver
2690 
2691 #else
2692 # define SWIG_init init_pywrapknapsack_solver
2693 
2694 #endif
2695 #define SWIG_name "_pywrapknapsack_solver"
2696 
2697 #define SWIGVERSION 0x040001
2698 #define SWIG_VERSION SWIGVERSION
2699 
2700 
2701 #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
2702 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
2703 
2704 
2705 #include <stdexcept>
2706 
2707 
2708 namespace swig {
2710  protected:
2711  PyObject *_obj;
2712 
2713  public:
2715  {
2716  }
2717 
2719  {
2721  Py_XINCREF(_obj);
2723  }
2724 
2725  SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
2726  {
2727  if (initial_ref) {
2729  Py_XINCREF(_obj);
2731  }
2732  }
2733 
2735  {
2737  Py_XINCREF(item._obj);
2738  Py_XDECREF(_obj);
2739  _obj = item._obj;
2741  return *this;
2742  }
2743 
2745  {
2747  Py_XDECREF(_obj);
2749  }
2750 
2751  operator PyObject *() const
2752  {
2753  return _obj;
2754  }
2755 
2756  PyObject *operator->() const
2757  {
2758  return _obj;
2759  }
2760  };
2761 }
2762 
2763 
2764 namespace swig {
2766  SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
2767 
2769  {
2770  Py_XDECREF(_obj);
2771  _obj = obj;
2772  return *this;
2773  }
2774  };
2775 }
2776 
2777 
2778 #include <cstdint>
2779 #include <string>
2780 #include <vector>
2781 
2782 #include "ortools/base/basictypes.h"
2783 
2784 
2785 #include <stdint.h> // Use the C99 official header
2786 
2787 
2788 #define SWIGWORDSIZE64
2789 #ifndef LONG_MAX
2790 #include <limits.h>
2791 #endif
2792 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
2793 # error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
2794 #endif
2795 
2796 
2797 #include <string>
2798 
2799 
2800 #include "ortools/base/python-swig.h"
2801 
2802 
2804 
2805 
2806 SWIGINTERNINLINE PyObject*
2808 {
2809  return PyInt_FromLong((long) value);
2810 }
2811 
2812 
2815 {
2816  static int init = 0;
2817  static swig_type_info* info = 0;
2818  if (!init) {
2819  info = SWIG_TypeQuery("_p_char");
2820  init = 1;
2821  }
2822  return info;
2823 }
2824 
2825 
2826 SWIGINTERN int
2827 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
2828 {
2829 #if PY_VERSION_HEX>=0x03000000
2830 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2831  if (PyBytes_Check(obj))
2832 #else
2833  if (PyUnicode_Check(obj))
2834 #endif
2835 #else
2836  if (PyString_Check(obj))
2837 #endif
2838  {
2839  char *cstr; Py_ssize_t len;
2840  int ret = SWIG_OK;
2841 #if PY_VERSION_HEX>=0x03000000
2842 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2843  if (!alloc && cptr) {
2844  /* We can't allow converting without allocation, since the internal
2845  representation of string in Python 3 is UCS-2/UCS-4 but we require
2846  a UTF-8 representation.
2847  TODO(bhy) More detailed explanation */
2848  return SWIG_RuntimeError;
2849  }
2850  obj = PyUnicode_AsUTF8String(obj);
2851  if (!obj)
2852  return SWIG_TypeError;
2853  if (alloc)
2854  *alloc = SWIG_NEWOBJ;
2855 #endif
2856  PyBytes_AsStringAndSize(obj, &cstr, &len);
2857 #else
2858  PyString_AsStringAndSize(obj, &cstr, &len);
2859 #endif
2860  if (cptr) {
2861  if (alloc) {
2862  if (*alloc == SWIG_NEWOBJ) {
2863  *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
2864  *alloc = SWIG_NEWOBJ;
2865  } else {
2866  *cptr = cstr;
2867  *alloc = SWIG_OLDOBJ;
2868  }
2869  } else {
2870 #if PY_VERSION_HEX>=0x03000000
2871 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2872  *cptr = PyBytes_AsString(obj);
2873 #else
2874  assert(0); /* Should never reach here with Unicode strings in Python 3 */
2875 #endif
2876 #else
2877  *cptr = SWIG_Python_str_AsChar(obj);
2878  if (!*cptr)
2879  ret = SWIG_TypeError;
2880 #endif
2881  }
2882  }
2883  if (psize) *psize = len + 1;
2884 #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2885  Py_XDECREF(obj);
2886 #endif
2887  return ret;
2888  } else {
2889 #if defined(SWIG_PYTHON_2_UNICODE)
2890 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2891 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
2892 #endif
2893 #if PY_VERSION_HEX<0x03000000
2894  if (PyUnicode_Check(obj)) {
2895  char *cstr; Py_ssize_t len;
2896  if (!alloc && cptr) {
2897  return SWIG_RuntimeError;
2898  }
2899  obj = PyUnicode_AsUTF8String(obj);
2900  if (!obj)
2901  return SWIG_TypeError;
2902  if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
2903  if (cptr) {
2904  if (alloc) *alloc = SWIG_NEWOBJ;
2905  *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
2906  }
2907  if (psize) *psize = len + 1;
2908 
2909  Py_XDECREF(obj);
2910  return SWIG_OK;
2911  } else {
2912  Py_XDECREF(obj);
2913  }
2914  }
2915 #endif
2916 #endif
2917 
2918  swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2919  if (pchar_descriptor) {
2920  void* vptr = 0;
2921  if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2922  if (cptr) *cptr = (char *) vptr;
2923  if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
2924  if (alloc) *alloc = SWIG_OLDOBJ;
2925  return SWIG_OK;
2926  }
2927  }
2928  }
2929  return SWIG_TypeError;
2930 }
2931 
2932 
2933 SWIGINTERN int
2934 SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
2935 {
2936  char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
2937  if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
2938  if (buf) {
2939  if (val) *val = new std::string(buf, size - 1);
2940  if (alloc == SWIG_NEWOBJ) delete[] buf;
2941  return SWIG_NEWOBJ;
2942  } else {
2943  if (val) *val = 0;
2944  return SWIG_OLDOBJ;
2945  }
2946  } else {
2947  static int init = 0;
2948  static swig_type_info* descriptor = 0;
2949  if (!init) {
2950  descriptor = SWIG_TypeQuery("std::string" " *");
2951  init = 1;
2952  }
2953  if (descriptor) {
2954  std::string *vptr;
2955  int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
2956  if (SWIG_IsOK(res) && val) *val = vptr;
2957  return res;
2958  }
2959  }
2960  return SWIG_ERROR;
2961 }
2962 
2963 
2964 #include <limits.h>
2965 #if !defined(SWIG_NO_LLONG_MAX)
2966 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
2967 # define LLONG_MAX __LONG_LONG_MAX__
2968 # define LLONG_MIN (-LLONG_MAX - 1LL)
2969 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
2970 # endif
2971 #endif
2972 
2973 
2974 SWIGINTERN int
2975 SWIG_AsVal_double (PyObject *obj, double *val)
2976 {
2977  int res = SWIG_TypeError;
2978  if (PyFloat_Check(obj)) {
2979  if (val) *val = PyFloat_AsDouble(obj);
2980  return SWIG_OK;
2981 #if PY_VERSION_HEX < 0x03000000
2982  } else if (PyInt_Check(obj)) {
2983  if (val) *val = (double) PyInt_AsLong(obj);
2984  return SWIG_OK;
2985 #endif
2986  } else if (PyLong_Check(obj)) {
2987  double v = PyLong_AsDouble(obj);
2988  if (!PyErr_Occurred()) {
2989  if (val) *val = v;
2990  return SWIG_OK;
2991  } else {
2992  PyErr_Clear();
2993  }
2994  }
2995 #ifdef SWIG_PYTHON_CAST_MODE
2996  {
2997  int dispatch = 0;
2998  double d = PyFloat_AsDouble(obj);
2999  if (!PyErr_Occurred()) {
3000  if (val) *val = d;
3001  return SWIG_AddCast(SWIG_OK);
3002  } else {
3003  PyErr_Clear();
3004  }
3005  if (!dispatch) {
3006  long v = PyLong_AsLong(obj);
3007  if (!PyErr_Occurred()) {
3008  if (val) *val = v;
3010  } else {
3011  PyErr_Clear();
3012  }
3013  }
3014  }
3015 #endif
3016  return res;
3017 }
3018 
3019 
3020 #include <float.h>
3021 
3022 
3023 #include <math.h>
3024 
3025 
3026 SWIGINTERNINLINE int
3027 SWIG_CanCastAsInteger(double *d, double min, double max) {
3028  double x = *d;
3029  if ((min <= x && x <= max)) {
3030  double fx = floor(x);
3031  double cx = ceil(x);
3032  double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
3033  if ((errno == EDOM) || (errno == ERANGE)) {
3034  errno = 0;
3035  } else {
3036  double summ, reps, diff;
3037  if (rd < x) {
3038  diff = x - rd;
3039  } else if (rd > x) {
3040  diff = rd - x;
3041  } else {
3042  return 1;
3043  }
3044  summ = rd + x;
3045  reps = diff/summ;
3046  if (reps < 8*DBL_EPSILON) {
3047  *d = rd;
3048  return 1;
3049  }
3050  }
3051  }
3052  return 0;
3053 }
3054 
3055 
3056 SWIGINTERN int
3057 SWIG_AsVal_long (PyObject *obj, long* val)
3058 {
3059 #if PY_VERSION_HEX < 0x03000000
3060  if (PyInt_Check(obj)) {
3061  if (val) *val = PyInt_AsLong(obj);
3062  return SWIG_OK;
3063  } else
3064 #endif
3065  if (PyLong_Check(obj)) {
3066  long v = PyLong_AsLong(obj);
3067  if (!PyErr_Occurred()) {
3068  if (val) *val = v;
3069  return SWIG_OK;
3070  } else {
3071  PyErr_Clear();
3072  return SWIG_OverflowError;
3073  }
3074  }
3075 #ifdef SWIG_PYTHON_CAST_MODE
3076  {
3077  int dispatch = 0;
3078  long v = PyInt_AsLong(obj);
3079  if (!PyErr_Occurred()) {
3080  if (val) *val = v;
3081  return SWIG_AddCast(SWIG_OK);
3082  } else {
3083  PyErr_Clear();
3084  }
3085  if (!dispatch) {
3086  double d;
3087  int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3088  if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
3089  if (val) *val = (long)(d);
3090  return res;
3091  }
3092  }
3093  }
3094 #endif
3095  return SWIG_TypeError;
3096 }
3097 
3098 
3099 SWIGINTERN int
3100 SWIG_AsVal_int (PyObject * obj, int *val)
3101 {
3102  long v;
3103  int res = SWIG_AsVal_long (obj, &v);
3104  if (SWIG_IsOK(res)) {
3105  if ((v < INT_MIN || v > INT_MAX)) {
3106  return SWIG_OverflowError;
3107  } else {
3108  if (val) *val = static_cast< int >(v);
3109  }
3110  }
3111  return res;
3112 }
3113 
3114 
3115  #define SWIG_From_long PyInt_FromLong
3116 
3117 
3118 SWIGINTERNINLINE PyObject*
3120 {
3121  return PyBool_FromLong(value ? 1 : 0);
3122 }
3123 
3124 
3125 SWIGINTERN int
3126 SWIG_AsVal_bool (PyObject *obj, bool *val)
3127 {
3128  int r;
3129  if (!PyBool_Check(obj))
3130  return SWIG_ERROR;
3131  r = PyObject_IsTrue(obj);
3132  if (r == -1)
3133  return SWIG_ERROR;
3134  if (val) *val = r ? true : false;
3135  return SWIG_OK;
3136 }
3137 
3138 #ifdef __cplusplus
3139 extern "C" {
3140 #endif
3141 SWIGINTERN PyObject *_wrap_new_KnapsackSolver__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
3142  PyObject *resultobj = 0;
3143  std::string *arg1 = 0 ;
3144  int res1 = SWIG_OLDOBJ ;
3146 
3147  if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
3148  {
3149  std::string *ptr = (std::string *)0;
3150  res1 = SWIG_AsPtr_std_string(swig_obj[0], &ptr);
3151  if (!SWIG_IsOK(res1)) {
3152  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_KnapsackSolver" "', argument " "1"" of type '" "std::string const &""'");
3153  }
3154  if (!ptr) {
3155  SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_KnapsackSolver" "', argument " "1"" of type '" "std::string const &""'");
3156  }
3157  arg1 = ptr;
3158  }
3159  result = (operations_research::KnapsackSolver *)new operations_research::KnapsackSolver((std::string const &)*arg1);
3161  if (SWIG_IsNewObj(res1)) delete arg1;
3162  return resultobj;
3163 fail:
3164  if (SWIG_IsNewObj(res1)) delete arg1;
3165  return NULL;
3166 }
3167 
3168 
3169 SWIGINTERN PyObject *_wrap_new_KnapsackSolver__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
3170  PyObject *resultobj = 0;
3172  std::string *arg2 = 0 ;
3173  int val1 ;
3174  int ecode1 = 0 ;
3175  int res2 = SWIG_OLDOBJ ;
3177 
3178  if ((nobjs < 2) || (nobjs > 2)) SWIG_fail;
3179  ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
3180  if (!SWIG_IsOK(ecode1)) {
3181  SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_KnapsackSolver" "', argument " "1"" of type '" "operations_research::KnapsackSolver::SolverType""'");
3182  }
3183  arg1 = static_cast< operations_research::KnapsackSolver::SolverType >(val1);
3184  {
3185  std::string *ptr = (std::string *)0;
3186  res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
3187  if (!SWIG_IsOK(res2)) {
3188  SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_KnapsackSolver" "', argument " "2"" of type '" "std::string const &""'");
3189  }
3190  if (!ptr) {
3191  SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_KnapsackSolver" "', argument " "2"" of type '" "std::string const &""'");
3192  }
3193  arg2 = ptr;
3194  }
3195  result = (operations_research::KnapsackSolver *)new operations_research::KnapsackSolver(arg1,(std::string const &)*arg2);
3197  if (SWIG_IsNewObj(res2)) delete arg2;
3198  return resultobj;
3199 fail:
3200  if (SWIG_IsNewObj(res2)) delete arg2;
3201  return NULL;
3202 }
3203 
3204 
3205 SWIGINTERN PyObject *_wrap_new_KnapsackSolver(PyObject *self, PyObject *args) {
3206  Py_ssize_t argc;
3207  PyObject *argv[3] = {
3208  0
3209  };
3210 
3211  if (!(argc = SWIG_Python_UnpackTuple(args, "new_KnapsackSolver", 0, 2, argv))) SWIG_fail;
3212  --argc;
3213  if (argc == 1) {
3214  int _v;
3215  int res = SWIG_AsPtr_std_string(argv[0], (std::string**)(0));
3216  _v = SWIG_CheckState(res);
3217  if (_v) {
3218  return _wrap_new_KnapsackSolver__SWIG_0(self, argc, argv);
3219  }
3220  }
3221  if (argc == 2) {
3222  int _v;
3223  {
3224  int res = SWIG_AsVal_int(argv[0], NULL);
3225  _v = SWIG_CheckState(res);
3226  }
3227  if (_v) {
3228  int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0));
3229  _v = SWIG_CheckState(res);
3230  if (_v) {
3231  return _wrap_new_KnapsackSolver__SWIG_1(self, argc, argv);
3232  }
3233  }
3234  }
3235 
3236 fail:
3237  SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_KnapsackSolver'.\n"
3238  " Possible C/C++ prototypes are:\n"
3239  " operations_research::KnapsackSolver::KnapsackSolver(std::string const &)\n"
3240  " operations_research::KnapsackSolver::KnapsackSolver(operations_research::KnapsackSolver::SolverType,std::string const &)\n");
3241  return 0;
3242 }
3243 
3244 
3245 SWIGINTERN PyObject *_wrap_delete_KnapsackSolver(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3246  PyObject *resultobj = 0;
3248  void *argp1 = 0 ;
3249  int res1 = 0 ;
3250  PyObject *swig_obj[1] ;
3251 
3252  if (!args) SWIG_fail;
3253  swig_obj[0] = args;
3255  if (!SWIG_IsOK(res1)) {
3256  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_KnapsackSolver" "', argument " "1"" of type '" "operations_research::KnapsackSolver *""'");
3257  }
3258  arg1 = reinterpret_cast< operations_research::KnapsackSolver * >(argp1);
3259  delete arg1;
3260  resultobj = SWIG_Py_Void();
3261  return resultobj;
3262 fail:
3263  return NULL;
3264 }
3265 
3266 
3267 SWIGINTERN PyObject *_wrap_KnapsackSolver_Init(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3268  PyObject *resultobj = 0;
3270  std::vector< int64_t > *arg2 = 0 ;
3271  std::vector< std::vector< int64_t > > *arg3 = 0 ;
3272  std::vector< int64_t > *arg4 = 0 ;
3273  void *argp1 = 0 ;
3274  int res1 = 0 ;
3275  std::vector< int64_t > temp2 ;
3276  std::vector< std::vector< int64_t > > temp3 ;
3277  std::vector< int64_t > temp4 ;
3278  PyObject *swig_obj[4] ;
3279 
3280  if (!SWIG_Python_UnpackTuple(args, "KnapsackSolver_Init", 4, 4, swig_obj)) SWIG_fail;
3281  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__KnapsackSolver, 0 | 0 );
3282  if (!SWIG_IsOK(res1)) {
3283  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "KnapsackSolver_Init" "', argument " "1"" of type '" "operations_research::KnapsackSolver *""'");
3284  }
3285  arg1 = reinterpret_cast< operations_research::KnapsackSolver * >(argp1);
3286  {
3287  if (!vector_input_helper(swig_obj[1], &temp2, PyObjAs<int64_t>)) {
3288  if (!PyErr_Occurred())
3289  SWIG_Error(SWIG_TypeError, "sequence(int64_t) expected");
3290  return NULL;
3291  }
3292  arg2 = &temp2;
3293  }
3294  {
3295  if (!PyList_Check(swig_obj[2])) {
3296  PyErr_SetString(PyExc_TypeError, "Expecting a list of tuples");
3297  SWIG_fail;
3298  }
3299  int len = PyList_Size(swig_obj[2]);
3300  int arity = -1;
3301  if (len > 0) {
3302  temp3.resize(len);
3303  for (size_t i = 0; i < len; ++i) {
3304  PyObject *tuple = PyList_GetItem(swig_obj[2], i);
3305  if (!PyTuple_Check(tuple) && !PyList_Check(tuple)) {
3306  PyErr_SetString(PyExc_TypeError, "Expecting a sequence");
3307  SWIG_fail;
3308  }
3309  bool is_tuple = PyTuple_Check(tuple);
3310  int arity = is_tuple ? PyTuple_Size(tuple) : PyList_Size(tuple);
3311  temp3[i].resize(arity);
3312  for (size_t j = 0; j < arity; ++j) {
3313  bool success = PyObjAs<int64_t>(
3314  is_tuple ? PyTuple_GetItem(tuple, j) : PyList_GetItem(tuple, j),
3315  &temp3[i][j]);
3316  if (!success) {
3317  SWIG_fail;
3318  }
3319  }
3320  }
3321  }
3322  arg3 = &temp3;
3323  }
3324  {
3325  if (!vector_input_helper(swig_obj[3], &temp4, PyObjAs<int64_t>)) {
3326  if (!PyErr_Occurred())
3327  SWIG_Error(SWIG_TypeError, "sequence(int64_t) expected");
3328  return NULL;
3329  }
3330  arg4 = &temp4;
3331  }
3332  (arg1)->Init((std::vector< int64_t > const &)*arg2,(std::vector< std::vector< int64_t > > const &)*arg3,(std::vector< int64_t > const &)*arg4);
3333  resultobj = SWIG_Py_Void();
3334  return resultobj;
3335 fail:
3336  return NULL;
3337 }
3338 
3339 
3340 SWIGINTERN PyObject *_wrap_KnapsackSolver_Solve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3341  PyObject *resultobj = 0;
3343  void *argp1 = 0 ;
3344  int res1 = 0 ;
3345  PyObject *swig_obj[1] ;
3346  int64_t result;
3347 
3348  if (!args) SWIG_fail;
3349  swig_obj[0] = args;
3350  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__KnapsackSolver, 0 | 0 );
3351  if (!SWIG_IsOK(res1)) {
3352  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "KnapsackSolver_Solve" "', argument " "1"" of type '" "operations_research::KnapsackSolver *""'");
3353  }
3354  arg1 = reinterpret_cast< operations_research::KnapsackSolver * >(argp1);
3355  result = (int64_t)(arg1)->Solve();
3356  resultobj = SWIG_From_long(static_cast< long >(result));
3357  return resultobj;
3358 fail:
3359  return NULL;
3360 }
3361 
3362 
3363 SWIGINTERN PyObject *_wrap_KnapsackSolver_BestSolutionContains(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3364  PyObject *resultobj = 0;
3366  int arg2 ;
3367  void *argp1 = 0 ;
3368  int res1 = 0 ;
3369  int val2 ;
3370  int ecode2 = 0 ;
3371  PyObject *swig_obj[2] ;
3372  bool result;
3373 
3374  if (!SWIG_Python_UnpackTuple(args, "KnapsackSolver_BestSolutionContains", 2, 2, swig_obj)) SWIG_fail;
3375  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__KnapsackSolver, 0 | 0 );
3376  if (!SWIG_IsOK(res1)) {
3377  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "KnapsackSolver_BestSolutionContains" "', argument " "1"" of type '" "operations_research::KnapsackSolver const *""'");
3378  }
3379  arg1 = reinterpret_cast< operations_research::KnapsackSolver * >(argp1);
3380  ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
3381  if (!SWIG_IsOK(ecode2)) {
3382  SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "KnapsackSolver_BestSolutionContains" "', argument " "2"" of type '" "int""'");
3383  }
3384  arg2 = static_cast< int >(val2);
3385  result = (bool)((operations_research::KnapsackSolver const *)arg1)->BestSolutionContains(arg2);
3386  resultobj = SWIG_From_bool(static_cast< bool >(result));
3387  return resultobj;
3388 fail:
3389  return NULL;
3390 }
3391 
3392 
3393 SWIGINTERN PyObject *_wrap_KnapsackSolver_set_use_reduction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3394  PyObject *resultobj = 0;
3396  bool arg2 ;
3397  void *argp1 = 0 ;
3398  int res1 = 0 ;
3399  bool val2 ;
3400  int ecode2 = 0 ;
3401  PyObject *swig_obj[2] ;
3402 
3403  if (!SWIG_Python_UnpackTuple(args, "KnapsackSolver_set_use_reduction", 2, 2, swig_obj)) SWIG_fail;
3404  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__KnapsackSolver, 0 | 0 );
3405  if (!SWIG_IsOK(res1)) {
3406  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "KnapsackSolver_set_use_reduction" "', argument " "1"" of type '" "operations_research::KnapsackSolver *""'");
3407  }
3408  arg1 = reinterpret_cast< operations_research::KnapsackSolver * >(argp1);
3409  ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2);
3410  if (!SWIG_IsOK(ecode2)) {
3411  SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "KnapsackSolver_set_use_reduction" "', argument " "2"" of type '" "bool""'");
3412  }
3413  arg2 = static_cast< bool >(val2);
3414  (arg1)->set_use_reduction(arg2);
3415  resultobj = SWIG_Py_Void();
3416  return resultobj;
3417 fail:
3418  return NULL;
3419 }
3420 
3421 
3422 SWIGINTERN PyObject *_wrap_KnapsackSolver_set_time_limit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3423  PyObject *resultobj = 0;
3425  double arg2 ;
3426  void *argp1 = 0 ;
3427  int res1 = 0 ;
3428  double val2 ;
3429  int ecode2 = 0 ;
3430  PyObject *swig_obj[2] ;
3431 
3432  if (!SWIG_Python_UnpackTuple(args, "KnapsackSolver_set_time_limit", 2, 2, swig_obj)) SWIG_fail;
3433  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__KnapsackSolver, 0 | 0 );
3434  if (!SWIG_IsOK(res1)) {
3435  SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "KnapsackSolver_set_time_limit" "', argument " "1"" of type '" "operations_research::KnapsackSolver *""'");
3436  }
3437  arg1 = reinterpret_cast< operations_research::KnapsackSolver * >(argp1);
3438  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
3439  if (!SWIG_IsOK(ecode2)) {
3440  SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "KnapsackSolver_set_time_limit" "', argument " "2"" of type '" "double""'");
3441  }
3442  arg2 = static_cast< double >(val2);
3443  (arg1)->set_time_limit(arg2);
3444  resultobj = SWIG_Py_Void();
3445  return resultobj;
3446 fail:
3447  return NULL;
3448 }
3449 
3450 
3451 SWIGINTERN PyObject *KnapsackSolver_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3452  PyObject *obj;
3453  if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
3455  return SWIG_Py_Void();
3456 }
3457 
3458 SWIGINTERN PyObject *KnapsackSolver_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3459  return SWIG_Python_InitShadowInstance(args);
3460 }
3461 
3462 static PyMethodDef SwigMethods[] = {
3463  { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
3464  { "new_KnapsackSolver", _wrap_new_KnapsackSolver, METH_VARARGS, NULL},
3465  { "delete_KnapsackSolver", _wrap_delete_KnapsackSolver, METH_O, NULL},
3466  { "KnapsackSolver_Init", _wrap_KnapsackSolver_Init, METH_VARARGS, "Initializes the solver and enters the problem to be solved."},
3467  { "KnapsackSolver_Solve", _wrap_KnapsackSolver_Solve, METH_O, "Solves the problem and returns the profit of the optimal solution."},
3468  { "KnapsackSolver_BestSolutionContains", _wrap_KnapsackSolver_BestSolutionContains, METH_VARARGS, "Returns true if the item 'item_id' is packed in the optimal knapsack."},
3469  { "KnapsackSolver_set_use_reduction", _wrap_KnapsackSolver_set_use_reduction, METH_VARARGS, NULL},
3470  { "KnapsackSolver_set_time_limit", _wrap_KnapsackSolver_set_time_limit, METH_VARARGS, "\n"
3471  " Time limit in seconds.\n"
3472  "\n"
3473  "When a finite time limit is set the solution obtained might not be optimal\n"
3474  "if the limit is reached.\n"
3475  ""},
3476  { "KnapsackSolver_swigregister", KnapsackSolver_swigregister, METH_O, NULL},
3477  { "KnapsackSolver_swiginit", KnapsackSolver_swiginit, METH_VARARGS, NULL},
3478  { NULL, NULL, 0, NULL }
3479 };
3480 
3481 static PyMethodDef SwigMethods_proxydocs[] = {
3482  { NULL, NULL, 0, NULL }
3483 };
3484 
3485 
3486 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3487 
3488 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3489 static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0};
3490 static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (void*)0, 0};
3491 static swig_type_info _swigt__p_operations_research__KnapsackSolver = {"_p_operations_research__KnapsackSolver", "operations_research::KnapsackSolver *", 0, 0, (void*)0, 0};
3492 static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
3493 static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
3494 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
3495 static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0};
3496 static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|uint_fast16_t *|uintmax_t *", 0, 0, (void*)0, 0};
3497 static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
3498 
3500  &_swigt__p_char,
3501  &_swigt__p_int,
3502  &_swigt__p_long,
3504  &_swigt__p_short,
3510 };
3511 
3512 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3513 static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
3514 static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
3516 static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
3517 static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
3518 static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
3519 static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
3520 static swig_cast_info _swigc__p_unsigned_long[] = { {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
3522 
3525  _swigc__p_int,
3534 };
3535 
3536 
3537 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3538 
3540 {0, 0, 0, 0.0, 0, 0}};
3541 
3542 #ifdef __cplusplus
3543 }
3544 #endif
3545 /* -----------------------------------------------------------------------------
3546  * Type initialization:
3547  * This problem is tough by the requirement that no dynamic
3548  * memory is used. Also, since swig_type_info structures store pointers to
3549  * swig_cast_info structures and swig_cast_info structures store pointers back
3550  * to swig_type_info structures, we need some lookup code at initialization.
3551  * The idea is that swig generates all the structures that are needed.
3552  * The runtime then collects these partially filled structures.
3553  * The SWIG_InitializeModule function takes these initial arrays out of
3554  * swig_module, and does all the lookup, filling in the swig_module.types
3555  * array with the correct data and linking the correct swig_cast_info
3556  * structures together.
3557  *
3558  * The generated swig_type_info structures are assigned statically to an initial
3559  * array. We just loop through that array, and handle each type individually.
3560  * First we lookup if this type has been already loaded, and if so, use the
3561  * loaded structure instead of the generated one. Then we have to fill in the
3562  * cast linked list. The cast data is initially stored in something like a
3563  * two-dimensional array. Each row corresponds to a type (there are the same
3564  * number of rows as there are in the swig_type_initial array). Each entry in
3565  * a column is one of the swig_cast_info structures for that type.
3566  * The cast_initial array is actually an array of arrays, because each row has
3567  * a variable number of columns. So to actually build the cast linked list,
3568  * we find the array of casts associated with the type, and loop through it
3569  * adding the casts to the list. The one last trick we need to do is making
3570  * sure the type pointer in the swig_cast_info struct is correct.
3571  *
3572  * First off, we lookup the cast->type name to see if it is already loaded.
3573  * There are three cases to handle:
3574  * 1) If the cast->type has already been loaded AND the type we are adding
3575  * casting info to has not been loaded (it is in this module), THEN we
3576  * replace the cast->type pointer with the type pointer that has already
3577  * been loaded.
3578  * 2) If BOTH types (the one we are adding casting info to, and the
3579  * cast->type) are loaded, THEN the cast info has already been loaded by
3580  * the previous module so we just ignore it.
3581  * 3) Finally, if cast->type has not already been loaded, then we add that
3582  * swig_cast_info to the linked list (because the cast->type) pointer will
3583  * be correct.
3584  * ----------------------------------------------------------------------------- */
3585 
3586 #ifdef __cplusplus
3587 extern "C" {
3588 #if 0
3589 } /* c-mode */
3590 #endif
3591 #endif
3592 
3593 #if 0
3594 #define SWIGRUNTIME_DEBUG
3595 #endif
3596 
3597 
3598 SWIGRUNTIME void
3599 SWIG_InitializeModule(void *clientdata) {
3600  size_t i;
3601  swig_module_info *module_head, *iter;
3602  int init;
3603 
3604  /* check to see if the circular list has been setup, if not, set it up */
3605  if (swig_module.next==0) {
3606  /* Initialize the swig_module */
3610  init = 1;
3611  } else {
3612  init = 0;
3613  }
3614 
3615  /* Try and load any already created modules */
3616  module_head = SWIG_GetModule(clientdata);
3617  if (!module_head) {
3618  /* This is the first module loaded for this interpreter */
3619  /* so set the swig module into the interpreter */
3620  SWIG_SetModule(clientdata, &swig_module);
3621  } else {
3622  /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3623  iter=module_head;
3624  do {
3625  if (iter==&swig_module) {
3626  /* Our module is already in the list, so there's nothing more to do. */
3627  return;
3628  }
3629  iter=iter->next;
3630  } while (iter!= module_head);
3631 
3632  /* otherwise we must add our module into the list */
3633  swig_module.next = module_head->next;
3634  module_head->next = &swig_module;
3635  }
3636 
3637  /* When multiple interpreters are used, a module could have already been initialized in
3638  a different interpreter, but not yet have a pointer in this interpreter.
3639  In this case, we do not want to continue adding types... everything should be
3640  set up already */
3641  if (init == 0) return;
3642 
3643  /* Now work on filling in swig_module.types */
3644 #ifdef SWIGRUNTIME_DEBUG
3645  printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
3646 #endif
3647  for (i = 0; i < swig_module.size; ++i) {
3648  swig_type_info *type = 0;
3649  swig_type_info *ret;
3650  swig_cast_info *cast;
3651 
3652 #ifdef SWIGRUNTIME_DEBUG
3653  printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3654 #endif
3655 
3656  /* if there is another module already loaded */
3657  if (swig_module.next != &swig_module) {
3659  }
3660  if (type) {
3661  /* Overwrite clientdata field */
3662 #ifdef SWIGRUNTIME_DEBUG
3663  printf("SWIG_InitializeModule: found type %s\n", type->name);
3664 #endif
3667 #ifdef SWIGRUNTIME_DEBUG
3668  printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3669 #endif
3670  }
3671  } else {
3672  type = swig_module.type_initial[i];
3673  }
3674 
3675  /* Insert casting types */
3676  cast = swig_module.cast_initial[i];
3677  while (cast->type) {
3678  /* Don't need to add information already in the list */
3679  ret = 0;
3680 #ifdef SWIGRUNTIME_DEBUG
3681  printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3682 #endif
3683  if (swig_module.next != &swig_module) {
3685 #ifdef SWIGRUNTIME_DEBUG
3686  if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3687 #endif
3688  }
3689  if (ret) {
3690  if (type == swig_module.type_initial[i]) {
3691 #ifdef SWIGRUNTIME_DEBUG
3692  printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3693 #endif
3694  cast->type = ret;
3695  ret = 0;
3696  } else {
3697  /* Check for casting already in the list */
3698  swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3699 #ifdef SWIGRUNTIME_DEBUG
3700  if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3701 #endif
3702  if (!ocast) ret = 0;
3703  }
3704  }
3705 
3706  if (!ret) {
3707 #ifdef SWIGRUNTIME_DEBUG
3708  printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3709 #endif
3710  if (type->cast) {
3711  type->cast->prev = cast;
3712  cast->next = type->cast;
3713  }
3714  type->cast = cast;
3715  }
3716  cast++;
3717  }
3718  /* Set entry in modules->types array equal to the type */
3719  swig_module.types[i] = type;
3720  }
3721  swig_module.types[i] = 0;
3722 
3723 #ifdef SWIGRUNTIME_DEBUG
3724  printf("**** SWIG_InitializeModule: Cast List ******\n");
3725  for (i = 0; i < swig_module.size; ++i) {
3726  int j = 0;
3728  printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3729  while (cast->type) {
3730  printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3731  cast++;
3732  ++j;
3733  }
3734  printf("---- Total casts: %d\n",j);
3735  }
3736  printf("**** SWIG_InitializeModule: Cast List ******\n");
3737 #endif
3738 }
3739 
3740 /* This function will propagate the clientdata field of type to
3741 * any new swig_type_info structures that have been added into the list
3742 * of equivalent types. It is like calling
3743 * SWIG_TypeClientData(type, clientdata) a second time.
3744 */
3745 SWIGRUNTIME void
3747  size_t i;
3748  swig_cast_info *equiv;
3749  static int init_run = 0;
3750 
3751  if (init_run) return;
3752  init_run = 1;
3753 
3754  for (i = 0; i < swig_module.size; i++) {
3755  if (swig_module.types[i]->clientdata) {
3756  equiv = swig_module.types[i]->cast;
3757  while (equiv) {
3758  if (!equiv->converter) {
3759  if (equiv->type && !equiv->type->clientdata)
3761  }
3762  equiv = equiv->next;
3763  }
3764  }
3765  }
3766 }
3767 
3768 #ifdef __cplusplus
3769 #if 0
3770 {
3771  /* c-mode */
3772 #endif
3773 }
3774 #endif
3775 
3776 
3777 
3778 #ifdef __cplusplus
3779 extern "C" {
3780 #endif
3781 
3782  /* Python-specific SWIG API */
3783 #define SWIG_newvarlink() SWIG_Python_newvarlink()
3784 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
3785 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
3786 
3787  /* -----------------------------------------------------------------------------
3788  * global variable support code.
3789  * ----------------------------------------------------------------------------- */
3790 
3791  typedef struct swig_globalvar {
3792  char *name; /* Name of global variable */
3793  PyObject *(*get_attr)(void); /* Return the current value */
3794  int (*set_attr)(PyObject *); /* Set the value */
3796  } swig_globalvar;
3797 
3798  typedef struct swig_varlinkobject {
3799  PyObject_HEAD
3802 
3803  SWIGINTERN PyObject *
3805 #if PY_VERSION_HEX >= 0x03000000
3806  return PyUnicode_InternFromString("<Swig global variables>");
3807 #else
3808  return PyString_FromString("<Swig global variables>");
3809 #endif
3810  }
3811 
3812  SWIGINTERN PyObject *
3814 #if PY_VERSION_HEX >= 0x03000000
3815  PyObject *str = PyUnicode_InternFromString("(");
3816  PyObject *tail;
3817  PyObject *joined;
3819  for (var = v->vars; var; var=var->next) {
3820  tail = PyUnicode_FromString(var->name);
3821  joined = PyUnicode_Concat(str, tail);
3822  Py_DecRef(str);
3823  Py_DecRef(tail);
3824  str = joined;
3825  if (var->next) {
3826  tail = PyUnicode_InternFromString(", ");
3827  joined = PyUnicode_Concat(str, tail);
3828  Py_DecRef(str);
3829  Py_DecRef(tail);
3830  str = joined;
3831  }
3832  }
3833  tail = PyUnicode_InternFromString(")");
3834  joined = PyUnicode_Concat(str, tail);
3835  Py_DecRef(str);
3836  Py_DecRef(tail);
3837  str = joined;
3838 #else
3839  PyObject *str = PyString_FromString("(");
3841  for (var = v->vars; var; var=var->next) {
3842  PyString_ConcatAndDel(&str,PyString_FromString(var->name));
3843  if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
3844  }
3845  PyString_ConcatAndDel(&str,PyString_FromString(")"));
3846 #endif
3847  return str;
3848  }
3849 
3850  SWIGINTERN void
3852  swig_globalvar *var = v->vars;
3853  while (var) {
3854  swig_globalvar *n = var->next;
3855  free(var->name);
3856  free(var);
3857  var = n;
3858  }
3859  }
3860 
3861  SWIGINTERN PyObject *
3863  PyObject *res = NULL;
3864  swig_globalvar *var = v->vars;
3865  while (var) {
3866  if (strcmp(var->name,n) == 0) {
3867  res = (*var->get_attr)();
3868  break;
3869  }
3870  var = var->next;
3871  }
3872  if (res == NULL && !PyErr_Occurred()) {
3873  PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
3874  }
3875  return res;
3876  }
3877 
3878  SWIGINTERN int
3879  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
3880  int res = 1;
3881  swig_globalvar *var = v->vars;
3882  while (var) {
3883  if (strcmp(var->name,n) == 0) {
3884  res = (*var->set_attr)(p);
3885  break;
3886  }
3887  var = var->next;
3888  }
3889  if (res == 1 && !PyErr_Occurred()) {
3890  PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
3891  }
3892  return res;
3893  }
3894 
3895  SWIGINTERN PyTypeObject*
3897  static char varlink__doc__[] = "Swig var link object";
3898  static PyTypeObject varlink_type;
3899  static int type_init = 0;
3900  if (!type_init) {
3901  const PyTypeObject tmp = {
3902 #if PY_VERSION_HEX >= 0x03000000
3903  PyVarObject_HEAD_INIT(NULL, 0)
3904 #else
3905  PyObject_HEAD_INIT(NULL)
3906  0, /* ob_size */
3907 #endif
3908  "swigvarlink", /* tp_name */
3909  sizeof(swig_varlinkobject), /* tp_basicsize */
3910  0, /* tp_itemsize */
3911  (destructor) swig_varlink_dealloc, /* tp_dealloc */
3912  0, /* tp_print */
3913  (getattrfunc) swig_varlink_getattr, /* tp_getattr */
3914  (setattrfunc) swig_varlink_setattr, /* tp_setattr */
3915  0, /* tp_compare */
3916  (reprfunc) swig_varlink_repr, /* tp_repr */
3917  0, /* tp_as_number */
3918  0, /* tp_as_sequence */
3919  0, /* tp_as_mapping */
3920  0, /* tp_hash */
3921  0, /* tp_call */
3922  (reprfunc) swig_varlink_str, /* tp_str */
3923  0, /* tp_getattro */
3924  0, /* tp_setattro */
3925  0, /* tp_as_buffer */
3926  0, /* tp_flags */
3927  varlink__doc__, /* tp_doc */
3928  0, /* tp_traverse */
3929  0, /* tp_clear */
3930  0, /* tp_richcompare */
3931  0, /* tp_weaklistoffset */
3932  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
3933  0, /* tp_del */
3934  0, /* tp_version_tag */
3935 #if PY_VERSION_HEX >= 0x03040000
3936  0, /* tp_finalize */
3937 #endif
3938 #ifdef COUNT_ALLOCS
3939  0, /* tp_allocs */
3940  0, /* tp_frees */
3941  0, /* tp_maxalloc */
3942  0, /* tp_prev */
3943  0 /* tp_next */
3944 #endif
3945  };
3946  varlink_type = tmp;
3947  type_init = 1;
3948  if (PyType_Ready(&varlink_type) < 0)
3949  return NULL;
3950  }
3951  return &varlink_type;
3952  }
3953 
3954  /* Create a variable linking object for use later */
3955  SWIGINTERN PyObject *
3957  swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
3958  if (result) {
3959  result->vars = 0;
3960  }
3961  return ((PyObject*) result);
3962  }
3963 
3964  SWIGINTERN void
3965  SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
3968  if (gv) {
3969  size_t size = strlen(name)+1;
3970  gv->name = (char *)malloc(size);
3971  if (gv->name) {
3972  memcpy(gv->name, name, size);
3973  gv->get_attr = get_attr;
3974  gv->set_attr = set_attr;
3975  gv->next = v->vars;
3976  }
3977  }
3978  v->vars = gv;
3979  }
3980 
3981  SWIGINTERN PyObject *
3983  static PyObject *globals = 0;
3984  if (!globals) {
3985  globals = SWIG_newvarlink();
3986  }
3987  return globals;
3988  }
3989 
3990  /* -----------------------------------------------------------------------------
3991  * constants/methods manipulation
3992  * ----------------------------------------------------------------------------- */
3993 
3994  /* Install Constants */
3995  SWIGINTERN void
3996  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
3997  PyObject *obj = 0;
3998  size_t i;
3999  for (i = 0; constants[i].type; ++i) {
4000  switch(constants[i].type) {
4001  case SWIG_PY_POINTER:
4002  obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
4003  break;
4004  case SWIG_PY_BINARY:
4005  obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
4006  break;
4007  default:
4008  obj = 0;
4009  break;
4010  }
4011  if (obj) {
4012  PyDict_SetItemString(d, constants[i].name, obj);
4013  Py_DECREF(obj);
4014  }
4015  }
4016  }
4017 
4018  /* -----------------------------------------------------------------------------*/
4019  /* Fix SwigMethods to carry the callback ptrs when needed */
4020  /* -----------------------------------------------------------------------------*/
4021 
4022  SWIGINTERN void
4023  SWIG_Python_FixMethods(PyMethodDef *methods,
4024  swig_const_info *const_table,
4025  swig_type_info **types,
4026  swig_type_info **types_initial) {
4027  size_t i;
4028  for (i = 0; methods[i].ml_name; ++i) {
4029  const char *c = methods[i].ml_doc;
4030  if (!c) continue;
4031  c = strstr(c, "swig_ptr: ");
4032  if (c) {
4033  int j;
4034  swig_const_info *ci = 0;
4035  const char *name = c + 10;
4036  for (j = 0; const_table[j].type; ++j) {
4037  if (strncmp(const_table[j].name, name,
4038  strlen(const_table[j].name)) == 0) {
4039  ci = &(const_table[j]);
4040  break;
4041  }
4042  }
4043  if (ci) {
4044  void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
4045  if (ptr) {
4046  size_t shift = (ci->ptype) - types;
4047  swig_type_info *ty = types_initial[shift];
4048  size_t ldoc = (c - methods[i].ml_doc);
4049  size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
4050  char *ndoc = (char*)malloc(ldoc + lptr + 10);
4051  if (ndoc) {
4052  char *buff = ndoc;
4053  memcpy(buff, methods[i].ml_doc, ldoc);
4054  buff += ldoc;
4055  memcpy(buff, "swig_ptr: ", 10);
4056  buff += 10;
4057  SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
4058  methods[i].ml_doc = ndoc;
4059  }
4060  }
4061  }
4062  }
4063  }
4064  }
4065 
4066  /* -----------------------------------------------------------------------------
4067  * Method creation and docstring support functions
4068  * ----------------------------------------------------------------------------- */
4069 
4070  /* -----------------------------------------------------------------------------
4071  * Function to find the method definition with the correct docstring for the
4072  * proxy module as opposed to the low-level API
4073  * ----------------------------------------------------------------------------- */
4074 
4075  SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
4076  /* Find the function in the modified method table */
4077  size_t offset = 0;
4078  int found = 0;
4079  while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
4080  if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
4081  found = 1;
4082  break;
4083  }
4084  offset++;
4085  }
4086  /* Use the copy with the modified docstring if available */
4087  return found ? &SwigMethods_proxydocs[offset] : NULL;
4088  }
4089 
4090  /* -----------------------------------------------------------------------------
4091  * Wrapper of PyInstanceMethod_New() used in Python 3
4092  * It is exported to the generated module, used for -fastproxy
4093  * ----------------------------------------------------------------------------- */
4094 
4095  SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
4096  if (PyCFunction_Check(func)) {
4097  PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
4098  PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
4099  if (ml)
4100  func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
4101  }
4102 #if PY_VERSION_HEX >= 0x03000000
4103  return PyInstanceMethod_New(func);
4104 #else
4105  return PyMethod_New(func, NULL, NULL);
4106 #endif
4107  }
4108 
4109  /* -----------------------------------------------------------------------------
4110  * Wrapper of PyStaticMethod_New()
4111  * It is exported to the generated module, used for -fastproxy
4112  * ----------------------------------------------------------------------------- */
4113 
4114  SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
4115  if (PyCFunction_Check(func)) {
4116  PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
4117  PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
4118  if (ml)
4119  func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
4120  }
4121  return PyStaticMethod_New(func);
4122  }
4123 
4124 #ifdef __cplusplus
4125 }
4126 #endif
4127 
4128 /* -----------------------------------------------------------------------------*
4129  * Partial Init method
4130  * -----------------------------------------------------------------------------*/
4131 
4132 #ifdef __cplusplus
4133 extern "C"
4134 #endif
4135 
4136 SWIGEXPORT
4137 #if PY_VERSION_HEX >= 0x03000000
4138 PyObject*
4139 #else
4140 void
4141 #endif
4142 SWIG_init(void) {
4143  PyObject *m, *d, *md, *globals;
4144 
4145 #if PY_VERSION_HEX >= 0x03000000
4146  static struct PyModuleDef SWIG_module = {
4147  PyModuleDef_HEAD_INIT,
4148  SWIG_name,
4149  NULL,
4150  -1,
4151  SwigMethods,
4152  NULL,
4153  NULL,
4154  NULL,
4155  NULL
4156  };
4157 #endif
4158 
4159 #if defined(SWIGPYTHON_BUILTIN)
4160  static SwigPyClientData SwigPyObject_clientdata = {
4161  0, 0, 0, 0, 0, 0, 0
4162  };
4163  static PyGetSetDef this_getset_def = {
4164  (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
4165  };
4166  static SwigPyGetSet thisown_getset_closure = {
4169  };
4170  static PyGetSetDef thisown_getset_def = {
4171  (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
4172  };
4173  PyTypeObject *builtin_pytype;
4174  int builtin_base_count;
4175  swig_type_info *builtin_basetype;
4176  PyObject *tuple;
4177  PyGetSetDescrObject *static_getset;
4178  PyTypeObject *metatype;
4179  PyTypeObject *swigpyobject;
4180  SwigPyClientData *cd;
4181  PyObject *public_interface, *public_symbol;
4182  PyObject *this_descr;
4183  PyObject *thisown_descr;
4184  PyObject *self = 0;
4185  int i;
4186 
4187  (void)builtin_pytype;
4188  (void)builtin_base_count;
4189  (void)builtin_basetype;
4190  (void)tuple;
4191  (void)static_getset;
4192  (void)self;
4193 
4194  /* Metaclass is used to implement static member variables */
4195  metatype = SwigPyObjectType();
4196  assert(metatype);
4197 #endif
4198 
4199  (void)globals;
4200 
4201  /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
4202  SWIG_This();
4205 #ifndef SWIGPYTHON_BUILTIN
4207 #endif
4208 
4209  /* Fix SwigMethods to carry the callback ptrs when needed */
4211 
4212 #if PY_VERSION_HEX >= 0x03000000
4213  m = PyModule_Create(&SWIG_module);
4214 #else
4215  m = Py_InitModule(SWIG_name, SwigMethods);
4216 #endif
4217 
4218  md = d = PyModule_GetDict(m);
4219  (void)md;
4220 
4222 
4223 #ifdef SWIGPYTHON_BUILTIN
4224  swigpyobject = SwigPyObject_TypeOnce();
4225 
4226  SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
4227  assert(SwigPyObject_stype);
4228  cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
4229  if (!cd) {
4230  SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
4231  SwigPyObject_clientdata.pytype = swigpyobject;
4232  } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
4233  PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
4234 # if PY_VERSION_HEX >= 0x03000000
4235  return NULL;
4236 # else
4237  return;
4238 # endif
4239  }
4240 
4241  /* All objects have a 'this' attribute */
4242  this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
4243  (void)this_descr;
4244 
4245  /* All objects have a 'thisown' attribute */
4246  thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
4247  (void)thisown_descr;
4248 
4249  public_interface = PyList_New(0);
4250  public_symbol = 0;
4251  (void)public_symbol;
4252 
4253  PyDict_SetItemString(md, "__all__", public_interface);
4254  Py_DECREF(public_interface);
4255  for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
4256  SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
4257  for (i = 0; swig_const_table[i].name != 0; ++i)
4258  SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
4259 #endif
4260 
4262 
4263  SWIG_Python_SetConstant(d, "KnapsackSolver_KNAPSACK_BRUTE_FORCE_SOLVER",SWIG_From_int(static_cast< int >(operations_research::KnapsackSolver::KNAPSACK_BRUTE_FORCE_SOLVER)));
4264  SWIG_Python_SetConstant(d, "KnapsackSolver_KNAPSACK_64ITEMS_SOLVER",SWIG_From_int(static_cast< int >(operations_research::KnapsackSolver::KNAPSACK_64ITEMS_SOLVER)));
4265  SWIG_Python_SetConstant(d, "KnapsackSolver_KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER",SWIG_From_int(static_cast< int >(operations_research::KnapsackSolver::KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER)));
4266  SWIG_Python_SetConstant(d, "KnapsackSolver_KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER",SWIG_From_int(static_cast< int >(operations_research::KnapsackSolver::KNAPSACK_MULTIDIMENSION_CBC_MIP_SOLVER)));
4267  SWIG_Python_SetConstant(d, "KnapsackSolver_KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER",SWIG_From_int(static_cast< int >(operations_research::KnapsackSolver::KNAPSACK_MULTIDIMENSION_BRANCH_AND_BOUND_SOLVER)));
4268  SWIG_Python_SetConstant(d, "KnapsackSolver_KNAPSACK_MULTIDIMENSION_SCIP_MIP_SOLVER",SWIG_From_int(static_cast< int >(operations_research::KnapsackSolver::KNAPSACK_MULTIDIMENSION_SCIP_MIP_SOLVER)));
4269 #if PY_VERSION_HEX >= 0x03000000
4270  return m;
4271 #else
4272  return;
4273 #endif
4274 }
4275 
#define SWIG_Python_str_FromFormat
struct swig_const_info swig_const_info
SWIGRUNTIME PyObject * SwigPyObject_append(PyObject *v, PyObject *next)
static swig_type_info _swigt__p_unsigned_long
static swig_cast_info _swigc__p_char[]
struct swig_cast_info * cast
SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj)
static swig_type_info _swigt__p_unsigned_char
SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
#define SWIGINTERN
SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
static swig_type_info _swigt__p_unsigned_short
struct swig_cast_info * next
SWIGINTERN PyObject * _wrap_delete_KnapsackSolver(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_POINTER_DISOWN
static swig_type_info _swigt__p_char
int64_t min
Definition: alldiff_cst.cc:139
struct swig_globalvar swig_globalvar
#define SWIGPY_CAPSULE_NAME
SWIGRUNTIME PyTypeObject * SwigPyObject_TypeOnce(void)
SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v)
SWIGINTERN PyMethodDef * SWIG_PythonGetProxyDoc(const char *name)
SWIGINTERN int SWIG_AsVal_long(PyObject *obj, long *val)
SolverType
Enum controlling which underlying algorithm is used.
SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n)
#define SWIG_TypeQuery(name)
SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata)
#define SWIG_newvarlink()
struct swig_type_info swig_type_info
static swig_type_info * swig_type_initial[]
#define SWIG_AttributeError
SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty)
#define SWIG_as_voidptr(a)
#define SWIG_PYTHON_THREAD_BEGIN_BLOCK
#define SWIG_BUILTIN_TP_INIT
#define SWIG_ValueError
SWIGRUNTIME void SWIG_Python_DestroyModule(PyObject *obj)
SWIGINTERN PyObject * SwigPyObject_acquire(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
static swig_type_info _swigt__p_long
SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v))
const std::string name
#define SWIG_exception_fail(code, msg)
SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name)
SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj)
SwigPtr_PyObject & operator=(const SwigPtr_PyObject &item)
SWIGINTERN PyObject * KnapsackSolver_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[])
SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz)
#define SWIG_DivisionByZero
SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v)
SWIGINTERN PyObject * _wrap_new_KnapsackSolver__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj)
SWIGINTERN PyObject * _wrap_KnapsackSolver_Solve(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c)
SWIGINTERN PyObject * SWIG_Python_AppendOutput(PyObject *result, PyObject *obj)
SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char *mesg)
SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr)
struct swig_module_info swig_module_info
SWIGRUNTIME void SWIG_Python_RaiseOrModifyTypeError(const char *message)
#define SWIG_POINTER_NOSHADOW
#define SWIG_GetModule(clientdata)
SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type)
SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz)
#define SWIGRUNTIMEINLINE
This library solves knapsack problems.
#define SWIG_AddCast(r)
#define SWIGINTERNINLINE
static swig_cast_info _swigc__p_operations_research__KnapsackSolver[]
#define SWIG_POINTER_NEW
SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty)
int64_t tail
Dynamic Programming approach for single dimension problems.
#define SWIG_Python_CallFunctor(functor, obj)
PyObject_HEAD void * pack
static swig_type_info * swig_types[11]
#define SWIG_OverflowError
PyObject *(* get_attr)(void)
static swig_cast_info _swigc__p_unsigned_char[]
SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
PyObject_HEAD swig_globalvar * vars
SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty)
SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory)
SWIGRUNTIME PyObject * SwigPyObject_format(const char *fmt, SwigPyObject *v)
static swig_cast_info _swigc__p_short[]
SWIGINTERN Py_ssize_t SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
SWIGINTERN int SWIG_AsVal_double(PyObject *obj, double *val)
SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op)
#define SWIG_SetModule(clientdata, pointer)
#define SWIG_BUFFER_SIZE
static swig_type_info _swigt__p_signed_char
#define SWIG_POINTER_OWN
#define SWIGUNUSEDPARM(p)
SWIGRUNTIME PyObject * SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags)
struct swig_globalvar * next
int64_t max
Definition: alldiff_cst.cc:140
Block * next
SWIGRUNTIME PyTypeObject * SwigPyPacked_TypeOnce(void)
SWIGRUNTIME int SWIG_Python_AddErrMesg(const char *mesg, int infront)
SWIGINTERN PyObject * KnapsackSolver_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_InternalNewPointerObj(ptr, type, flags)
#define SWIG_SyntaxError
#define SWIG_STATIC_POINTER(var)
SWIGINTERN int SWIG_AsVal_int(PyObject *obj, int *val)
SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void)
SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name)
struct swig_cast_info * prev
SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata)
SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj)
#define SWIG_NewClientData(obj)
SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial)
#define SWIG_POINTER_IMPLICIT_CONV
#define SWIG_IsNewObj(r)
SWIGRUNTIME PyObject * SwigPyObject_next(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
static PyObject * Swig_This_global
#define SWIG_MangledTypeQuery(name)
#define SWIG_InstallConstants(d, constants)
SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v)
SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
#define SWIG_PY_POINTER
SWIGINTERNINLINE PyObject * SWIG_From_bool(bool value)
SWIGINTERN PyObject * SWIG_globals(void)
SWIGINTERN PyObject * _wrap_new_KnapsackSolver__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj)
SWIGINTERN PyObject * SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc)
SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty)
SWIGRUNTIME int SWIG_Python_ArgFail(int argnum)
SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op)
SWIGINTERN PyObject * SWIG_Python_newvarlink(void)
SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v)
SWIGRUNTIME int SWIG_Python_TypeErrorOccurred(PyObject *obj)
#define SWIG_POINTER_NO_NULL
struct swig_cast_info swig_cast_info
SWIGINTERN int SWIG_AsVal_bool(PyObject *obj, bool *val)
SWIGINTERN PyObject * _wrap_KnapsackSolver_set_time_limit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME PyObject * SwigPyObject_repr(SwigPyObject *v)
#define Py_TYPE(op)
SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int(*set_attr)(PyObject *p))
SWIGINTERNINLINE PyObject * SWIG_From_int(int value)
SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
SWIGINTERN int SWIG_AsPtr_std_string(PyObject *obj, std::string **val)
static PyMethodDef SwigMethods[]
SWIGINTERN char * SWIG_Python_str_AsChar(PyObject *str)
SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata))
SWIGINTERN PyObject * SwigPyObject_own(PyObject *v, PyObject *args)
static swig_cast_info _swigc__p_unsigned_int[]
#define SWIG_Python_str_DelForPy3(x)
struct swig_module_info * next
SWIGINTERN swig_type_info * SWIG_pchar_descriptor(void)
#define SWIG_PY_BINARY
std::string message
Definition: trace.cc:398
static PyMethodDef SwigMethods_proxydocs[]
#define SWIG_NullReferenceError
static swig_cast_info _swigc__p_int[]
static PyMethodDef swigobject_methods[]
SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
static swig_type_info _swigt__p_short
#define PyObject_DEL
#define SWIG_SystemError
SWIGRUNTIME PyTypeObject * SwigPyObject_type(void)
SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own)
static swig_cast_info _swigc__p_long[]
SWIGINTERN PyObject * SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type)
SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v)
#define SWIG_ArgError(r)
#define SWIG_IndexError
SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
static swig_cast_info _swigc__p_unsigned_long[]
SWIGINTERN PyTypeObject * swig_varlink_type(void)
SwigVar_PyObject & operator=(PyObject *obj)
SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb)
SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v)
#define SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_MemoryError
SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self)
SWIGRUNTIME PyObject * SWIG_This(void)
SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void)
struct swig_type_info *(* swig_dycast_func)(void **)
PyObject_HEAD void * ptr
#define SWIGTYPE_p_operations_research__KnapsackSolver
SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module)
SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty)
SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args)
SWIGINTERN PyObject * _wrap_KnapsackSolver_Init(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2)
#define SWIG_NewPackedObj(ptr, sz, type)
void * malloc(YYSIZE_T)
SWIGRUNTIME void SWIG_PropagateClientData(void)
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)
#define SWIG_RuntimeError
static swig_cast_info * swig_cast_initial[]
SWIGINTERN PyObject * _wrap_KnapsackSolver_set_use_reduction(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_NEWOBJ
#define SWIGRUNTIME
SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz)
SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type)
static swig_type_info _swigt__p_operations_research__KnapsackSolver
SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags)
#define SWIG_Error(code, msg)
static swig_cast_info _swigc__p_signed_char[]
#define SWIG_CheckState(r)
SWIGINTERN PyObject * _wrap_KnapsackSolver_BestSolutionContains(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SwigPtr_PyObject(PyObject *obj, bool initial_ref=true)
#define SWIG_AddNewMask(r)
static swig_const_info swig_const_table[]
SWIGRUNTIME int SWIG_TypeCmp(const char *nb, const char *tb)
struct swig_varlinkobject swig_varlinkobject
#define SWIG_CAST_NEW_MEMORY
SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v)
#define SWIG_From_long
SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name)
SWIGRUNTIME PyTypeObject * SwigPyPacked_type(void)
IntVar * var
Definition: expr_array.cc:1874
SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v)
#define SWIG_TypeError
SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject *obj)
SWIGINTERN PyObject * SwigPyObject_disown(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
void free(void *)
swig_converter_func converter
SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own)
Optimized method for single dimension small problems.
void *(* swig_converter_func)(void *, int *)
SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc)
static swig_type_info _swigt__p_unsigned_int
#define SWIG_OLDOBJ
#define SWIG_PYTHON_THREAD_END_BLOCK
SWIGRUNTIME PyObject * SWIG_Python_ErrorType(int code)
#define SWIG_NewPointerObj(ptr, type, flags)
SWIGINTERN PyObject * _wrap_new_KnapsackSolver(PyObject *self, PyObject *args)
static swig_type_info _swigt__p_int
#define SWIG_RUNTIME_VERSION
static swig_cast_info _swigc__p_unsigned_short[]
SWIGRUNTIME PyObject * SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
if(!yyg->yy_init)
Definition: parser.yy.cc:965
int64_t value
SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
#define SWIGEXPORT
SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name)
SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
static swig_module_info swig_module
SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty)
#define SWIG_IsOK(r)
#define SWIG_IOError
#define SWIG_ERROR
#define SWIG_TYPE_TABLE_NAME
SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v)
SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj)
SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz)
SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg)
SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData *data)
SwigPtr_PyObject(const SwigPtr_PyObject &item)