OR-Tools  9.1
sat_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.2
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_DIRECTORS
17#define SWIG_PYTHON_THREADS
18#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
19
20
21#ifdef __cplusplus
22/* SwigValueWrapper is described in swig.swg */
23template<typename T> class SwigValueWrapper {
24 struct SwigMovePointer {
25 T *ptr;
26 SwigMovePointer(T *p) : ptr(p) { }
27 ~SwigMovePointer() { delete ptr; }
28 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
29 } pointer;
30 SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
31 SwigValueWrapper(const SwigValueWrapper<T>& rhs);
32public:
33 SwigValueWrapper() : pointer(0) { }
34 SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
35 operator T&() const { return *pointer.ptr; }
36 T *operator&() { return pointer.ptr; }
37};
38
39template <typename T> T SwigValueInit() {
40 return T();
41}
42#endif
43
44/* -----------------------------------------------------------------------------
45 * This section contains generic SWIG labels for method/variable
46 * declarations/attributes, and other compiler dependent labels.
47 * ----------------------------------------------------------------------------- */
48
49/* template workaround for compilers that cannot correctly implement the C++ standard */
50#ifndef SWIGTEMPLATEDISAMBIGUATOR
51# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
52# define SWIGTEMPLATEDISAMBIGUATOR template
53# elif defined(__HP_aCC)
54/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
55/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
56# define SWIGTEMPLATEDISAMBIGUATOR template
57# else
58# define SWIGTEMPLATEDISAMBIGUATOR
59# endif
60#endif
61
62/* inline attribute */
63#ifndef SWIGINLINE
64# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
65# define SWIGINLINE inline
66# else
67# define SWIGINLINE
68# endif
69#endif
70
71/* attribute recognised by some compilers to avoid 'unused' warnings */
72#ifndef SWIGUNUSED
73# if defined(__GNUC__)
74# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
75# define SWIGUNUSED __attribute__ ((__unused__))
76# else
77# define SWIGUNUSED
78# endif
79# elif defined(__ICC)
80# define SWIGUNUSED __attribute__ ((__unused__))
81# else
82# define SWIGUNUSED
83# endif
84#endif
85
86#ifndef SWIG_MSC_UNSUPPRESS_4505
87# if defined(_MSC_VER)
88# pragma warning(disable : 4505) /* unreferenced local function has been removed */
89# endif
90#endif
91
92#ifndef SWIGUNUSEDPARM
93# ifdef __cplusplus
94# define SWIGUNUSEDPARM(p)
95# else
96# define SWIGUNUSEDPARM(p) p SWIGUNUSED
97# endif
98#endif
99
100/* internal SWIG method */
101#ifndef SWIGINTERN
102# define SWIGINTERN static SWIGUNUSED
103#endif
104
105/* internal inline SWIG method */
106#ifndef SWIGINTERNINLINE
107# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
108#endif
109
110/* exporting methods */
111#if defined(__GNUC__)
112# if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
113# ifndef GCC_HASCLASSVISIBILITY
114# define GCC_HASCLASSVISIBILITY
115# endif
116# endif
117#endif
118
119#ifndef SWIGEXPORT
120# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
121# if defined(STATIC_LINKED)
122# define SWIGEXPORT
123# else
124# define SWIGEXPORT __declspec(dllexport)
125# endif
126# else
127# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
128# define SWIGEXPORT __attribute__ ((visibility("default")))
129# else
130# define SWIGEXPORT
131# endif
132# endif
133#endif
134
135/* calling conventions for Windows */
136#ifndef SWIGSTDCALL
137# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
138# define SWIGSTDCALL __stdcall
139# else
140# define SWIGSTDCALL
141# endif
142#endif
143
144/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
145#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
146# define _CRT_SECURE_NO_DEPRECATE
147#endif
148
149/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
150#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
151# define _SCL_SECURE_NO_DEPRECATE
152#endif
153
154/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
155#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
156# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
157#endif
158
159/* Intel's compiler complains if a variable which was never initialised is
160 * cast to void, which is a common idiom which we use to indicate that we
161 * are aware a variable isn't used. So we just silence that warning.
162 * See: https://github.com/swig/swig/issues/192 for more discussion.
163 */
164#ifdef __INTEL_COMPILER
165# pragma warning disable 592
166#endif
167
168
169#if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
170/* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
171# include <math.h>
172#endif
173
174#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
175/* Use debug wrappers with the Python release dll */
176# undef _DEBUG
177# include <Python.h>
178# define _DEBUG 1
179#else
180# include <Python.h>
181#endif
182
183/* -----------------------------------------------------------------------------
184 * swigrun.swg
185 *
186 * This file contains generic C API SWIG runtime support for pointer
187 * type checking.
188 * ----------------------------------------------------------------------------- */
189
190/* This should only be incremented when either the layout of swig_type_info changes,
191 or for whatever reason, the runtime changes incompatibly */
192#define SWIG_RUNTIME_VERSION "4"
193
194/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
195#ifdef SWIG_TYPE_TABLE
196# define SWIG_QUOTE_STRING(x) #x
197# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
198# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
199#else
200# define SWIG_TYPE_TABLE_NAME
201#endif
202
203/*
204 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
205 creating a static or dynamic library from the SWIG runtime code.
206 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
207
208 But only do this if strictly necessary, ie, if you have problems
209 with your compiler or suchlike.
210*/
211
212#ifndef SWIGRUNTIME
213# define SWIGRUNTIME SWIGINTERN
214#endif
215
216#ifndef SWIGRUNTIMEINLINE
217# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
218#endif
219
220/* Generic buffer size */
221#ifndef SWIG_BUFFER_SIZE
222# define SWIG_BUFFER_SIZE 1024
223#endif
224
225/* Flags for pointer conversions */
226#define SWIG_POINTER_DISOWN 0x1
227#define SWIG_CAST_NEW_MEMORY 0x2
228#define SWIG_POINTER_NO_NULL 0x4
229
230/* Flags for new pointer objects */
231#define SWIG_POINTER_OWN 0x1
232
233
234/*
235 Flags/methods for returning states.
236
237 The SWIG conversion methods, as ConvertPtr, return an integer
238 that tells if the conversion was successful or not. And if not,
239 an error code can be returned (see swigerrors.swg for the codes).
240
241 Use the following macros/flags to set or process the returning
242 states.
243
244 In old versions of SWIG, code such as the following was usually written:
245
246 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
247 // success code
248 } else {
249 //fail code
250 }
251
252 Now you can be more explicit:
253
254 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
255 if (SWIG_IsOK(res)) {
256 // success code
257 } else {
258 // fail code
259 }
260
261 which is the same really, but now you can also do
262
263 Type *ptr;
264 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
265 if (SWIG_IsOK(res)) {
266 // success code
267 if (SWIG_IsNewObj(res) {
268 ...
269 delete *ptr;
270 } else {
271 ...
272 }
273 } else {
274 // fail code
275 }
276
277 I.e., now SWIG_ConvertPtr can return new objects and you can
278 identify the case and take care of the deallocation. Of course that
279 also requires SWIG_ConvertPtr to return new result values, such as
280
281 int SWIG_ConvertPtr(obj, ptr,...) {
282 if (<obj is ok>) {
283 if (<need new object>) {
284 *ptr = <ptr to new allocated object>;
285 return SWIG_NEWOBJ;
286 } else {
287 *ptr = <ptr to old object>;
288 return SWIG_OLDOBJ;
289 }
290 } else {
291 return SWIG_BADOBJ;
292 }
293 }
294
295 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
296 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
297 SWIG errors code.
298
299 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
300 allows to return the 'cast rank', for example, if you have this
301
302 int food(double)
303 int fooi(int);
304
305 and you call
306
307 food(1) // cast rank '1' (1 -> 1.0)
308 fooi(1) // cast rank '0'
309
310 just use the SWIG_AddCast()/SWIG_CheckState()
311*/
312
313#define SWIG_OK (0)
314#define SWIG_ERROR (-1)
315#define SWIG_IsOK(r) (r >= 0)
316#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
317
318/* The CastRankLimit says how many bits are used for the cast rank */
319#define SWIG_CASTRANKLIMIT (1 << 8)
320/* The NewMask denotes the object was created (using new/malloc) */
321#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
322/* The TmpMask is for in/out typemaps that use temporal objects */
323#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
324/* Simple returning values */
325#define SWIG_BADOBJ (SWIG_ERROR)
326#define SWIG_OLDOBJ (SWIG_OK)
327#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
328#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
329/* Check, add and del mask methods */
330#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
331#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
332#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
333#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
334#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
335#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
336
337/* Cast-Rank Mode */
338#if defined(SWIG_CASTRANK_MODE)
339# ifndef SWIG_TypeRank
340# define SWIG_TypeRank unsigned long
341# endif
342# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
343# define SWIG_MAXCASTRANK (2)
344# endif
345# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
346# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
348 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
349}
351 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
352}
353#else /* no cast-rank mode */
354# define SWIG_AddCast(r) (r)
355# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
356#endif
357
358
359#include <string.h>
360
361#ifdef __cplusplus
362extern "C" {
363#endif
364
365typedef void *(*swig_converter_func)(void *, int *);
366typedef struct swig_type_info *(*swig_dycast_func)(void **);
367
368/* Structure to store information on one type */
369typedef struct swig_type_info {
370 const char *name; /* mangled name of this type */
371 const char *str; /* human readable name of this type */
372 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
373 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
374 void *clientdata; /* language specific type data */
375 int owndata; /* flag if the structure owns the clientdata */
377
378/* Structure to store a type and conversion function used for casting */
379typedef struct swig_cast_info {
380 swig_type_info *type; /* pointer to type that is equivalent to this type */
381 swig_converter_func converter; /* function to cast the void pointers */
382 struct swig_cast_info *next; /* pointer to next cast in linked list */
383 struct swig_cast_info *prev; /* pointer to the previous cast */
385
386/* Structure used to store module information
387 * Each module generates one structure like this, and the runtime collects
388 * all of these structures and stores them in a circularly linked list.*/
389typedef struct swig_module_info {
390 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
391 size_t size; /* Number of types in this module */
392 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
393 swig_type_info **type_initial; /* Array of initially generated type structures */
394 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
395 void *clientdata; /* Language specific module data */
397
398/*
399 Compare two type names skipping the space characters, therefore
400 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
401
402 Return 0 when the two name types are equivalent, as in
403 strncmp, but skipping ' '.
404*/
405SWIGRUNTIME int
406SWIG_TypeNameComp(const char *f1, const char *l1,
407 const char *f2, const char *l2) {
408 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
409 while ((*f1 == ' ') && (f1 != l1)) ++f1;
410 while ((*f2 == ' ') && (f2 != l2)) ++f2;
411 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
412 }
413 return (int)((l1 - f1) - (l2 - f2));
414}
415
416/*
417 Check type equivalence in a name list like <name1>|<name2>|...
418 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
419*/
420SWIGRUNTIME int
421SWIG_TypeCmp(const char *nb, const char *tb) {
422 int equiv = 1;
423 const char* te = tb + strlen(tb);
424 const char* ne = nb;
425 while (equiv != 0 && *ne) {
426 for (nb = ne; *ne; ++ne) {
427 if (*ne == '|') break;
428 }
429 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
430 if (*ne) ++ne;
431 }
432 return equiv;
433}
434
435/*
436 Check type equivalence in a name list like <name1>|<name2>|...
437 Return 0 if not equal, 1 if equal
438*/
439SWIGRUNTIME int
440SWIG_TypeEquiv(const char *nb, const char *tb) {
441 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
442}
443
444/*
445 Check the typename
446*/
448SWIG_TypeCheck(const char *c, swig_type_info *ty) {
449 if (ty) {
450 swig_cast_info *iter = ty->cast;
451 while (iter) {
452 if (strcmp(iter->type->name, c) == 0) {
453 if (iter == ty->cast)
454 return iter;
455 /* Move iter to the top of the linked list */
456 iter->prev->next = iter->next;
457 if (iter->next)
458 iter->next->prev = iter->prev;
459 iter->next = ty->cast;
460 iter->prev = 0;
461 if (ty->cast) ty->cast->prev = iter;
462 ty->cast = iter;
463 return iter;
464 }
465 iter = iter->next;
466 }
467 }
468 return 0;
469}
470
471/*
472 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
473*/
476 if (ty) {
477 swig_cast_info *iter = ty->cast;
478 while (iter) {
479 if (iter->type == from) {
480 if (iter == ty->cast)
481 return iter;
482 /* Move iter to the top of the linked list */
483 iter->prev->next = iter->next;
484 if (iter->next)
485 iter->next->prev = iter->prev;
486 iter->next = ty->cast;
487 iter->prev = 0;
488 if (ty->cast) ty->cast->prev = iter;
489 ty->cast = iter;
490 return iter;
491 }
492 iter = iter->next;
493 }
494 }
495 return 0;
496}
497
498/*
499 Cast a pointer up an inheritance hierarchy
500*/
502SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
503 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
504}
505
506/*
507 Dynamic pointer casting. Down an inheritance hierarchy
508*/
511 swig_type_info *lastty = ty;
512 if (!ty || !ty->dcast) return ty;
513 while (ty && (ty->dcast)) {
514 ty = (*ty->dcast)(ptr);
515 if (ty) lastty = ty;
516 }
517 return lastty;
518}
519
520/*
521 Return the name associated with this type
522*/
523SWIGRUNTIMEINLINE const char *
525 return ty->name;
526}
527
528/*
529 Return the pretty name associated with this type,
530 that is an unmangled type name in a form presentable to the user.
531*/
532SWIGRUNTIME const char *
534 /* The "str" field contains the equivalent pretty names of the
535 type, separated by vertical-bar characters. We choose
536 to print the last name, as it is often (?) the most
537 specific. */
538 if (!type) return NULL;
539 if (type->str != NULL) {
540 const char *last_name = type->str;
541 const char *s;
542 for (s = type->str; *s; s++)
543 if (*s == '|') last_name = s+1;
544 return last_name;
545 }
546 else
547 return type->name;
548}
549
550/*
551 Set the clientdata field for a type
552*/
553SWIGRUNTIME void
555 swig_cast_info *cast = ti->cast;
556 /* if (ti->clientdata == clientdata) return; */
558
559 while (cast) {
560 if (!cast->converter) {
561 swig_type_info *tc = cast->type;
562 if (!tc->clientdata) {
564 }
565 }
566 cast = cast->next;
567 }
568}
569SWIGRUNTIME void
572 ti->owndata = 1;
573}
574
575/*
576 Search for a swig_type_info structure only by mangled name
577 Search is a O(log #types)
578
579 We start searching at module start, and finish searching when start == end.
580 Note: if start == end at the beginning of the function, we go all the way around
581 the circular list.
582*/
585 swig_module_info *end,
586 const char *name) {
587 swig_module_info *iter = start;
588 do {
589 if (iter->size) {
590 size_t l = 0;
591 size_t r = iter->size - 1;
592 do {
593 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
594 size_t i = (l + r) >> 1;
595 const char *iname = iter->types[i]->name;
596 if (iname) {
597 int compare = strcmp(name, iname);
598 if (compare == 0) {
599 return iter->types[i];
600 } else if (compare < 0) {
601 if (i) {
602 r = i - 1;
603 } else {
604 break;
605 }
606 } else if (compare > 0) {
607 l = i + 1;
608 }
609 } else {
610 break; /* should never happen */
611 }
612 } while (l <= r);
613 }
614 iter = iter->next;
615 } while (iter != end);
616 return 0;
617}
618
619/*
620 Search for a swig_type_info structure for either a mangled name or a human readable name.
621 It first searches the mangled names of the types, which is a O(log #types)
622 If a type is not found it then searches the human readable names, which is O(#types).
623
624 We start searching at module start, and finish searching when start == end.
625 Note: if start == end at the beginning of the function, we go all the way around
626 the circular list.
627*/
630 swig_module_info *end,
631 const char *name) {
632 /* STEP 1: Search the name field using binary search */
634 if (ret) {
635 return ret;
636 } else {
637 /* STEP 2: If the type hasn't been found, do a complete search
638 of the str field (the human readable name) */
639 swig_module_info *iter = start;
640 do {
641 size_t i = 0;
642 for (; i < iter->size; ++i) {
643 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
644 return iter->types[i];
645 }
646 iter = iter->next;
647 } while (iter != end);
648 }
649
650 /* neither found a match */
651 return 0;
652}
653
654/*
655 Pack binary data into a string
656*/
657SWIGRUNTIME char *
658SWIG_PackData(char *c, void *ptr, size_t sz) {
659 static const char hex[17] = "0123456789abcdef";
660 const unsigned char *u = (unsigned char *) ptr;
661 const unsigned char *eu = u + sz;
662 for (; u != eu; ++u) {
663 unsigned char uu = *u;
664 *(c++) = hex[(uu & 0xf0) >> 4];
665 *(c++) = hex[uu & 0xf];
666 }
667 return c;
668}
669
670/*
671 Unpack binary data from a string
672*/
673SWIGRUNTIME const char *
674SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
675 unsigned char *u = (unsigned char *) ptr;
676 const unsigned char *eu = u + sz;
677 for (; u != eu; ++u) {
678 char d = *(c++);
679 unsigned char uu;
680 if ((d >= '0') && (d <= '9'))
681 uu = (unsigned char)((d - '0') << 4);
682 else if ((d >= 'a') && (d <= 'f'))
683 uu = (unsigned char)((d - ('a'-10)) << 4);
684 else
685 return (char *) 0;
686 d = *(c++);
687 if ((d >= '0') && (d <= '9'))
688 uu |= (unsigned char)(d - '0');
689 else if ((d >= 'a') && (d <= 'f'))
690 uu |= (unsigned char)(d - ('a'-10));
691 else
692 return (char *) 0;
693 *u = uu;
694 }
695 return c;
696}
697
698/*
699 Pack 'void *' into a string buffer.
700*/
701SWIGRUNTIME char *
702SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
703 char *r = buff;
704 if ((2*sizeof(void *) + 2) > bsz) return 0;
705 *(r++) = '_';
706 r = SWIG_PackData(r,&ptr,sizeof(void *));
707 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
708 strcpy(r,name);
709 return buff;
710}
711
712SWIGRUNTIME const char *
713SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
714 if (*c != '_') {
715 if (strcmp(c,"NULL") == 0) {
716 *ptr = (void *) 0;
717 return name;
718 } else {
719 return 0;
720 }
721 }
722 return SWIG_UnpackData(++c,ptr,sizeof(void *));
723}
724
725SWIGRUNTIME char *
726SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
727 char *r = buff;
728 size_t lname = (name ? strlen(name) : 0);
729 if ((2*sz + 2 + lname) > bsz) return 0;
730 *(r++) = '_';
731 r = SWIG_PackData(r,ptr,sz);
732 if (lname) {
733 strncpy(r,name,lname+1);
734 } else {
735 *r = 0;
736 }
737 return buff;
738}
739
740SWIGRUNTIME const char *
741SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
742 if (*c != '_') {
743 if (strcmp(c,"NULL") == 0) {
744 memset(ptr,0,sz);
745 return name;
746 } else {
747 return 0;
748 }
749 }
750 return SWIG_UnpackData(++c,ptr,sz);
751}
752
753#ifdef __cplusplus
754}
755#endif
756
757/* Errors in SWIG */
758#define SWIG_UnknownError -1
759#define SWIG_IOError -2
760#define SWIG_RuntimeError -3
761#define SWIG_IndexError -4
762#define SWIG_TypeError -5
763#define SWIG_DivisionByZero -6
764#define SWIG_OverflowError -7
765#define SWIG_SyntaxError -8
766#define SWIG_ValueError -9
767#define SWIG_SystemError -10
768#define SWIG_AttributeError -11
769#define SWIG_MemoryError -12
770#define SWIG_NullReferenceError -13
771
772
773
774/* Compatibility macros for Python 3 */
775#if PY_VERSION_HEX >= 0x03000000
776
777#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
778#define PyInt_Check(x) PyLong_Check(x)
779#define PyInt_AsLong(x) PyLong_AsLong(x)
780#define PyInt_FromLong(x) PyLong_FromLong(x)
781#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
782#define PyString_Check(name) PyBytes_Check(name)
783#define PyString_FromString(x) PyUnicode_FromString(x)
784#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
785#define PyString_AsString(str) PyBytes_AsString(str)
786#define PyString_Size(str) PyBytes_Size(str)
787#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
788#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
789#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
790#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
791
792#endif
793
794#ifndef Py_TYPE
795# define Py_TYPE(op) ((op)->ob_type)
796#endif
797
798/* SWIG APIs for compatibility of both Python 2 & 3 */
799
800#if PY_VERSION_HEX >= 0x03000000
801# define SWIG_Python_str_FromFormat PyUnicode_FromFormat
802#else
803# define SWIG_Python_str_FromFormat PyString_FromFormat
804#endif
805
806
807/* Warning: This function will allocate a new string in Python 3,
808 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
809 */
810SWIGINTERN char*
812{
813#if PY_VERSION_HEX >= 0x03030000
814 return (char *)PyUnicode_AsUTF8(str);
815#elif PY_VERSION_HEX >= 0x03000000
816 char *newstr = 0;
817 str = PyUnicode_AsUTF8String(str);
818 if (str) {
819 char *cstr;
820 Py_ssize_t len;
821 if (PyBytes_AsStringAndSize(str, &cstr, &len) != -1) {
822 newstr = (char *) malloc(len+1);
823 if (newstr)
824 memcpy(newstr, cstr, len+1);
825 }
826 Py_XDECREF(str);
827 }
828 return newstr;
829#else
830 return PyString_AsString(str);
831#endif
832}
833
834#if PY_VERSION_HEX >= 0x03030000 || PY_VERSION_HEX < 0x03000000
835# define SWIG_Python_str_DelForPy3(x)
836#else
837# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
838#endif
839
840
841SWIGINTERN PyObject*
843{
844#if PY_VERSION_HEX >= 0x03000000
845 return PyUnicode_FromString(c);
846#else
847 return PyString_FromString(c);
848#endif
849}
850
851#ifndef PyObject_DEL
852# define PyObject_DEL PyObject_Del
853#endif
854
855// SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
856// interface files check for it.
857# define SWIGPY_USE_CAPSULE
858# define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
859
860#if PY_VERSION_HEX < 0x03020000
861#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
862#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
863#define Py_hash_t long
864#endif
865
866/* -----------------------------------------------------------------------------
867 * error manipulation
868 * ----------------------------------------------------------------------------- */
869
870SWIGRUNTIME PyObject*
872 PyObject* type = 0;
873 switch(code) {
874 case SWIG_MemoryError:
875 type = PyExc_MemoryError;
876 break;
877 case SWIG_IOError:
878 type = PyExc_IOError;
879 break;
881 type = PyExc_RuntimeError;
882 break;
883 case SWIG_IndexError:
884 type = PyExc_IndexError;
885 break;
886 case SWIG_TypeError:
887 type = PyExc_TypeError;
888 break;
890 type = PyExc_ZeroDivisionError;
891 break;
893 type = PyExc_OverflowError;
894 break;
895 case SWIG_SyntaxError:
896 type = PyExc_SyntaxError;
897 break;
898 case SWIG_ValueError:
899 type = PyExc_ValueError;
900 break;
901 case SWIG_SystemError:
902 type = PyExc_SystemError;
903 break;
905 type = PyExc_AttributeError;
906 break;
907 default:
908 type = PyExc_RuntimeError;
909 }
910 return type;
911}
912
913
914SWIGRUNTIME void
915SWIG_Python_AddErrorMsg(const char* mesg)
916{
917 PyObject *type = 0;
918 PyObject *value = 0;
919 PyObject *traceback = 0;
920
921 if (PyErr_Occurred())
922 PyErr_Fetch(&type, &value, &traceback);
923 if (value) {
924 PyObject *old_str = PyObject_Str(value);
925 const char *tmp = SWIG_Python_str_AsChar(old_str);
926 PyErr_Clear();
927 Py_XINCREF(type);
928 if (tmp)
929 PyErr_Format(type, "%s %s", tmp, mesg);
930 else
931 PyErr_Format(type, "%s", mesg);
933 Py_DECREF(old_str);
934 Py_DECREF(value);
935 } else {
936 PyErr_SetString(PyExc_RuntimeError, mesg);
937 }
938}
939
940SWIGRUNTIME int
942{
943 PyObject *error;
944 if (obj)
945 return 0;
946 error = PyErr_Occurred();
947 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
948}
949
950SWIGRUNTIME void
952{
954 /* Use existing TypeError to preserve stacktrace and enhance with given message */
955 PyObject *newvalue;
956 PyObject *type = NULL, *value = NULL, *traceback = NULL;
957 PyErr_Fetch(&type, &value, &traceback);
958#if PY_VERSION_HEX >= 0x03000000
959 newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
960#else
961 newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
962#endif
963 Py_XDECREF(value);
964 PyErr_Restore(type, newvalue, traceback);
965 } else {
966 /* Raise TypeError using given message */
967 PyErr_SetString(PyExc_TypeError, message);
968 }
969}
970
971#if defined(SWIG_PYTHON_NO_THREADS)
972# if defined(SWIG_PYTHON_THREADS)
973# undef SWIG_PYTHON_THREADS
974# endif
975#endif
976#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
977# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
978# define SWIG_PYTHON_USE_GIL
979# endif
980# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
981# ifndef SWIG_PYTHON_INITIALIZE_THREADS
982# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
983# endif
984# ifdef __cplusplus /* C++ code */
985 class SWIG_Python_Thread_Block {
986 bool status;
987 PyGILState_STATE state;
988 public:
989 void end() { if (status) { PyGILState_Release(state); status = false;} }
990 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
991 ~SWIG_Python_Thread_Block() { end(); }
992 };
993 class SWIG_Python_Thread_Allow {
994 bool status;
995 PyThreadState *save;
996 public:
997 void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
998 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
999 ~SWIG_Python_Thread_Allow() { end(); }
1000 };
1001# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1002# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1003# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1004# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1005# else /* C code */
1006# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1007# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1008# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1009# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1010# endif
1011# else /* Old thread way, not implemented, user must provide it */
1012# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1013# define SWIG_PYTHON_INITIALIZE_THREADS
1014# endif
1015# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1016# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1017# endif
1018# if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1019# define SWIG_PYTHON_THREAD_END_BLOCK
1020# endif
1021# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1022# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1023# endif
1024# if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1025# define SWIG_PYTHON_THREAD_END_ALLOW
1026# endif
1027# endif
1028#else /* No thread support */
1029# define SWIG_PYTHON_INITIALIZE_THREADS
1030# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1031# define SWIG_PYTHON_THREAD_END_BLOCK
1032# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1033# define SWIG_PYTHON_THREAD_END_ALLOW
1034#endif
1035
1036/* -----------------------------------------------------------------------------
1037 * Python API portion that goes into the runtime
1038 * ----------------------------------------------------------------------------- */
1039
1040#ifdef __cplusplus
1041extern "C" {
1042#endif
1043
1044/* -----------------------------------------------------------------------------
1045 * Constant declarations
1046 * ----------------------------------------------------------------------------- */
1047
1048/* Constant Types */
1049#define SWIG_PY_POINTER 4
1050#define SWIG_PY_BINARY 5
1051
1052/* Constant information structure */
1053typedef struct swig_const_info {
1054 int type;
1055 const char *name;
1056 long lvalue;
1057 double dvalue;
1058 void *pvalue;
1061
1062#ifdef __cplusplus
1063}
1064#endif
1065
1066
1067/* -----------------------------------------------------------------------------
1068 * pyrun.swg
1069 *
1070 * This file contains the runtime support for Python modules
1071 * and includes code for managing global variables and pointer
1072 * type checking.
1073 *
1074 * ----------------------------------------------------------------------------- */
1075
1076#if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1077# error "This version of SWIG only supports Python >= 2.7"
1078#endif
1079
1080#if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1081# error "This version of SWIG only supports Python 3 >= 3.2"
1082#endif
1083
1084/* Common SWIG API */
1085
1086/* for raw pointers */
1087#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1088#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1089#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1090
1091#ifdef SWIGPYTHON_BUILTIN
1092#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1093#else
1094#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1095#endif
1096
1097#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1098
1099#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1100#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1101#define swig_owntype int
1102
1103/* for raw packed data */
1104#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1105#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1106
1107/* for class or struct pointers */
1108#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1109#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1110
1111/* for C or C++ function pointers */
1112#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1113#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1114
1115/* for C++ member pointers, ie, member methods */
1116#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1117#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1118
1119
1120/* Runtime API */
1121
1122#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1123#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1124#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1125
1126#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1127#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1128#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1129#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1130#define SWIG_fail goto fail
1131
1132
1133/* Runtime API implementation */
1134
1135/* Error manipulation */
1136
1137SWIGINTERN void
1138SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1140 PyErr_SetObject(errtype, obj);
1141 Py_DECREF(obj);
1143}
1144
1145SWIGINTERN void
1146SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1148 PyErr_SetString(errtype, msg);
1150}
1151
1152#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1153
1154/* Set a constant value */
1155
1156#if defined(SWIGPYTHON_BUILTIN)
1157
1158SWIGINTERN void
1159SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1160 PyObject *s = PyString_InternFromString(key);
1161 PyList_Append(seq, s);
1162 Py_DECREF(s);
1163}
1164
1165SWIGINTERN void
1166SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1167 PyDict_SetItemString(d, name, obj);
1168 Py_DECREF(obj);
1169 if (public_interface)
1170 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1171}
1172
1173#else
1174
1175SWIGINTERN void
1176SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1177 PyDict_SetItemString(d, name, obj);
1178 Py_DECREF(obj);
1179}
1180
1181#endif
1182
1183/* Append a value to the result obj */
1184
1185SWIGINTERN PyObject*
1186SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1187 if (!result) {
1188 result = obj;
1189 } else if (result == Py_None) {
1190 Py_DECREF(result);
1191 result = obj;
1192 } else {
1193 if (!PyList_Check(result)) {
1194 PyObject *o2 = result;
1195 result = PyList_New(1);
1196 PyList_SetItem(result, 0, o2);
1197 }
1198 PyList_Append(result,obj);
1199 Py_DECREF(obj);
1200 }
1201 return result;
1202}
1203
1204/* Unpack the argument tuple */
1205
1206SWIGINTERN Py_ssize_t
1207SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1208{
1209 if (!args) {
1210 if (!min && !max) {
1211 return 1;
1212 } else {
1213 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1214 name, (min == max ? "" : "at least "), (int)min);
1215 return 0;
1216 }
1217 }
1218 if (!PyTuple_Check(args)) {
1219 if (min <= 1 && max >= 1) {
1220 Py_ssize_t i;
1221 objs[0] = args;
1222 for (i = 1; i < max; ++i) {
1223 objs[i] = 0;
1224 }
1225 return 2;
1226 }
1227 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1228 return 0;
1229 } else {
1230 Py_ssize_t l = PyTuple_GET_SIZE(args);
1231 if (l < min) {
1232 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1233 name, (min == max ? "" : "at least "), (int)min, (int)l);
1234 return 0;
1235 } else if (l > max) {
1236 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1237 name, (min == max ? "" : "at most "), (int)max, (int)l);
1238 return 0;
1239 } else {
1240 Py_ssize_t i;
1241 for (i = 0; i < l; ++i) {
1242 objs[i] = PyTuple_GET_ITEM(args, i);
1243 }
1244 for (; l < max; ++l) {
1245 objs[l] = 0;
1246 }
1247 return i + 1;
1248 }
1249 }
1250}
1251
1252SWIGINTERN int
1253SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) {
1254 int no_kwargs = 1;
1255 if (kwargs) {
1256 assert(PyDict_Check(kwargs));
1257 if (PyDict_Size(kwargs) > 0) {
1258 PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name);
1259 no_kwargs = 0;
1260 }
1261 }
1262 return no_kwargs;
1263}
1264
1265/* A functor is a function object with one single object argument */
1266#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1267
1268/*
1269 Helper for static pointer initialization for both C and C++ code, for example
1270 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1271*/
1272#ifdef __cplusplus
1273#define SWIG_STATIC_POINTER(var) var
1274#else
1275#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1276#endif
1277
1278/* -----------------------------------------------------------------------------
1279 * Pointer declarations
1280 * ----------------------------------------------------------------------------- */
1281
1282/* Flags for new pointer objects */
1283#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1284#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1285
1286#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1287
1288#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1289#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1290
1291#ifdef __cplusplus
1292extern "C" {
1293#endif
1294
1295/* The python void return value */
1296
1297SWIGRUNTIMEINLINE PyObject *
1299{
1300 PyObject *none = Py_None;
1301 Py_INCREF(none);
1302 return none;
1303}
1304
1305/* SwigPyClientData */
1306
1307typedef struct {
1308 PyObject *klass;
1309 PyObject *newraw;
1310 PyObject *newargs;
1311 PyObject *destroy;
1312 int delargs;
1313 int implicitconv;
1314 PyTypeObject *pytype;
1316
1319{
1321 int fail = data ? data->implicitconv : 0;
1322 if (fail)
1323 PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
1324 return fail;
1325}
1326
1327SWIGRUNTIMEINLINE PyObject *
1329 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1330 PyObject *klass = data ? data->klass : 0;
1331 return (klass ? klass : PyExc_RuntimeError);
1332}
1333
1334
1337{
1338 if (!obj) {
1339 return 0;
1340 } else {
1342 /* the klass element */
1343 data->klass = obj;
1344 Py_INCREF(data->klass);
1345 /* the newraw method and newargs arguments used to create a new raw instance */
1346 if (PyClass_Check(obj)) {
1347 data->newraw = 0;
1348 data->newargs = obj;
1349 Py_INCREF(obj);
1350 } else {
1351 data->newraw = PyObject_GetAttrString(data->klass, "__new__");
1352 if (data->newraw) {
1353 Py_INCREF(data->newraw);
1354 data->newargs = PyTuple_New(1);
1355 PyTuple_SetItem(data->newargs, 0, obj);
1356 } else {
1357 data->newargs = obj;
1358 }
1359 Py_INCREF(data->newargs);
1360 }
1361 /* the destroy method, aka as the C++ delete method */
1362 data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
1363 if (PyErr_Occurred()) {
1364 PyErr_Clear();
1365 data->destroy = 0;
1366 }
1367 if (data->destroy) {
1368 int flags;
1369 Py_INCREF(data->destroy);
1370 flags = PyCFunction_GET_FLAGS(data->destroy);
1371 data->delargs = !(flags & (METH_O));
1372 } else {
1373 data->delargs = 0;
1374 }
1375 data->implicitconv = 0;
1376 data->pytype = 0;
1377 return data;
1378 }
1379}
1380
1381SWIGRUNTIME void
1383 Py_XDECREF(data->newraw);
1384 Py_XDECREF(data->newargs);
1385 Py_XDECREF(data->destroy);
1386}
1387
1388/* =============== SwigPyObject =====================*/
1389
1390typedef struct {
1391 PyObject_HEAD
1392 void *ptr;
1393 swig_type_info *ty;
1394 int own;
1395 PyObject *next;
1396#ifdef SWIGPYTHON_BUILTIN
1397 PyObject *dict;
1398#endif
1399} SwigPyObject;
1400
1401
1402#ifdef SWIGPYTHON_BUILTIN
1403
1404SWIGRUNTIME PyObject *
1405SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1406{
1407 SwigPyObject *sobj = (SwigPyObject *)v;
1408
1409 if (!sobj->dict)
1410 sobj->dict = PyDict_New();
1411
1412 Py_INCREF(sobj->dict);
1413 return sobj->dict;
1414}
1415
1416#endif
1417
1418SWIGRUNTIME PyObject *
1420{
1421 return PyLong_FromVoidPtr(v->ptr);
1422}
1423
1424SWIGRUNTIME PyObject *
1426{
1427 PyObject *res = NULL;
1428 PyObject *args = PyTuple_New(1);
1429 if (args) {
1430 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1431 PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1432 if (ofmt) {
1433#if PY_VERSION_HEX >= 0x03000000
1434 res = PyUnicode_Format(ofmt,args);
1435#else
1436 res = PyString_Format(ofmt,args);
1437#endif
1438 Py_DECREF(ofmt);
1439 }
1440 Py_DECREF(args);
1441 }
1442 }
1443 return res;
1444}
1445
1446SWIGRUNTIME PyObject *
1448{
1449 return SwigPyObject_format("%o",v);
1450}
1451
1452SWIGRUNTIME PyObject *
1454{
1455 return SwigPyObject_format("%x",v);
1456}
1457
1458SWIGRUNTIME PyObject *
1460{
1461 const char *name = SWIG_TypePrettyName(v->ty);
1462 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1463 if (v->next) {
1464 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1465# if PY_VERSION_HEX >= 0x03000000
1466 PyObject *joined = PyUnicode_Concat(repr, nrep);
1467 Py_DecRef(repr);
1468 Py_DecRef(nrep);
1469 repr = joined;
1470# else
1471 PyString_ConcatAndDel(&repr,nrep);
1472# endif
1473 }
1474 return repr;
1475}
1476
1477/* We need a version taking two PyObject* parameters so it's a valid
1478 * PyCFunction to use in swigobject_methods[]. */
1479SWIGRUNTIME PyObject *
1480SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1481{
1482 return SwigPyObject_repr((SwigPyObject*)v);
1483}
1484
1485SWIGRUNTIME int
1487{
1488 void *i = v->ptr;
1489 void *j = w->ptr;
1490 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1491}
1492
1493/* Added for Python 3.x, would it also be useful for Python 2.x? */
1494SWIGRUNTIME PyObject*
1496{
1497 PyObject* res;
1498 if( op != Py_EQ && op != Py_NE ) {
1499 Py_INCREF(Py_NotImplemented);
1500 return Py_NotImplemented;
1501 }
1502 res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1503 return res;
1504}
1505
1506
1507SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1508
1509#ifdef SWIGPYTHON_BUILTIN
1510static swig_type_info *SwigPyObject_stype = 0;
1511SWIGRUNTIME PyTypeObject*
1512SwigPyObject_type(void) {
1513 SwigPyClientData *cd;
1514 assert(SwigPyObject_stype);
1515 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1516 assert(cd);
1517 assert(cd->pytype);
1518 return cd->pytype;
1519}
1520#else
1521SWIGRUNTIME PyTypeObject*
1523 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1524 return type;
1525}
1526#endif
1527
1529SwigPyObject_Check(PyObject *op) {
1530#ifdef SWIGPYTHON_BUILTIN
1531 PyTypeObject *target_tp = SwigPyObject_type();
1532 if (PyType_IsSubtype(op->ob_type, target_tp))
1533 return 1;
1534 return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1535#else
1536 return (Py_TYPE(op) == SwigPyObject_type())
1537 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1538#endif
1539}
1540
1541SWIGRUNTIME PyObject *
1542SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1543
1544SWIGRUNTIME void
1546{
1547 SwigPyObject *sobj = (SwigPyObject *) v;
1548 PyObject *next = sobj->next;
1549 if (sobj->own == SWIG_POINTER_OWN) {
1550 swig_type_info *ty = sobj->ty;
1551 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1552 PyObject *destroy = data ? data->destroy : 0;
1553 if (destroy) {
1554 /* destroy is always a VARARGS method */
1555 PyObject *res;
1556
1557 /* PyObject_CallFunction() has the potential to silently drop
1558 the active exception. In cases of unnamed temporary
1559 variable or where we just finished iterating over a generator
1560 StopIteration will be active right now, and this needs to
1561 remain true upon return from SwigPyObject_dealloc. So save
1562 and restore. */
1563
1564 PyObject *type = NULL, *value = NULL, *traceback = NULL;
1565 PyErr_Fetch(&type, &value, &traceback);
1566
1567 if (data->delargs) {
1568 /* we need to create a temporary object to carry the destroy operation */
1569 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1570 res = SWIG_Python_CallFunctor(destroy, tmp);
1571 Py_DECREF(tmp);
1572 } else {
1573 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1574 PyObject *mself = PyCFunction_GET_SELF(destroy);
1575 res = ((*meth)(mself, v));
1576 }
1577 if (!res)
1578 PyErr_WriteUnraisable(destroy);
1579
1580 PyErr_Restore(type, value, traceback);
1581
1582 Py_XDECREF(res);
1583 }
1584#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1585 else {
1586 const char *name = SWIG_TypePrettyName(ty);
1587 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1588 }
1589#endif
1590 }
1591 Py_XDECREF(next);
1592 PyObject_DEL(v);
1593}
1594
1595SWIGRUNTIME PyObject*
1596SwigPyObject_append(PyObject* v, PyObject* next)
1597{
1598 SwigPyObject *sobj = (SwigPyObject *) v;
1599 if (!SwigPyObject_Check(next)) {
1600 PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
1601 return NULL;
1602 }
1603 sobj->next = next;
1604 Py_INCREF(next);
1605 return SWIG_Py_Void();
1606}
1607
1608SWIGRUNTIME PyObject*
1609SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1610{
1611 SwigPyObject *sobj = (SwigPyObject *) v;
1612 if (sobj->next) {
1613 Py_INCREF(sobj->next);
1614 return sobj->next;
1615 } else {
1616 return SWIG_Py_Void();
1617 }
1618}
1619
1620SWIGINTERN PyObject*
1621SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1622{
1623 SwigPyObject *sobj = (SwigPyObject *)v;
1624 sobj->own = 0;
1625 return SWIG_Py_Void();
1626}
1627
1628SWIGINTERN PyObject*
1629SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1630{
1631 SwigPyObject *sobj = (SwigPyObject *)v;
1632 sobj->own = SWIG_POINTER_OWN;
1633 return SWIG_Py_Void();
1634}
1635
1636SWIGINTERN PyObject*
1637SwigPyObject_own(PyObject *v, PyObject *args)
1638{
1639 PyObject *val = 0;
1640 if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
1641 return NULL;
1642 } else {
1643 SwigPyObject *sobj = (SwigPyObject *)v;
1644 PyObject *obj = PyBool_FromLong(sobj->own);
1645 if (val) {
1646 if (PyObject_IsTrue(val)) {
1647 SwigPyObject_acquire(v,args);
1648 } else {
1649 SwigPyObject_disown(v,args);
1650 }
1651 }
1652 return obj;
1653 }
1654}
1655
1656static PyMethodDef
1658 {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"},
1659 {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"},
1660 {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"},
1661 {"append", SwigPyObject_append, METH_O, "appends another 'this' object"},
1662 {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"},
1663 {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"},
1664 {0, 0, 0, 0}
1665};
1666
1667SWIGRUNTIME PyTypeObject*
1669 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1670
1671 static PyNumberMethods SwigPyObject_as_number = {
1672 (binaryfunc)0, /*nb_add*/
1673 (binaryfunc)0, /*nb_subtract*/
1674 (binaryfunc)0, /*nb_multiply*/
1675 /* nb_divide removed in Python 3 */
1676#if PY_VERSION_HEX < 0x03000000
1677 (binaryfunc)0, /*nb_divide*/
1678#endif
1679 (binaryfunc)0, /*nb_remainder*/
1680 (binaryfunc)0, /*nb_divmod*/
1681 (ternaryfunc)0,/*nb_power*/
1682 (unaryfunc)0, /*nb_negative*/
1683 (unaryfunc)0, /*nb_positive*/
1684 (unaryfunc)0, /*nb_absolute*/
1685 (inquiry)0, /*nb_nonzero*/
1686 0, /*nb_invert*/
1687 0, /*nb_lshift*/
1688 0, /*nb_rshift*/
1689 0, /*nb_and*/
1690 0, /*nb_xor*/
1691 0, /*nb_or*/
1692#if PY_VERSION_HEX < 0x03000000
1693 0, /*nb_coerce*/
1694#endif
1695 (unaryfunc)SwigPyObject_long, /*nb_int*/
1696#if PY_VERSION_HEX < 0x03000000
1697 (unaryfunc)SwigPyObject_long, /*nb_long*/
1698#else
1699 0, /*nb_reserved*/
1700#endif
1701 (unaryfunc)0, /*nb_float*/
1702#if PY_VERSION_HEX < 0x03000000
1703 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
1704 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
1705#endif
1706#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
1707 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
1708#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1709 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1710#else
1711 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1712#endif
1713 };
1714
1715 static PyTypeObject swigpyobject_type;
1716 static int type_init = 0;
1717 if (!type_init) {
1718 const PyTypeObject tmp = {
1719#if PY_VERSION_HEX >= 0x03000000
1720 PyVarObject_HEAD_INIT(NULL, 0)
1721#else
1722 PyObject_HEAD_INIT(NULL)
1723 0, /* ob_size */
1724#endif
1725 "SwigPyObject", /* tp_name */
1726 sizeof(SwigPyObject), /* tp_basicsize */
1727 0, /* tp_itemsize */
1728 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
1729 0, /* tp_print */
1730 (getattrfunc)0, /* tp_getattr */
1731 (setattrfunc)0, /* tp_setattr */
1732#if PY_VERSION_HEX >= 0x03000000
1733 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1734#else
1735 (cmpfunc)SwigPyObject_compare, /* tp_compare */
1736#endif
1737 (reprfunc)SwigPyObject_repr, /* tp_repr */
1738 &SwigPyObject_as_number, /* tp_as_number */
1739 0, /* tp_as_sequence */
1740 0, /* tp_as_mapping */
1741 (hashfunc)0, /* tp_hash */
1742 (ternaryfunc)0, /* tp_call */
1743 0, /* tp_str */
1744 PyObject_GenericGetAttr, /* tp_getattro */
1745 0, /* tp_setattro */
1746 0, /* tp_as_buffer */
1747 Py_TPFLAGS_DEFAULT, /* tp_flags */
1748 swigobject_doc, /* tp_doc */
1749 0, /* tp_traverse */
1750 0, /* tp_clear */
1751 (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1752 0, /* tp_weaklistoffset */
1753 0, /* tp_iter */
1754 0, /* tp_iternext */
1755 swigobject_methods, /* tp_methods */
1756 0, /* tp_members */
1757 0, /* tp_getset */
1758 0, /* tp_base */
1759 0, /* tp_dict */
1760 0, /* tp_descr_get */
1761 0, /* tp_descr_set */
1762 0, /* tp_dictoffset */
1763 0, /* tp_init */
1764 0, /* tp_alloc */
1765 0, /* tp_new */
1766 0, /* tp_free */
1767 0, /* tp_is_gc */
1768 0, /* tp_bases */
1769 0, /* tp_mro */
1770 0, /* tp_cache */
1771 0, /* tp_subclasses */
1772 0, /* tp_weaklist */
1773 0, /* tp_del */
1774 0, /* tp_version_tag */
1775#if PY_VERSION_HEX >= 0x03040000
1776 0, /* tp_finalize */
1777#endif
1778#if PY_VERSION_HEX >= 0x03080000
1779 0, /* tp_vectorcall */
1780#endif
1781#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1782 0, /* tp_print */
1783#endif
1784#ifdef COUNT_ALLOCS
1785 0, /* tp_allocs */
1786 0, /* tp_frees */
1787 0, /* tp_maxalloc */
1788 0, /* tp_prev */
1789 0 /* tp_next */
1790#endif
1791 };
1792 swigpyobject_type = tmp;
1793 type_init = 1;
1794 if (PyType_Ready(&swigpyobject_type) < 0)
1795 return NULL;
1796 }
1797 return &swigpyobject_type;
1798}
1799
1800SWIGRUNTIME PyObject *
1801SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1802{
1803 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1804 if (sobj) {
1805 sobj->ptr = ptr;
1806 sobj->ty = ty;
1807 sobj->own = own;
1808 sobj->next = 0;
1809 }
1810 return (PyObject *)sobj;
1811}
1812
1813/* -----------------------------------------------------------------------------
1814 * Implements a simple Swig Packed type, and use it instead of string
1815 * ----------------------------------------------------------------------------- */
1816
1817typedef struct {
1818 PyObject_HEAD
1819 void *pack;
1820 swig_type_info *ty;
1821 size_t size;
1822} SwigPyPacked;
1823
1824SWIGRUNTIME PyObject *
1826{
1827 char result[SWIG_BUFFER_SIZE];
1828 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1829 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1830 } else {
1831 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1832 }
1833}
1834
1835SWIGRUNTIME PyObject *
1837{
1838 char result[SWIG_BUFFER_SIZE];
1839 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1840 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
1841 } else {
1842 return SWIG_Python_str_FromChar(v->ty->name);
1843 }
1844}
1845
1846SWIGRUNTIME int
1848{
1849 size_t i = v->size;
1850 size_t j = w->size;
1851 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1852 return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size);
1853}
1854
1855SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
1856
1857SWIGRUNTIME PyTypeObject*
1859 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
1860 return type;
1861}
1862
1864SwigPyPacked_Check(PyObject *op) {
1865 return ((op)->ob_type == SwigPyPacked_TypeOnce())
1866 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
1867}
1868
1869SWIGRUNTIME void
1871{
1872 if (SwigPyPacked_Check(v)) {
1873 SwigPyPacked *sobj = (SwigPyPacked *) v;
1874 free(sobj->pack);
1875 }
1876 PyObject_DEL(v);
1877}
1878
1879SWIGRUNTIME PyTypeObject*
1881 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1882 static PyTypeObject swigpypacked_type;
1883 static int type_init = 0;
1884 if (!type_init) {
1885 const PyTypeObject tmp = {
1886#if PY_VERSION_HEX>=0x03000000
1887 PyVarObject_HEAD_INIT(NULL, 0)
1888#else
1889 PyObject_HEAD_INIT(NULL)
1890 0, /* ob_size */
1891#endif
1892 "SwigPyPacked", /* tp_name */
1893 sizeof(SwigPyPacked), /* tp_basicsize */
1894 0, /* tp_itemsize */
1895 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
1896 0, /* tp_print */
1897 (getattrfunc)0, /* tp_getattr */
1898 (setattrfunc)0, /* tp_setattr */
1899#if PY_VERSION_HEX>=0x03000000
1900 0, /* tp_reserved in 3.0.1 */
1901#else
1902 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
1903#endif
1904 (reprfunc)SwigPyPacked_repr, /* tp_repr */
1905 0, /* tp_as_number */
1906 0, /* tp_as_sequence */
1907 0, /* tp_as_mapping */
1908 (hashfunc)0, /* tp_hash */
1909 (ternaryfunc)0, /* tp_call */
1910 (reprfunc)SwigPyPacked_str, /* tp_str */
1911 PyObject_GenericGetAttr, /* tp_getattro */
1912 0, /* tp_setattro */
1913 0, /* tp_as_buffer */
1914 Py_TPFLAGS_DEFAULT, /* tp_flags */
1915 swigpacked_doc, /* tp_doc */
1916 0, /* tp_traverse */
1917 0, /* tp_clear */
1918 0, /* tp_richcompare */
1919 0, /* tp_weaklistoffset */
1920 0, /* tp_iter */
1921 0, /* tp_iternext */
1922 0, /* tp_methods */
1923 0, /* tp_members */
1924 0, /* tp_getset */
1925 0, /* tp_base */
1926 0, /* tp_dict */
1927 0, /* tp_descr_get */
1928 0, /* tp_descr_set */
1929 0, /* tp_dictoffset */
1930 0, /* tp_init */
1931 0, /* tp_alloc */
1932 0, /* tp_new */
1933 0, /* tp_free */
1934 0, /* tp_is_gc */
1935 0, /* tp_bases */
1936 0, /* tp_mro */
1937 0, /* tp_cache */
1938 0, /* tp_subclasses */
1939 0, /* tp_weaklist */
1940 0, /* tp_del */
1941 0, /* tp_version_tag */
1942#if PY_VERSION_HEX >= 0x03040000
1943 0, /* tp_finalize */
1944#endif
1945#if PY_VERSION_HEX >= 0x03080000
1946 0, /* tp_vectorcall */
1947#endif
1948#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1949 0, /* tp_print */
1950#endif
1951#ifdef COUNT_ALLOCS
1952 0, /* tp_allocs */
1953 0, /* tp_frees */
1954 0, /* tp_maxalloc */
1955 0, /* tp_prev */
1956 0 /* tp_next */
1957#endif
1958 };
1959 swigpypacked_type = tmp;
1960 type_init = 1;
1961 if (PyType_Ready(&swigpypacked_type) < 0)
1962 return NULL;
1963 }
1964 return &swigpypacked_type;
1965}
1966
1967SWIGRUNTIME PyObject *
1968SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
1969{
1970 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
1971 if (sobj) {
1972 void *pack = malloc(size);
1973 if (pack) {
1974 memcpy(pack, ptr, size);
1975 sobj->pack = pack;
1976 sobj->ty = ty;
1977 sobj->size = size;
1978 } else {
1979 PyObject_DEL((PyObject *) sobj);
1980 sobj = 0;
1981 }
1982 }
1983 return (PyObject *) sobj;
1984}
1985
1987SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
1988{
1989 if (SwigPyPacked_Check(obj)) {
1990 SwigPyPacked *sobj = (SwigPyPacked *)obj;
1991 if (sobj->size != size) return 0;
1992 memcpy(ptr, sobj->pack, size);
1993 return sobj->ty;
1994 } else {
1995 return 0;
1996 }
1997}
1998
1999/* -----------------------------------------------------------------------------
2000 * pointers/data manipulation
2001 * ----------------------------------------------------------------------------- */
2002
2003static PyObject *Swig_This_global = NULL;
2004
2005SWIGRUNTIME PyObject *
2007{
2008 if (Swig_This_global == NULL)
2010 return Swig_This_global;
2011}
2012
2013/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2014
2015/* TODO: I don't know how to implement the fast getset in Python 3 right now */
2016#if PY_VERSION_HEX>=0x03000000
2017#define SWIG_PYTHON_SLOW_GETSET_THIS
2018#endif
2019
2022{
2023 PyObject *obj;
2024
2025 if (SwigPyObject_Check(pyobj))
2026 return (SwigPyObject *) pyobj;
2027
2028#ifdef SWIGPYTHON_BUILTIN
2029 (void)obj;
2030# ifdef PyWeakref_CheckProxy
2031 if (PyWeakref_CheckProxy(pyobj)) {
2032 pyobj = PyWeakref_GET_OBJECT(pyobj);
2033 if (pyobj && SwigPyObject_Check(pyobj))
2034 return (SwigPyObject*) pyobj;
2035 }
2036# endif
2037 return NULL;
2038#else
2039
2040 obj = 0;
2041
2042#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2043 if (PyInstance_Check(pyobj)) {
2044 obj = _PyInstance_Lookup(pyobj, SWIG_This());
2045 } else {
2046 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2047 if (dictptr != NULL) {
2048 PyObject *dict = *dictptr;
2049 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2050 } else {
2051#ifdef PyWeakref_CheckProxy
2052 if (PyWeakref_CheckProxy(pyobj)) {
2053 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2054 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2055 }
2056#endif
2057 obj = PyObject_GetAttr(pyobj,SWIG_This());
2058 if (obj) {
2059 Py_DECREF(obj);
2060 } else {
2061 if (PyErr_Occurred()) PyErr_Clear();
2062 return 0;
2063 }
2064 }
2065 }
2066#else
2067 obj = PyObject_GetAttr(pyobj,SWIG_This());
2068 if (obj) {
2069 Py_DECREF(obj);
2070 } else {
2071 if (PyErr_Occurred()) PyErr_Clear();
2072 return 0;
2073 }
2074#endif
2075 if (obj && !SwigPyObject_Check(obj)) {
2076 /* a PyObject is called 'this', try to get the 'real this'
2077 SwigPyObject from it */
2078 return SWIG_Python_GetSwigThis(obj);
2079 }
2080 return (SwigPyObject *)obj;
2081#endif
2082}
2083
2084/* Acquire a pointer value */
2085
2086SWIGRUNTIME int
2087SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2088 if (own == SWIG_POINTER_OWN) {
2090 if (sobj) {
2091 int oldown = sobj->own;
2092 sobj->own = own;
2093 return oldown;
2094 }
2095 }
2096 return 0;
2097}
2098
2099/* Convert a pointer value */
2100
2101SWIGRUNTIME int
2102SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2103 int res;
2104 SwigPyObject *sobj;
2105 int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
2106
2107 if (!obj)
2108 return SWIG_ERROR;
2109 if (obj == Py_None && !implicit_conv) {
2110 if (ptr)
2111 *ptr = 0;
2113 }
2114
2115 res = SWIG_ERROR;
2116
2117 sobj = SWIG_Python_GetSwigThis(obj);
2118 if (own)
2119 *own = 0;
2120 while (sobj) {
2121 void *vptr = sobj->ptr;
2122 if (ty) {
2123 swig_type_info *to = sobj->ty;
2124 if (to == ty) {
2125 /* no type cast needed */
2126 if (ptr) *ptr = vptr;
2127 break;
2128 } else {
2129 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2130 if (!tc) {
2131 sobj = (SwigPyObject *)sobj->next;
2132 } else {
2133 if (ptr) {
2134 int newmemory = 0;
2135 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2136 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2137 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2138 if (own)
2139 *own = *own | SWIG_CAST_NEW_MEMORY;
2140 }
2141 }
2142 break;
2143 }
2144 }
2145 } else {
2146 if (ptr) *ptr = vptr;
2147 break;
2148 }
2149 }
2150 if (sobj) {
2151 if (own)
2152 *own = *own | sobj->own;
2153 if (flags & SWIG_POINTER_DISOWN) {
2154 sobj->own = 0;
2155 }
2156 res = SWIG_OK;
2157 } else {
2158 if (implicit_conv) {
2159 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2160 if (data && !data->implicitconv) {
2161 PyObject *klass = data->klass;
2162 if (klass) {
2163 PyObject *impconv;
2164 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2165 impconv = SWIG_Python_CallFunctor(klass, obj);
2166 data->implicitconv = 0;
2167 if (PyErr_Occurred()) {
2168 PyErr_Clear();
2169 impconv = 0;
2170 }
2171 if (impconv) {
2172 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2173 if (iobj) {
2174 void *vptr;
2175 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2176 if (SWIG_IsOK(res)) {
2177 if (ptr) {
2178 *ptr = vptr;
2179 /* transfer the ownership to 'ptr' */
2180 iobj->own = 0;
2181 res = SWIG_AddCast(res);
2182 res = SWIG_AddNewMask(res);
2183 } else {
2184 res = SWIG_AddCast(res);
2185 }
2186 }
2187 }
2188 Py_DECREF(impconv);
2189 }
2190 }
2191 }
2192 if (!SWIG_IsOK(res) && obj == Py_None) {
2193 if (ptr)
2194 *ptr = 0;
2195 if (PyErr_Occurred())
2196 PyErr_Clear();
2197 res = SWIG_OK;
2198 }
2199 }
2200 }
2201 return res;
2202}
2203
2204/* Convert a function ptr value */
2205
2206SWIGRUNTIME int
2207SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2208 if (!PyCFunction_Check(obj)) {
2209 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2210 } else {
2211 void *vptr = 0;
2212 swig_cast_info *tc;
2213
2214 /* here we get the method pointer for callbacks */
2215 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2216 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2217 if (desc)
2218 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2219 if (!desc)
2220 return SWIG_ERROR;
2221 tc = SWIG_TypeCheck(desc,ty);
2222 if (tc) {
2223 int newmemory = 0;
2224 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2225 assert(!newmemory); /* newmemory handling not yet implemented */
2226 } else {
2227 return SWIG_ERROR;
2228 }
2229 return SWIG_OK;
2230 }
2231}
2232
2233/* Convert a packed pointer value */
2234
2235SWIGRUNTIME int
2236SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2237 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2238 if (!to) return SWIG_ERROR;
2239 if (ty) {
2240 if (to != ty) {
2241 /* check type cast? */
2242 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2243 if (!tc) return SWIG_ERROR;
2244 }
2245 }
2246 return SWIG_OK;
2247}
2248
2249/* -----------------------------------------------------------------------------
2250 * Create a new pointer object
2251 * ----------------------------------------------------------------------------- */
2252
2253/*
2254 Create a new instance object, without calling __init__, and set the
2255 'this' attribute.
2256*/
2257
2258SWIGRUNTIME PyObject*
2260{
2261 PyObject *inst = 0;
2262 PyObject *newraw = data->newraw;
2263 if (newraw) {
2264 inst = PyObject_Call(newraw, data->newargs, NULL);
2265 if (inst) {
2266#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2267 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2268 if (dictptr != NULL) {
2269 PyObject *dict = *dictptr;
2270 if (dict == NULL) {
2271 dict = PyDict_New();
2272 *dictptr = dict;
2273 PyDict_SetItem(dict, SWIG_This(), swig_this);
2274 }
2275 }
2276#else
2277 if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
2278 Py_DECREF(inst);
2279 inst = 0;
2280 }
2281#endif
2282 }
2283 } else {
2284#if PY_VERSION_HEX >= 0x03000000
2285 PyObject *empty_args = PyTuple_New(0);
2286 if (empty_args) {
2287 PyObject *empty_kwargs = PyDict_New();
2288 if (empty_kwargs) {
2289 inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
2290 Py_DECREF(empty_kwargs);
2291 if (inst) {
2292 if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
2293 Py_DECREF(inst);
2294 inst = 0;
2295 } else {
2296 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2297 }
2298 }
2299 }
2300 Py_DECREF(empty_args);
2301 }
2302#else
2303 PyObject *dict = PyDict_New();
2304 if (dict) {
2305 PyDict_SetItem(dict, SWIG_This(), swig_this);
2306 inst = PyInstance_NewRaw(data->newargs, dict);
2307 Py_DECREF(dict);
2308 }
2309#endif
2310 }
2311 return inst;
2312}
2313
2314SWIGRUNTIME int
2315SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2316{
2317#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2318 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2319 if (dictptr != NULL) {
2320 PyObject *dict = *dictptr;
2321 if (dict == NULL) {
2322 dict = PyDict_New();
2323 *dictptr = dict;
2324 }
2325 return PyDict_SetItem(dict, SWIG_This(), swig_this);
2326 }
2327#endif
2328 return PyObject_SetAttr(inst, SWIG_This(), swig_this);
2329}
2330
2331
2332SWIGINTERN PyObject *
2334 PyObject *obj[2];
2335 if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2336 return NULL;
2337 } else {
2338 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2339 if (sthis) {
2340 SwigPyObject_append((PyObject*) sthis, obj[1]);
2341 } else {
2342 if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0)
2343 return NULL;
2344 }
2345 return SWIG_Py_Void();
2346 }
2347}
2348
2349/* Create a new pointer object */
2350
2351SWIGRUNTIME PyObject *
2352SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2353 SwigPyClientData *clientdata;
2354 PyObject * robj;
2355 int own;
2356
2357 if (!ptr)
2358 return SWIG_Py_Void();
2359
2360 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2361 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2362 if (clientdata && clientdata->pytype) {
2363 SwigPyObject *newobj;
2364 if (flags & SWIG_BUILTIN_TP_INIT) {
2365 newobj = (SwigPyObject*) self;
2366 if (newobj->ptr) {
2367 PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2368 while (newobj->next)
2369 newobj = (SwigPyObject *) newobj->next;
2370 newobj->next = next_self;
2371 newobj = (SwigPyObject *)next_self;
2372#ifdef SWIGPYTHON_BUILTIN
2373 newobj->dict = 0;
2374#endif
2375 }
2376 } else {
2377 newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2378#ifdef SWIGPYTHON_BUILTIN
2379 newobj->dict = 0;
2380#endif
2381 }
2382 if (newobj) {
2383 newobj->ptr = ptr;
2384 newobj->ty = type;
2385 newobj->own = own;
2386 newobj->next = 0;
2387 return (PyObject*) newobj;
2388 }
2389 return SWIG_Py_Void();
2390 }
2391
2392 assert(!(flags & SWIG_BUILTIN_TP_INIT));
2393
2394 robj = SwigPyObject_New(ptr, type, own);
2395 if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2396 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2397 Py_DECREF(robj);
2398 robj = inst;
2399 }
2400 return robj;
2401}
2402
2403/* Create a new packed object */
2404
2405SWIGRUNTIMEINLINE PyObject *
2406SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2407 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2408}
2409
2410/* -----------------------------------------------------------------------------*
2411 * Get type list
2412 * -----------------------------------------------------------------------------*/
2413
2414#ifdef SWIG_LINK_RUNTIME
2415void *SWIG_ReturnGlobalTypeList(void *);
2416#endif
2417
2420 static void *type_pointer = (void *)0;
2421 /* first check if module already created */
2422 if (!type_pointer) {
2423#ifdef SWIG_LINK_RUNTIME
2424 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2425#else
2426 type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2427 if (PyErr_Occurred()) {
2428 PyErr_Clear();
2429 type_pointer = (void *)0;
2430 }
2431#endif
2432 }
2433 return (swig_module_info *) type_pointer;
2434}
2435
2436SWIGRUNTIME void
2438{
2439 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2440 swig_type_info **types = swig_module->types;
2441 size_t i;
2442 for (i =0; i < swig_module->size; ++i) {
2443 swig_type_info *ty = types[i];
2444 if (ty->owndata) {
2446 if (data) SwigPyClientData_Del(data);
2447 }
2448 }
2449 Py_DECREF(SWIG_This());
2450 Swig_This_global = NULL;
2451}
2452
2453SWIGRUNTIME void
2455#if PY_VERSION_HEX >= 0x03000000
2456 /* Add a dummy module object into sys.modules */
2457 PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
2458#else
2459 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2460 PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2461#endif
2462 PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2463 if (pointer && module) {
2464 PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2465 } else {
2466 Py_XDECREF(pointer);
2467 }
2468}
2469
2470/* The python cached type query */
2471SWIGRUNTIME PyObject *
2473 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2474 return cache;
2475}
2476
2478SWIG_Python_TypeQuery(const char *type)
2479{
2480 PyObject *cache = SWIG_Python_TypeCache();
2481 PyObject *key = SWIG_Python_str_FromChar(type);
2482 PyObject *obj = PyDict_GetItem(cache, key);
2483 swig_type_info *descriptor;
2484 if (obj) {
2485 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2486 } else {
2488 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2489 if (descriptor) {
2490 obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2491 PyDict_SetItem(cache, key, obj);
2492 Py_DECREF(obj);
2493 }
2494 }
2495 Py_DECREF(key);
2496 return descriptor;
2497}
2498
2499/*
2500 For backward compatibility only
2501*/
2502#define SWIG_POINTER_EXCEPTION 0
2503#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2504#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2505
2506SWIGRUNTIME int
2507SWIG_Python_AddErrMesg(const char* mesg, int infront)
2508{
2509 if (PyErr_Occurred()) {
2510 PyObject *type = 0;
2511 PyObject *value = 0;
2512 PyObject *traceback = 0;
2513 PyErr_Fetch(&type, &value, &traceback);
2514 if (value) {
2515 PyObject *old_str = PyObject_Str(value);
2516 const char *tmp = SWIG_Python_str_AsChar(old_str);
2517 const char *errmesg = tmp ? tmp : "Invalid error message";
2518 Py_XINCREF(type);
2519 PyErr_Clear();
2520 if (infront) {
2521 PyErr_Format(type, "%s %s", mesg, errmesg);
2522 } else {
2523 PyErr_Format(type, "%s %s", errmesg, mesg);
2524 }
2526 Py_DECREF(old_str);
2527 }
2528 return 1;
2529 } else {
2530 return 0;
2531 }
2532}
2533
2534SWIGRUNTIME int
2536{
2537 if (PyErr_Occurred()) {
2538 /* add information about failing argument */
2539 char mesg[256];
2540 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2541 return SWIG_Python_AddErrMesg(mesg, 1);
2542 } else {
2543 return 0;
2544 }
2545}
2546
2547SWIGRUNTIMEINLINE const char *
2549{
2550 SwigPyObject *v = (SwigPyObject *)self;
2551 swig_type_info *ty = v ? v->ty : 0;
2552 return ty ? ty->str : "";
2553}
2554
2555SWIGRUNTIME void
2556SWIG_Python_TypeError(const char *type, PyObject *obj)
2557{
2558 if (type) {
2559#if defined(SWIG_COBJECT_TYPES)
2560 if (obj && SwigPyObject_Check(obj)) {
2561 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2562 if (otype) {
2563 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2564 type, otype);
2565 return;
2566 }
2567 } else
2568#endif
2569 {
2570 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2571 if (otype) {
2572 PyObject *str = PyObject_Str(obj);
2573 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2574 if (cstr) {
2575 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2576 type, otype, cstr);
2578 } else {
2579 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2580 type, otype);
2581 }
2582 Py_XDECREF(str);
2583 return;
2584 }
2585 }
2586 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2587 } else {
2588 PyErr_Format(PyExc_TypeError, "unexpected type is received");
2589 }
2590}
2591
2592
2593/* Convert a pointer value, signal an exception on a type mismatch */
2594SWIGRUNTIME void *
2595SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2596 void *result;
2597 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2598 PyErr_Clear();
2599#if SWIG_POINTER_EXCEPTION
2600 if (flags) {
2602 SWIG_Python_ArgFail(argnum);
2603 }
2604#endif
2605 }
2606 return result;
2607}
2608
2609#ifdef SWIGPYTHON_BUILTIN
2610SWIGRUNTIME int
2611SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2612 PyTypeObject *tp = obj->ob_type;
2613 PyObject *descr;
2614 PyObject *encoded_name;
2615 descrsetfunc f;
2616 int res = -1;
2617
2618# ifdef Py_USING_UNICODE
2619 if (PyString_Check(name)) {
2620 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2621 if (!name)
2622 return -1;
2623 } else if (!PyUnicode_Check(name))
2624# else
2625 if (!PyString_Check(name))
2626# endif
2627 {
2628 PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2629 return -1;
2630 } else {
2631 Py_INCREF(name);
2632 }
2633
2634 if (!tp->tp_dict) {
2635 if (PyType_Ready(tp) < 0)
2636 goto done;
2637 }
2638
2639 descr = _PyType_Lookup(tp, name);
2640 f = NULL;
2641 if (descr != NULL)
2642 f = descr->ob_type->tp_descr_set;
2643 if (!f) {
2644 if (PyString_Check(name)) {
2645 encoded_name = name;
2646 Py_INCREF(name);
2647 } else {
2648 encoded_name = PyUnicode_AsUTF8String(name);
2649 if (!encoded_name)
2650 return -1;
2651 }
2652 PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2653 Py_DECREF(encoded_name);
2654 } else {
2655 res = f(descr, obj, value);
2656 }
2657
2658 done:
2659 Py_DECREF(name);
2660 return res;
2661}
2662#endif
2663
2664
2665#ifdef __cplusplus
2666}
2667#endif
2668
2669
2670
2671#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2672
2673#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2674
2675
2676
2677#ifdef __cplusplus
2678extern "C" {
2679#endif
2680
2681/* Method creation and docstring support functions */
2682
2683SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
2684SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2685SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2686
2687#ifdef __cplusplus
2688}
2689#endif
2690
2691
2692 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
2693
2694/* -----------------------------------------------------------------------------
2695 * director_common.swg
2696 *
2697 * This file contains support for director classes which is common between
2698 * languages.
2699 * ----------------------------------------------------------------------------- */
2700
2701/*
2702 Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the
2703 'Swig' namespace. This could be useful for multi-modules projects.
2704*/
2705#ifdef SWIG_DIRECTOR_STATIC
2706/* Force anonymous (static) namespace */
2707#define Swig
2708#endif
2709/* -----------------------------------------------------------------------------
2710 * director.swg
2711 *
2712 * This file contains support for director classes so that Python proxy
2713 * methods can be called from C++.
2714 * ----------------------------------------------------------------------------- */
2715
2716#ifndef SWIG_DIRECTOR_PYTHON_HEADER_
2717#define SWIG_DIRECTOR_PYTHON_HEADER_
2718
2719#include <string>
2720#include <iostream>
2721#include <exception>
2722#include <vector>
2723#include <map>
2724
2725
2726/*
2727 Use -DSWIG_PYTHON_DIRECTOR_NO_VTABLE if you don't want to generate a 'virtual
2728 table', and avoid multiple GetAttr calls to retrieve the python
2729 methods.
2730*/
2731
2732#ifndef SWIG_PYTHON_DIRECTOR_NO_VTABLE
2733#ifndef SWIG_PYTHON_DIRECTOR_VTABLE
2734#define SWIG_PYTHON_DIRECTOR_VTABLE
2735#endif
2736#endif
2737
2738
2739
2740/*
2741 Use -DSWIG_DIRECTOR_NO_UEH if you prefer to avoid the use of the
2742 Undefined Exception Handler provided by swig.
2743*/
2744#ifndef SWIG_DIRECTOR_NO_UEH
2745#ifndef SWIG_DIRECTOR_UEH
2746#define SWIG_DIRECTOR_UEH
2747#endif
2748#endif
2749
2750
2751/*
2752 Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the
2753 native C++ RTTI and dynamic_cast<>. But be aware that directors
2754 could stop working when using this option.
2755*/
2756#ifdef SWIG_DIRECTOR_NORTTI
2757/*
2758 When we don't use the native C++ RTTI, we implement a minimal one
2759 only for Directors.
2760*/
2761# ifndef SWIG_DIRECTOR_RTDIR
2762# define SWIG_DIRECTOR_RTDIR
2763
2764namespace Swig {
2765 class Director;
2766 SWIGINTERN std::map<void *, Director *>& get_rtdir_map() {
2767 static std::map<void *, Director *> rtdir_map;
2768 return rtdir_map;
2769 }
2770
2771 SWIGINTERNINLINE void set_rtdir(void *vptr, Director *rtdir) {
2772 get_rtdir_map()[vptr] = rtdir;
2773 }
2774
2775 SWIGINTERNINLINE Director *get_rtdir(void *vptr) {
2776 std::map<void *, Director *>::const_iterator pos = get_rtdir_map().find(vptr);
2777 Director *rtdir = (pos != get_rtdir_map().end()) ? pos->second : 0;
2778 return rtdir;
2779 }
2780}
2781# endif /* SWIG_DIRECTOR_RTDIR */
2782
2783# define SWIG_DIRECTOR_CAST(ARG) Swig::get_rtdir(static_cast<void *>(ARG))
2784# define SWIG_DIRECTOR_RGTR(ARG1, ARG2) Swig::set_rtdir(static_cast<void *>(ARG1), ARG2)
2785
2786#else
2787
2788# define SWIG_DIRECTOR_CAST(ARG) dynamic_cast<Swig::Director *>(ARG)
2789# define SWIG_DIRECTOR_RGTR(ARG1, ARG2)
2790
2791#endif /* SWIG_DIRECTOR_NORTTI */
2792
2793extern "C" {
2794 struct swig_type_info;
2795}
2796
2797namespace Swig {
2798
2799 /* memory handler */
2800 struct GCItem {
2801 virtual ~GCItem() {}
2802
2803 virtual int get_own() const {
2804 return 0;
2805 }
2806 };
2807
2808 struct GCItem_var {
2809 GCItem_var(GCItem *item = 0) : _item(item) {
2810 }
2811
2813 GCItem *tmp = _item;
2814 _item = item;
2815 delete tmp;
2816 return *this;
2817 }
2818
2820 delete _item;
2821 }
2822
2823 GCItem * operator->() const {
2824 return _item;
2825 }
2826
2827 private:
2828 GCItem *_item;
2829 };
2830
2831 struct GCItem_Object : GCItem {
2832 GCItem_Object(int own) : _own(own) {
2833 }
2834
2835 virtual ~GCItem_Object() {
2836 }
2837
2838 int get_own() const {
2839 return _own;
2840 }
2841
2842 private:
2843 int _own;
2844 };
2845
2846 template <typename Type>
2847 struct GCItem_T : GCItem {
2848 GCItem_T(Type *ptr) : _ptr(ptr) {
2849 }
2850
2851 virtual ~GCItem_T() {
2852 delete _ptr;
2853 }
2854
2855 private:
2856 Type *_ptr;
2857 };
2858
2859 template <typename Type>
2860 struct GCArray_T : GCItem {
2861 GCArray_T(Type *ptr) : _ptr(ptr) {
2862 }
2863
2864 virtual ~GCArray_T() {
2865 delete[] _ptr;
2866 }
2867
2868 private:
2869 Type *_ptr;
2870 };
2871
2872 /* base class for director exceptions */
2873 class DirectorException : public std::exception {
2874 protected:
2875 std::string swig_msg;
2876 public:
2877 DirectorException(PyObject *error, const char *hdr ="", const char *msg ="") : swig_msg(hdr) {
2879 if (msg[0]) {
2880 swig_msg += " ";
2881 swig_msg += msg;
2882 }
2883 if (!PyErr_Occurred()) {
2884 PyErr_SetString(error, what());
2885 }
2887 }
2888
2889 virtual ~DirectorException() throw() {
2890 }
2891
2892 /* Deprecated, use what() instead */
2893 const char *getMessage() const {
2894 return what();
2895 }
2896
2897 const char *what() const throw() {
2898 return swig_msg.c_str();
2899 }
2900
2901 static void raise(PyObject *error, const char *msg) {
2902 throw DirectorException(error, msg);
2903 }
2904
2905 static void raise(const char *msg) {
2906 raise(PyExc_RuntimeError, msg);
2907 }
2908 };
2909
2910 /* type mismatch in the return value from a python method call */
2911 class DirectorTypeMismatchException : public DirectorException {
2912 public:
2913 DirectorTypeMismatchException(PyObject *error, const char *msg="")
2914 : DirectorException(error, "SWIG director type mismatch", msg) {
2915 }
2916
2918 : DirectorException(PyExc_TypeError, "SWIG director type mismatch", msg) {
2919 }
2920
2921 static void raise(PyObject *error, const char *msg) {
2922 throw DirectorTypeMismatchException(error, msg);
2923 }
2924
2925 static void raise(const char *msg) {
2927 }
2928 };
2929
2930 /* any python exception that occurs during a director method call */
2931 class DirectorMethodException : public DirectorException {
2932 public:
2933 DirectorMethodException(const char *msg = "")
2934 : DirectorException(PyExc_RuntimeError, "SWIG director method error.", msg) {
2935 }
2936
2937 static void raise(const char *msg) {
2938 throw DirectorMethodException(msg);
2939 }
2940 };
2941
2942 /* attempt to call a pure virtual method via a director method */
2943 class DirectorPureVirtualException : public DirectorException {
2944 public:
2945 DirectorPureVirtualException(const char *msg = "")
2946 : DirectorException(PyExc_RuntimeError, "SWIG director pure virtual method called", msg) {
2947 }
2948
2949 static void raise(const char *msg) {
2951 }
2952 };
2953
2954
2955#if defined(SWIG_PYTHON_THREADS)
2956/* __THREAD__ is the old macro to activate some thread support */
2957# if !defined(__THREAD__)
2958# define __THREAD__ 1
2959# endif
2960#endif
2961
2962#ifdef __THREAD__
2963# include "pythread.h"
2964 class Guard {
2965 PyThread_type_lock &mutex_;
2966
2967 public:
2968 Guard(PyThread_type_lock & mutex) : mutex_(mutex) {
2969 PyThread_acquire_lock(mutex_, WAIT_LOCK);
2970 }
2971
2973 PyThread_release_lock(mutex_);
2974 }
2975 };
2976# define SWIG_GUARD(mutex) Guard _guard(mutex)
2977#else
2978# define SWIG_GUARD(mutex)
2979#endif
2980
2981 /* director base class */
2982 class Director {
2983 private:
2984 /* pointer to the wrapped python object */
2985 PyObject *swig_self;
2986 /* flag indicating whether the object is owned by python or c++ */
2987 mutable bool swig_disown_flag;
2988
2989 /* decrement the reference count of the wrapped python object */
2990 void swig_decref() const {
2991 if (swig_disown_flag) {
2993 Py_DECREF(swig_self);
2995 }
2996 }
2997
2998 public:
2999 /* wrap a python object. */
3000 Director(PyObject *self) : swig_self(self), swig_disown_flag(false) {
3001 }
3002
3003 /* discard our reference at destruction */
3004 virtual ~Director() {
3005 swig_decref();
3006 }
3007
3008 /* return a pointer to the wrapped python object */
3009 PyObject *swig_get_self() const {
3010 return swig_self;
3011 }
3012
3013 /* acquire ownership of the wrapped python object (the sense of "disown" is from python) */
3014 void swig_disown() const {
3015 if (!swig_disown_flag) {
3016 swig_disown_flag=true;
3017 swig_incref();
3018 }
3019 }
3020
3021 /* increase the reference count of the wrapped python object */
3022 void swig_incref() const {
3023 if (swig_disown_flag) {
3024 Py_INCREF(swig_self);
3025 }
3026 }
3027
3028 /* methods to implement pseudo protected director members */
3029 virtual bool swig_get_inner(const char * /* swig_protected_method_name */) const {
3030 return true;
3031 }
3032
3033 virtual void swig_set_inner(const char * /* swig_protected_method_name */, bool /* swig_val */) const {
3034 }
3035
3036 /* ownership management */
3037 private:
3038 typedef std::map<void *, GCItem_var> swig_ownership_map;
3039 mutable swig_ownership_map swig_owner;
3040#ifdef __THREAD__
3041 static PyThread_type_lock swig_mutex_own;
3042#endif
3043
3044 public:
3045 template <typename Type>
3046 void swig_acquire_ownership_array(Type *vptr) const {
3047 if (vptr) {
3048 SWIG_GUARD(swig_mutex_own);
3049 swig_owner[vptr] = new GCArray_T<Type>(vptr);
3050 }
3051 }
3052
3053 template <typename Type>
3054 void swig_acquire_ownership(Type *vptr) const {
3055 if (vptr) {
3056 SWIG_GUARD(swig_mutex_own);
3057 swig_owner[vptr] = new GCItem_T<Type>(vptr);
3058 }
3059 }
3060
3061 void swig_acquire_ownership_obj(void *vptr, int own) const {
3062 if (vptr && own) {
3063 SWIG_GUARD(swig_mutex_own);
3064 swig_owner[vptr] = new GCItem_Object(own);
3065 }
3066 }
3067
3068 int swig_release_ownership(void *vptr) const {
3069 int own = 0;
3070 if (vptr) {
3071 SWIG_GUARD(swig_mutex_own);
3072 swig_ownership_map::iterator iter = swig_owner.find(vptr);
3073 if (iter != swig_owner.end()) {
3074 own = iter->second->get_own();
3075 swig_owner.erase(iter);
3076 }
3077 }
3078 return own;
3079 }
3080
3081 template <typename Type>
3082 static PyObject *swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args)) {
3083 SwigPyObject *sobj = (SwigPyObject *)pyobj;
3084 sobj->own = 0;
3085 Director *d = SWIG_DIRECTOR_CAST(reinterpret_cast<Type *>(sobj->ptr));
3086 if (d)
3087 d->swig_disown();
3088 return PyWeakref_NewProxy(pyobj, NULL);
3089 }
3090 };
3091
3092#ifdef __THREAD__
3093 PyThread_type_lock Director::swig_mutex_own = PyThread_allocate_lock();
3094#endif
3095}
3096
3097#endif
3098
3099/* -------- TYPES TABLE (BEGIN) -------- */
3100
3101#define SWIGTYPE_p_char swig_types[0]
3102#define SWIGTYPE_p_int swig_types[1]
3103#define SWIGTYPE_p_long swig_types[2]
3104#define SWIGTYPE_p_operations_research__Domain swig_types[3]
3105#define SWIGTYPE_p_operations_research__sat__CpSatHelper swig_types[4]
3106#define SWIGTYPE_p_operations_research__sat__IntegerVariableProto swig_types[5]
3107#define SWIGTYPE_p_operations_research__sat__SolutionCallback swig_types[6]
3108#define SWIGTYPE_p_operations_research__sat__SolveWrapper swig_types[7]
3109#define SWIGTYPE_p_short swig_types[8]
3110#define SWIGTYPE_p_signed_char swig_types[9]
3111#define SWIGTYPE_p_unsigned_char swig_types[10]
3112#define SWIGTYPE_p_unsigned_int swig_types[11]
3113#define SWIGTYPE_p_unsigned_long swig_types[12]
3114#define SWIGTYPE_p_unsigned_short swig_types[13]
3116static swig_module_info swig_module = {swig_types, 14, 0, 0, 0, 0};
3117#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
3118#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
3119
3120/* -------- TYPES TABLE (END) -------- */
3121
3122#ifdef SWIG_TypeQuery
3123# undef SWIG_TypeQuery
3124#endif
3125#define SWIG_TypeQuery SWIG_Python_TypeQuery
3126
3127/*-----------------------------------------------
3128 @(target):= _pywrapsat.so
3129 ------------------------------------------------*/
3130#if PY_VERSION_HEX >= 0x03000000
3131# define SWIG_init PyInit__pywrapsat
3132
3133#else
3134# define SWIG_init init_pywrapsat
3135
3136#endif
3137#define SWIG_name "_pywrapsat"
3138
3139#define SWIGVERSION 0x040002
3140#define SWIG_VERSION SWIGVERSION
3141
3142
3143#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
3144#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
3145
3146
3147#include <stdexcept>
3148
3149
3150namespace swig {
3151 class SwigPtr_PyObject {
3152 protected:
3153 PyObject *_obj;
3154
3155 public:
3157 {
3158 }
3159
3161 {
3163 Py_XINCREF(_obj);
3165 }
3166
3167 SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
3168 {
3169 if (initial_ref) {
3171 Py_XINCREF(_obj);
3173 }
3174 }
3175
3177 {
3179 Py_XINCREF(item._obj);
3180 Py_XDECREF(_obj);
3181 _obj = item._obj;
3183 return *this;
3184 }
3185
3187 {
3189 Py_XDECREF(_obj);
3191 }
3192
3193 operator PyObject *() const
3194 {
3195 return _obj;
3196 }
3197
3198 PyObject *operator->() const
3199 {
3200 return _obj;
3201 }
3202 };
3203}
3204
3205
3206namespace swig {
3207 struct SwigVar_PyObject : SwigPtr_PyObject {
3208 SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
3209
3211 {
3212 Py_XDECREF(_obj);
3213 _obj = obj;
3214 return *this;
3215 }
3216 };
3217}
3218
3219
3220#include <cstdint>
3221#include <string>
3222#include <vector>
3223
3225
3226
3227#include <stdint.h> // Use the C99 official header
3228
3229
3230#define SWIGWORDSIZE64
3231#ifndef LONG_MAX
3232#include <limits.h>
3233#endif
3234#if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
3235# error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
3236#endif
3237
3238
3239#include <string>
3240
3241
3242#include "ortools/base/python-swig.h"
3243
3244
3245#include <functional>
3246
3247// A copyable, ref-counted python pointer.
3248// TODO(user): Make it movable-only when we support generalized lambda
3249// capture.
3250class SharedPyPtr {
3251 public:
3252 explicit SharedPyPtr(PyObject* obj) : obj_(obj) { Py_INCREF(obj_); }
3253 SharedPyPtr(const SharedPyPtr& other) : obj_(other.obj_) { Py_INCREF(obj_); }
3254
3255 ~SharedPyPtr() { Py_DECREF(obj_); }
3256
3257 PyObject* get() const { return obj_; }
3258
3259 private:
3260 // We do not follow the rule of three as we only want to copy construct.
3261 SharedPyPtr& operator=(const SharedPyPtr&);
3262
3263 PyObject* const obj_;
3264};
3265
3266template <typename ReturnT>
3267static ReturnT HandleResult(PyObject* pyresult) {
3268 // This zero-initializes builtin types.
3269 ReturnT result = ReturnT();
3270 if (!pyresult) {
3271 if (!PyErr_Occurred()) {
3272 PyErr_SetString(PyExc_RuntimeError,
3273 "SWIG std::function invocation failed.");
3274 }
3275 return result;
3276 } else {
3277 if (!PyObjAs<ReturnT>(pyresult, &result)) {
3278 if (!PyErr_Occurred()) {
3279 PyErr_SetString(PyExc_RuntimeError,
3280 "SWIG std::function invocation failed.");
3281 }
3282 }
3283 Py_DECREF(pyresult);
3284 }
3285 return result;
3286}
3287
3288template <>
3289void HandleResult<void>(PyObject * pyresult) {
3290 if (!pyresult) {
3291 if (!PyErr_Occurred()) {
3292 PyErr_SetString(PyExc_RuntimeError,
3293 "SWIG std::function invocation failed.");
3294 }
3295 } else {
3296 Py_DECREF(pyresult);
3297 }
3298}
3299
3300template <typename ReturnT, typename... Args>
3301static ReturnT InvokePythonCallableReturning(PyObject* pyfunc,
3302 const char* format, Args... args) {
3303 // The const_cast is safe (it's here only because the python API is not
3304 // const-correct).
3305 return HandleResult<ReturnT>(
3306 PyObject_CallFunction(pyfunc, const_cast<char*>(format), args...));
3307}
3308
3309template <typename ReturnT>
3310static ReturnT InvokePythonCallableReturning(PyObject* pyfunc) {
3311 return HandleResult<ReturnT>(PyObject_CallFunctionObjArgs(pyfunc, nullptr));
3312}
3313
3314
3315
3318#include "ortools/sat/swig_helper.h"
3319
3320
3321 #define SWIG_From_long PyInt_FromLong
3322
3323
3324 #define SWIG_From_double PyFloat_FromDouble
3325
3326
3327#include <limits.h>
3328#if !defined(SWIG_NO_LLONG_MAX)
3329# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
3330# define LLONG_MAX __LONG_LONG_MAX__
3331# define LLONG_MIN (-LLONG_MAX - 1LL)
3332# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
3333# endif
3334#endif
3335
3336
3337SWIGINTERN int
3338SWIG_AsVal_double (PyObject *obj, double *val)
3339{
3340 int res = SWIG_TypeError;
3341 if (PyFloat_Check(obj)) {
3342 if (val) *val = PyFloat_AsDouble(obj);
3343 return SWIG_OK;
3344#if PY_VERSION_HEX < 0x03000000
3345 } else if (PyInt_Check(obj)) {
3346 if (val) *val = (double) PyInt_AsLong(obj);
3347 return SWIG_OK;
3348#endif
3349 } else if (PyLong_Check(obj)) {
3350 double v = PyLong_AsDouble(obj);
3351 if (!PyErr_Occurred()) {
3352 if (val) *val = v;
3353 return SWIG_OK;
3354 } else {
3355 PyErr_Clear();
3356 }
3357 }
3358#ifdef SWIG_PYTHON_CAST_MODE
3359 {
3360 int dispatch = 0;
3361 double d = PyFloat_AsDouble(obj);
3362 if (!PyErr_Occurred()) {
3363 if (val) *val = d;
3364 return SWIG_AddCast(SWIG_OK);
3365 } else {
3366 PyErr_Clear();
3367 }
3368 if (!dispatch) {
3369 long v = PyLong_AsLong(obj);
3370 if (!PyErr_Occurred()) {
3371 if (val) *val = v;
3373 } else {
3374 PyErr_Clear();
3375 }
3376 }
3377 }
3378#endif
3379 return res;
3380}
3381
3382
3383#include <float.h>
3384
3385
3386#include <math.h>
3387
3388
3390SWIG_CanCastAsInteger(double *d, double min, double max) {
3391 double x = *d;
3392 if ((min <= x && x <= max)) {
3393 double fx = floor(x);
3394 double cx = ceil(x);
3395 double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
3396 if ((errno == EDOM) || (errno == ERANGE)) {
3397 errno = 0;
3398 } else {
3399 double summ, reps, diff;
3400 if (rd < x) {
3401 diff = x - rd;
3402 } else if (rd > x) {
3403 diff = rd - x;
3404 } else {
3405 return 1;
3406 }
3407 summ = rd + x;
3408 reps = diff/summ;
3409 if (reps < 8*DBL_EPSILON) {
3410 *d = rd;
3411 return 1;
3412 }
3413 }
3414 }
3415 return 0;
3416}
3417
3418
3419SWIGINTERN int
3420SWIG_AsVal_long (PyObject *obj, long* val)
3421{
3422#if PY_VERSION_HEX < 0x03000000
3423 if (PyInt_Check(obj)) {
3424 if (val) *val = PyInt_AsLong(obj);
3425 return SWIG_OK;
3426 } else
3427#endif
3428 if (PyLong_Check(obj)) {
3429 long v = PyLong_AsLong(obj);
3430 if (!PyErr_Occurred()) {
3431 if (val) *val = v;
3432 return SWIG_OK;
3433 } else {
3434 PyErr_Clear();
3435 return SWIG_OverflowError;
3436 }
3437 }
3438#ifdef SWIG_PYTHON_CAST_MODE
3439 {
3440 int dispatch = 0;
3441 long v = PyInt_AsLong(obj);
3442 if (!PyErr_Occurred()) {
3443 if (val) *val = v;
3444 return SWIG_AddCast(SWIG_OK);
3445 } else {
3446 PyErr_Clear();
3447 }
3448 if (!dispatch) {
3449 double d;
3450 int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3451 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
3452 if (val) *val = (long)(d);
3453 return res;
3454 }
3455 }
3456 }
3457#endif
3458 return SWIG_TypeError;
3459}
3460
3461
3462SWIGINTERN int
3463SWIG_AsVal_int (PyObject * obj, int *val)
3464{
3465 long v;
3466 int res = SWIG_AsVal_long (obj, &v);
3467 if (SWIG_IsOK(res)) {
3468 if ((v < INT_MIN || v > INT_MAX)) {
3469 return SWIG_OverflowError;
3470 } else {
3471 if (val) *val = static_cast< int >(v);
3472 }
3473 }
3474 return res;
3475}
3476
3477
3478SWIGINTERNINLINE PyObject*
3480{
3481 return PyBool_FromLong(value ? 1 : 0);
3482}
3483
3484
3487{
3488 static int init = 0;
3489 static swig_type_info* info = 0;
3490 if (!init) {
3491 info = SWIG_TypeQuery("_p_char");
3492 init = 1;
3493 }
3494 return info;
3495}
3496
3497
3498SWIGINTERNINLINE PyObject *
3499SWIG_FromCharPtrAndSize(const char* carray, size_t size)
3500{
3501 if (carray) {
3502 if (size > INT_MAX) {
3503 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3504 return pchar_descriptor ?
3505 SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
3506 } else {
3507#if PY_VERSION_HEX >= 0x03000000
3508#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3509 return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
3510#else
3511 return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape");
3512#endif
3513#else
3514 return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
3515#endif
3516 }
3517 } else {
3518 return SWIG_Py_Void();
3519 }
3520}
3521
3522
3523SWIGINTERNINLINE PyObject *
3524SWIG_From_std_string (const std::string& s)
3525{
3526 return SWIG_FromCharPtrAndSize(s.data(), s.size());
3527}
3528
3529
3530SWIGINTERN int
3531SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
3532{
3533#if PY_VERSION_HEX>=0x03000000
3534#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3535 if (PyBytes_Check(obj))
3536#else
3537 if (PyUnicode_Check(obj))
3538#endif
3539#else
3540 if (PyString_Check(obj))
3541#endif
3542 {
3543 char *cstr; Py_ssize_t len;
3544 int ret = SWIG_OK;
3545#if PY_VERSION_HEX>=0x03000000
3546#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3547 if (!alloc && cptr) {
3548 /* We can't allow converting without allocation, since the internal
3549 representation of string in Python 3 is UCS-2/UCS-4 but we require
3550 a UTF-8 representation.
3551 TODO(bhy) More detailed explanation */
3552 return SWIG_RuntimeError;
3553 }
3554 obj = PyUnicode_AsUTF8String(obj);
3555 if (!obj)
3556 return SWIG_TypeError;
3557 if (alloc)
3558 *alloc = SWIG_NEWOBJ;
3559#endif
3560 if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
3561 return SWIG_TypeError;
3562#else
3563 if (PyString_AsStringAndSize(obj, &cstr, &len) == -1)
3564 return SWIG_TypeError;
3565#endif
3566 if (cptr) {
3567 if (alloc) {
3568 if (*alloc == SWIG_NEWOBJ) {
3569 *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
3570 *alloc = SWIG_NEWOBJ;
3571 } else {
3572 *cptr = cstr;
3573 *alloc = SWIG_OLDOBJ;
3574 }
3575 } else {
3576#if PY_VERSION_HEX>=0x03000000
3577#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3578 *cptr = PyBytes_AsString(obj);
3579#else
3580 assert(0); /* Should never reach here with Unicode strings in Python 3 */
3581#endif
3582#else
3583 *cptr = SWIG_Python_str_AsChar(obj);
3584 if (!*cptr)
3585 ret = SWIG_TypeError;
3586#endif
3587 }
3588 }
3589 if (psize) *psize = len + 1;
3590#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3591 Py_XDECREF(obj);
3592#endif
3593 return ret;
3594 } else {
3595#if defined(SWIG_PYTHON_2_UNICODE)
3596#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3597#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
3598#endif
3599#if PY_VERSION_HEX<0x03000000
3600 if (PyUnicode_Check(obj)) {
3601 char *cstr; Py_ssize_t len;
3602 if (!alloc && cptr) {
3603 return SWIG_RuntimeError;
3604 }
3605 obj = PyUnicode_AsUTF8String(obj);
3606 if (!obj)
3607 return SWIG_TypeError;
3608 if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
3609 if (cptr) {
3610 if (alloc) *alloc = SWIG_NEWOBJ;
3611 *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
3612 }
3613 if (psize) *psize = len + 1;
3614
3615 Py_XDECREF(obj);
3616 return SWIG_OK;
3617 } else {
3618 Py_XDECREF(obj);
3619 }
3620 }
3621#endif
3622#endif
3623
3624 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3625 if (pchar_descriptor) {
3626 void* vptr = 0;
3627 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
3628 if (cptr) *cptr = (char *) vptr;
3629 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
3630 if (alloc) *alloc = SWIG_OLDOBJ;
3631 return SWIG_OK;
3632 }
3633 }
3634 }
3635 return SWIG_TypeError;
3636}
3637
3638
3639SWIGINTERN int
3640SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
3641{
3642 char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
3643 if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
3644 if (buf) {
3645 if (val) *val = new std::string(buf, size - 1);
3646 if (alloc == SWIG_NEWOBJ) delete[] buf;
3647 return SWIG_NEWOBJ;
3648 } else {
3649 if (val) *val = 0;
3650 return SWIG_OLDOBJ;
3651 }
3652 } else {
3653 static int init = 0;
3654 static swig_type_info* descriptor = 0;
3655 if (!init) {
3656 descriptor = SWIG_TypeQuery("std::string" " *");
3657 init = 1;
3658 }
3659 if (descriptor) {
3660 std::string *vptr;
3661 int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
3662 if (SWIG_IsOK(res) && val) *val = vptr;
3663 return res;
3664 }
3665 }
3666 return SWIG_ERROR;
3667}
3668
3669
3670
3671/* ---------------------------------------------------
3672 * C++ director class methods
3673 * --------------------------------------------------- */
3674
3675#include "sat_python_wrap.h"
3676
3677SwigDirector_SolutionCallback::SwigDirector_SolutionCallback(PyObject *self): operations_research::sat::SolutionCallback(), Swig::Director(self) {
3678 SWIG_DIRECTOR_RGTR((operations_research::sat::SolutionCallback *)this, this);
3679}
3680
3681
3682
3683
3685}
3686
3689 {
3690 if (!swig_get_self()) {
3691 Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call SolutionCallback.__init__.");
3692 }
3693#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
3694 const size_t swig_method_index = 0;
3695 const char *const swig_method_name = "OnSolutionCallback";
3696 PyObject *method = swig_get_method(swig_method_index, swig_method_name);
3697 swig::SwigVar_PyObject args = PyTuple_New(0);
3698 swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
3699#else
3700 swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("OnSolutionCallback");
3701 swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
3702#endif
3703 if (!result) {
3704 PyObject *error = PyErr_Occurred();
3705 if (error) {
3706 Swig::DirectorMethodException::raise("Error detected when calling 'SolutionCallback.OnSolutionCallback'");
3707 }
3708 }
3709 }
3711}
3712
3713
3714#ifdef __cplusplus
3715extern "C" {
3716#endif
3717SWIGINTERN PyObject *_wrap_delete_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3718 PyObject *resultobj = 0;
3719 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3720 void *argp1 = 0 ;
3721 int res1 = 0 ;
3722 PyObject *swig_obj[1] ;
3723
3724 if (!args) SWIG_fail;
3725 swig_obj[0] = args;
3727 if (!SWIG_IsOK(res1)) {
3728 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
3729 }
3730 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3731 {
3733 delete arg1;
3735 }
3736 resultobj = SWIG_Py_Void();
3737 return resultobj;
3738fail:
3739 return NULL;
3740}
3741
3742
3743SWIGINTERN PyObject *_wrap_SolutionCallback_OnSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3744 PyObject *resultobj = 0;
3745 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3746 void *argp1 = 0 ;
3747 int res1 = 0 ;
3748 PyObject *swig_obj[1] ;
3749 Swig::Director *director = 0;
3750 bool upcall = false;
3751
3752 if (!args) SWIG_fail;
3753 swig_obj[0] = args;
3755 if (!SWIG_IsOK(res1)) {
3756 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_OnSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3757 }
3758 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3759 director = SWIG_DIRECTOR_CAST(arg1);
3760 upcall = (director && (director->swig_get_self()==swig_obj[0]));
3761 try {
3762 if (upcall) {
3763 Swig::DirectorPureVirtualException::raise("operations_research::sat::SolutionCallback::OnSolutionCallback");
3764 } else {
3765 ((operations_research::sat::SolutionCallback const *)arg1)->OnSolutionCallback();
3766 }
3767 } catch (Swig::DirectorException&) {
3768 SWIG_fail;
3769 }
3770 resultobj = SWIG_Py_Void();
3771 return resultobj;
3772fail:
3773 return NULL;
3774}
3775
3776
3777SWIGINTERN PyObject *_wrap_SolutionCallback_NumBooleans(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3778 PyObject *resultobj = 0;
3779 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3780 void *argp1 = 0 ;
3781 int res1 = 0 ;
3782 PyObject *swig_obj[1] ;
3783 int64_t result;
3784
3785 if (!args) SWIG_fail;
3786 swig_obj[0] = args;
3788 if (!SWIG_IsOK(res1)) {
3789 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumBooleans" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3790 }
3791 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3792 {
3794 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumBooleans();
3796 }
3797 resultobj = SWIG_From_long(static_cast< long >(result));
3798 return resultobj;
3799fail:
3800 return NULL;
3801}
3802
3803
3804SWIGINTERN PyObject *_wrap_SolutionCallback_NumBranches(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3805 PyObject *resultobj = 0;
3806 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3807 void *argp1 = 0 ;
3808 int res1 = 0 ;
3809 PyObject *swig_obj[1] ;
3810 int64_t result;
3811
3812 if (!args) SWIG_fail;
3813 swig_obj[0] = args;
3815 if (!SWIG_IsOK(res1)) {
3816 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumBranches" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3817 }
3818 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3819 {
3821 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumBranches();
3823 }
3824 resultobj = SWIG_From_long(static_cast< long >(result));
3825 return resultobj;
3826fail:
3827 return NULL;
3828}
3829
3830
3831SWIGINTERN PyObject *_wrap_SolutionCallback_NumConflicts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3832 PyObject *resultobj = 0;
3833 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3834 void *argp1 = 0 ;
3835 int res1 = 0 ;
3836 PyObject *swig_obj[1] ;
3837 int64_t result;
3838
3839 if (!args) SWIG_fail;
3840 swig_obj[0] = args;
3842 if (!SWIG_IsOK(res1)) {
3843 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumConflicts" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3844 }
3845 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3846 {
3848 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumConflicts();
3850 }
3851 resultobj = SWIG_From_long(static_cast< long >(result));
3852 return resultobj;
3853fail:
3854 return NULL;
3855}
3856
3857
3859 PyObject *resultobj = 0;
3860 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3861 void *argp1 = 0 ;
3862 int res1 = 0 ;
3863 PyObject *swig_obj[1] ;
3864 int64_t result;
3865
3866 if (!args) SWIG_fail;
3867 swig_obj[0] = args;
3869 if (!SWIG_IsOK(res1)) {
3870 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumBinaryPropagations" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3871 }
3872 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3873 {
3875 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumBinaryPropagations();
3877 }
3878 resultobj = SWIG_From_long(static_cast< long >(result));
3879 return resultobj;
3880fail:
3881 return NULL;
3882}
3883
3884
3886 PyObject *resultobj = 0;
3887 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3888 void *argp1 = 0 ;
3889 int res1 = 0 ;
3890 PyObject *swig_obj[1] ;
3891 int64_t result;
3892
3893 if (!args) SWIG_fail;
3894 swig_obj[0] = args;
3896 if (!SWIG_IsOK(res1)) {
3897 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumIntegerPropagations" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3898 }
3899 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3900 {
3902 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumIntegerPropagations();
3904 }
3905 resultobj = SWIG_From_long(static_cast< long >(result));
3906 return resultobj;
3907fail:
3908 return NULL;
3909}
3910
3911
3912SWIGINTERN PyObject *_wrap_SolutionCallback_WallTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3913 PyObject *resultobj = 0;
3914 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3915 void *argp1 = 0 ;
3916 int res1 = 0 ;
3917 PyObject *swig_obj[1] ;
3918 double result;
3919
3920 if (!args) SWIG_fail;
3921 swig_obj[0] = args;
3923 if (!SWIG_IsOK(res1)) {
3924 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_WallTime" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3925 }
3926 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3927 {
3929 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->WallTime();
3931 }
3932 resultobj = SWIG_From_double(static_cast< double >(result));
3933 return resultobj;
3934fail:
3935 return NULL;
3936}
3937
3938
3939SWIGINTERN PyObject *_wrap_SolutionCallback_UserTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3940 PyObject *resultobj = 0;
3941 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3942 void *argp1 = 0 ;
3943 int res1 = 0 ;
3944 PyObject *swig_obj[1] ;
3945 double result;
3946
3947 if (!args) SWIG_fail;
3948 swig_obj[0] = args;
3950 if (!SWIG_IsOK(res1)) {
3951 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_UserTime" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3952 }
3953 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3954 {
3956 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->UserTime();
3958 }
3959 resultobj = SWIG_From_double(static_cast< double >(result));
3960 return resultobj;
3961fail:
3962 return NULL;
3963}
3964
3965
3966SWIGINTERN PyObject *_wrap_SolutionCallback_ObjectiveValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3967 PyObject *resultobj = 0;
3968 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3969 void *argp1 = 0 ;
3970 int res1 = 0 ;
3971 PyObject *swig_obj[1] ;
3972 double result;
3973
3974 if (!args) SWIG_fail;
3975 swig_obj[0] = args;
3977 if (!SWIG_IsOK(res1)) {
3978 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_ObjectiveValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3979 }
3980 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3981 {
3983 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->ObjectiveValue();
3985 }
3986 resultobj = SWIG_From_double(static_cast< double >(result));
3987 return resultobj;
3988fail:
3989 return NULL;
3990}
3991
3992
3993SWIGINTERN PyObject *_wrap_SolutionCallback_BestObjectiveBound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3994 PyObject *resultobj = 0;
3995 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3996 void *argp1 = 0 ;
3997 int res1 = 0 ;
3998 PyObject *swig_obj[1] ;
3999 double result;
4000
4001 if (!args) SWIG_fail;
4002 swig_obj[0] = args;
4004 if (!SWIG_IsOK(res1)) {
4005 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_BestObjectiveBound" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4006 }
4007 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4008 {
4010 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->BestObjectiveBound();
4012 }
4013 resultobj = SWIG_From_double(static_cast< double >(result));
4014 return resultobj;
4015fail:
4016 return NULL;
4017}
4018
4019
4021 PyObject *resultobj = 0;
4022 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4023 int arg2 ;
4024 void *argp1 = 0 ;
4025 int res1 = 0 ;
4026 int val2 ;
4027 int ecode2 = 0 ;
4028 PyObject *swig_obj[2] ;
4029 int64_t result;
4030
4031 if (!SWIG_Python_UnpackTuple(args, "SolutionCallback_SolutionIntegerValue", 2, 2, swig_obj)) SWIG_fail;
4033 if (!SWIG_IsOK(res1)) {
4034 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_SolutionIntegerValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4035 }
4036 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4037 ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
4038 if (!SWIG_IsOK(ecode2)) {
4039 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SolutionCallback_SolutionIntegerValue" "', argument " "2"" of type '" "int""'");
4040 }
4041 arg2 = static_cast< int >(val2);
4042 {
4044 result = (int64_t)(arg1)->SolutionIntegerValue(arg2);
4046 }
4047 resultobj = SWIG_From_long(static_cast< long >(result));
4048 return resultobj;
4049fail:
4050 return NULL;
4051}
4052
4053
4055 PyObject *resultobj = 0;
4056 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4057 int arg2 ;
4058 void *argp1 = 0 ;
4059 int res1 = 0 ;
4060 int val2 ;
4061 int ecode2 = 0 ;
4062 PyObject *swig_obj[2] ;
4063 bool result;
4064
4065 if (!SWIG_Python_UnpackTuple(args, "SolutionCallback_SolutionBooleanValue", 2, 2, swig_obj)) SWIG_fail;
4067 if (!SWIG_IsOK(res1)) {
4068 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_SolutionBooleanValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4069 }
4070 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4071 ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
4072 if (!SWIG_IsOK(ecode2)) {
4073 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SolutionCallback_SolutionBooleanValue" "', argument " "2"" of type '" "int""'");
4074 }
4075 arg2 = static_cast< int >(val2);
4076 {
4078 result = (bool)(arg1)->SolutionBooleanValue(arg2);
4080 }
4081 resultobj = SWIG_From_bool(static_cast< bool >(result));
4082 return resultobj;
4083fail:
4084 return NULL;
4085}
4086
4087
4088SWIGINTERN PyObject *_wrap_SolutionCallback_StopSearch(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4089 PyObject *resultobj = 0;
4090 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4091 void *argp1 = 0 ;
4092 int res1 = 0 ;
4093 PyObject *swig_obj[1] ;
4094
4095 if (!args) SWIG_fail;
4096 swig_obj[0] = args;
4098 if (!SWIG_IsOK(res1)) {
4099 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_StopSearch" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4100 }
4101 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4102 {
4104 (arg1)->StopSearch();
4106 }
4107 resultobj = SWIG_Py_Void();
4108 return resultobj;
4109fail:
4110 return NULL;
4111}
4112
4113
4114SWIGINTERN PyObject *_wrap_SolutionCallback_Response(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4115 PyObject *resultobj = 0;
4116 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4117 void *argp1 = 0 ;
4118 int res1 = 0 ;
4119 PyObject *swig_obj[1] ;
4121
4122 if (!args) SWIG_fail;
4123 swig_obj[0] = args;
4125 if (!SWIG_IsOK(res1)) {
4126 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_Response" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4127 }
4128 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4129 {
4131 result = ((operations_research::sat::SolutionCallback const *)arg1)->Response();
4133 }
4134 {
4135 PyObject* const module = PyImport_ImportModule("ortools.sat.cp_model_pb2");
4136 if (module != nullptr) {
4137 PyObject* const dict = PyModule_GetDict(module);
4138 if (dict != nullptr) {
4139 PyObject* const clss = PyDict_GetItemString(dict, "CpSolverResponse");
4140 if (clss != nullptr) {
4141 std::string encoded_protobuf;
4142 (&result)->SerializeToString(&encoded_protobuf);
4143
4144 PyObject* const python_encoded_protobuf = PyBytes_FromStringAndSize(
4145 encoded_protobuf.c_str(), encoded_protobuf.size());
4146
4147
4148
4149
4150 PyObject* const result = PyObject_CallMethod(
4151 clss, const_cast<char*>("FromString"),
4152 const_cast<char*>("(O)"),
4153 python_encoded_protobuf);
4154 Py_DECREF(python_encoded_protobuf);
4155 resultobj = result;
4156 }
4157 }
4158 Py_DECREF(module);
4159 }
4160 }
4161 return resultobj;
4162fail:
4163 return NULL;
4164}
4165
4166
4167SWIGINTERN PyObject *_wrap_SolutionCallback_HasResponse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4168 PyObject *resultobj = 0;
4169 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4170 void *argp1 = 0 ;
4171 int res1 = 0 ;
4172 PyObject *swig_obj[1] ;
4173 bool result;
4174
4175 if (!args) SWIG_fail;
4176 swig_obj[0] = args;
4178 if (!SWIG_IsOK(res1)) {
4179 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_HasResponse" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4180 }
4181 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4182 {
4184 result = (bool)((operations_research::sat::SolutionCallback const *)arg1)->HasResponse();
4186 }
4187 resultobj = SWIG_From_bool(static_cast< bool >(result));
4188 return resultobj;
4189fail:
4190 return NULL;
4191}
4192
4193
4194SWIGINTERN PyObject *_wrap_new_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4195 PyObject *resultobj = 0;
4196 PyObject *arg1 = (PyObject *) 0 ;
4197 PyObject *swig_obj[1] ;
4198 operations_research::sat::SolutionCallback *result = 0 ;
4199
4200 if (!args) SWIG_fail;
4201 swig_obj[0] = args;
4202 arg1 = swig_obj[0];
4203 {
4205 if ( arg1 != Py_None ) {
4206 /* subclassed */
4207 result = (operations_research::sat::SolutionCallback *)new SwigDirector_SolutionCallback(arg1);
4208 } else {
4209 SWIG_SetErrorMsg(PyExc_RuntimeError,"accessing abstract class or protected constructor");
4210 SWIG_fail;
4211 }
4212
4214 }
4216 return resultobj;
4217fail:
4218 return NULL;
4219}
4220
4221
4222SWIGINTERN PyObject *_wrap_disown_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4223 PyObject *resultobj = 0;
4224 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4225 void *argp1 = 0 ;
4226 int res1 = 0 ;
4227 PyObject *swig_obj[1] ;
4228
4229 if (!args) SWIG_fail;
4230 swig_obj[0] = args;
4232 if (!SWIG_IsOK(res1)) {
4233 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "disown_SolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4234 }
4235 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4236 {
4238 {
4239 Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
4240 if (director) director->swig_disown();
4241 }
4242
4244 }
4245 resultobj = SWIG_Py_Void();
4246 return resultobj;
4247fail:
4248 return NULL;
4249}
4250
4251
4252SWIGINTERN PyObject *SolutionCallback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4253 PyObject *obj;
4254 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
4256 return SWIG_Py_Void();
4257}
4258
4259SWIGINTERN PyObject *SolutionCallback_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4260 return SWIG_Python_InitShadowInstance(args);
4261}
4262
4263SWIGINTERN PyObject *_wrap_SolveWrapper_SetParameters(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4264 PyObject *resultobj = 0;
4265 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4267 void *argp1 = 0 ;
4268 int res1 = 0 ;
4269 PyObject *swig_obj[2] ;
4270
4271 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_SetParameters", 2, 2, swig_obj)) SWIG_fail;
4272 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4273 if (!SWIG_IsOK(res1)) {
4274 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_SetParameters" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4275 }
4276 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4277 {
4279 PyObject* const pyresult = PyObject_CallMethod(
4280 swig_obj[1], const_cast<char*>("SerializeToString"), nullptr);
4281 if (pyresult != nullptr) {
4282 char* buffer = nullptr;
4283 Py_ssize_t length = 0;
4284 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4285 if (buffer != nullptr) {
4286 arg2->ParseFromArray(buffer, length);
4287 }
4288 Py_DECREF(pyresult);
4289 }
4290 }
4291 {
4293 (arg1)->SetParameters((operations_research::sat::SatParameters const &)*arg2);
4295 }
4296 resultobj = SWIG_Py_Void();
4297 {
4298 delete arg2;
4299 }
4300 return resultobj;
4301fail:
4302 {
4303 delete arg2;
4304 }
4305 return NULL;
4306}
4307
4308
4309SWIGINTERN PyObject *_wrap_SolveWrapper_AddSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4310 PyObject *resultobj = 0;
4311 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4312 operations_research::sat::SolutionCallback *arg2 = 0 ;
4313 void *argp1 = 0 ;
4314 int res1 = 0 ;
4315 void *argp2 = 0 ;
4316 int res2 = 0 ;
4317 PyObject *swig_obj[2] ;
4318
4319 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_AddSolutionCallback", 2, 2, swig_obj)) SWIG_fail;
4320 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4321 if (!SWIG_IsOK(res1)) {
4322 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_AddSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4323 }
4324 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4326 if (!SWIG_IsOK(res2)) {
4327 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SolveWrapper_AddSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4328 }
4329 if (!argp2) {
4330 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SolveWrapper_AddSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4331 }
4332 arg2 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp2);
4333 {
4335 (arg1)->AddSolutionCallback((operations_research::sat::SolutionCallback const &)*arg2);
4337 }
4338 resultobj = SWIG_Py_Void();
4339 return resultobj;
4340fail:
4341 return NULL;
4342}
4343
4344
4345SWIGINTERN PyObject *_wrap_SolveWrapper_ClearSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4346 PyObject *resultobj = 0;
4347 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4348 operations_research::sat::SolutionCallback *arg2 = 0 ;
4349 void *argp1 = 0 ;
4350 int res1 = 0 ;
4351 void *argp2 = 0 ;
4352 int res2 = 0 ;
4353 PyObject *swig_obj[2] ;
4354
4355 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_ClearSolutionCallback", 2, 2, swig_obj)) SWIG_fail;
4356 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4357 if (!SWIG_IsOK(res1)) {
4358 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_ClearSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4359 }
4360 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4362 if (!SWIG_IsOK(res2)) {
4363 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SolveWrapper_ClearSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4364 }
4365 if (!argp2) {
4366 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SolveWrapper_ClearSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4367 }
4368 arg2 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp2);
4369 {
4371 (arg1)->ClearSolutionCallback((operations_research::sat::SolutionCallback const &)*arg2);
4373 }
4374 resultobj = SWIG_Py_Void();
4375 return resultobj;
4376fail:
4377 return NULL;
4378}
4379
4380
4381SWIGINTERN PyObject *_wrap_SolveWrapper_AddLogCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4382 PyObject *resultobj = 0;
4383 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4384 SwigValueWrapper< std::function< void (std::string const &) > > arg2 ;
4385 void *argp1 = 0 ;
4386 int res1 = 0 ;
4387 PyObject *swig_obj[2] ;
4388
4389 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_AddLogCallback", 2, 2, swig_obj)) SWIG_fail;
4390 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4391 if (!SWIG_IsOK(res1)) {
4392 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_AddLogCallback" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4393 }
4394 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4395 {
4396 SharedPyPtr input(swig_obj[1]);
4397 arg2 = [input](const std::string& str) {
4398 PyObject* py_str = PyUnicode_FromStringAndSize(str.c_str(), str.size());
4399 PyObject* result;
4401 result = PyObject_CallFunction(input.get(), "O", py_str);
4403 Py_DECREF(py_str);
4404 return result;
4405 };
4406 }
4407 {
4409 (arg1)->AddLogCallback(arg2);
4411 }
4412 resultobj = SWIG_Py_Void();
4413 return resultobj;
4414fail:
4415 return NULL;
4416}
4417
4418
4419SWIGINTERN PyObject *_wrap_SolveWrapper_Solve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4420 PyObject *resultobj = 0;
4421 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4423 void *argp1 = 0 ;
4424 int res1 = 0 ;
4425 PyObject *swig_obj[2] ;
4427
4428 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_Solve", 2, 2, swig_obj)) SWIG_fail;
4429 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4430 if (!SWIG_IsOK(res1)) {
4431 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_Solve" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4432 }
4433 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4434 {
4436 PyObject* const pyresult = PyObject_CallMethod(
4437 swig_obj[1], const_cast<char*>("SerializeToString"), nullptr);
4438 if (pyresult != nullptr) {
4439 char* buffer = nullptr;
4440 Py_ssize_t length = 0;
4441 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4442 if (buffer != nullptr) {
4443 arg2->ParseFromArray(buffer, length);
4444 }
4445 Py_DECREF(pyresult);
4446 }
4447 }
4448 {
4450 result = (arg1)->Solve((operations_research::sat::CpModelProto const &)*arg2);
4452 }
4453 {
4454 PyObject* const module = PyImport_ImportModule("ortools.sat.cp_model_pb2");
4455 if (module != nullptr) {
4456 PyObject* const dict = PyModule_GetDict(module);
4457 if (dict != nullptr) {
4458 PyObject* const clss = PyDict_GetItemString(dict, "CpSolverResponse");
4459 if (clss != nullptr) {
4460 std::string encoded_protobuf;
4461 (&result)->SerializeToString(&encoded_protobuf);
4462
4463 PyObject* const python_encoded_protobuf = PyBytes_FromStringAndSize(
4464 encoded_protobuf.c_str(), encoded_protobuf.size());
4465
4466
4467
4468
4469 PyObject* const result = PyObject_CallMethod(
4470 clss, const_cast<char*>("FromString"),
4471 const_cast<char*>("(O)"),
4472 python_encoded_protobuf);
4473 Py_DECREF(python_encoded_protobuf);
4474 resultobj = result;
4475 }
4476 }
4477 Py_DECREF(module);
4478 }
4479 }
4480 {
4481 delete arg2;
4482 }
4483 return resultobj;
4484fail:
4485 {
4486 delete arg2;
4487 }
4488 return NULL;
4489}
4490
4491
4492SWIGINTERN PyObject *_wrap_SolveWrapper_StopSearch(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4493 PyObject *resultobj = 0;
4494 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4495 void *argp1 = 0 ;
4496 int res1 = 0 ;
4497 PyObject *swig_obj[1] ;
4498
4499 if (!args) SWIG_fail;
4500 swig_obj[0] = args;
4501 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4502 if (!SWIG_IsOK(res1)) {
4503 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_StopSearch" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4504 }
4505 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4506 {
4508 (arg1)->StopSearch();
4510 }
4511 resultobj = SWIG_Py_Void();
4512 return resultobj;
4513fail:
4514 return NULL;
4515}
4516
4517
4518SWIGINTERN PyObject *_wrap_new_SolveWrapper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4519 PyObject *resultobj = 0;
4520 operations_research::sat::SolveWrapper *result = 0 ;
4521
4522 if (!SWIG_Python_UnpackTuple(args, "new_SolveWrapper", 0, 0, 0)) SWIG_fail;
4523 {
4525 result = (operations_research::sat::SolveWrapper *)new operations_research::sat::SolveWrapper();
4527 }
4529 return resultobj;
4530fail:
4531 return NULL;
4532}
4533
4534
4535SWIGINTERN PyObject *_wrap_delete_SolveWrapper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4536 PyObject *resultobj = 0;
4537 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4538 void *argp1 = 0 ;
4539 int res1 = 0 ;
4540 PyObject *swig_obj[1] ;
4541
4542 if (!args) SWIG_fail;
4543 swig_obj[0] = args;
4545 if (!SWIG_IsOK(res1)) {
4546 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SolveWrapper" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4547 }
4548 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4549 {
4551 delete arg1;
4553 }
4554 resultobj = SWIG_Py_Void();
4555 return resultobj;
4556fail:
4557 return NULL;
4558}
4559
4560
4561SWIGINTERN PyObject *SolveWrapper_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4562 PyObject *obj;
4563 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
4565 return SWIG_Py_Void();
4566}
4567
4568SWIGINTERN PyObject *SolveWrapper_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4569 return SWIG_Python_InitShadowInstance(args);
4570}
4571
4572SWIGINTERN PyObject *_wrap_CpSatHelper_ModelStats(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4573 PyObject *resultobj = 0;
4575 PyObject *swig_obj[1] ;
4576 std::string result;
4577
4578 if (!args) SWIG_fail;
4579 swig_obj[0] = args;
4580 {
4582 PyObject* const pyresult = PyObject_CallMethod(
4583 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4584 if (pyresult != nullptr) {
4585 char* buffer = nullptr;
4586 Py_ssize_t length = 0;
4587 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4588 if (buffer != nullptr) {
4589 arg1->ParseFromArray(buffer, length);
4590 }
4591 Py_DECREF(pyresult);
4592 }
4593 }
4594 {
4596 result = operations_research::sat::CpSatHelper::ModelStats((operations_research::sat::CpModelProto const &)*arg1);
4598 }
4599 resultobj = SWIG_From_std_string(static_cast< std::string >(result));
4600 {
4601 delete arg1;
4602 }
4603 return resultobj;
4604fail:
4605 {
4606 delete arg1;
4607 }
4608 return NULL;
4609}
4610
4611
4612SWIGINTERN PyObject *_wrap_CpSatHelper_SolverResponseStats(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4613 PyObject *resultobj = 0;
4615 PyObject *swig_obj[1] ;
4616 std::string result;
4617
4618 if (!args) SWIG_fail;
4619 swig_obj[0] = args;
4620 {
4622 PyObject* const pyresult = PyObject_CallMethod(
4623 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4624 if (pyresult != nullptr) {
4625 char* buffer = nullptr;
4626 Py_ssize_t length = 0;
4627 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4628 if (buffer != nullptr) {
4629 arg1->ParseFromArray(buffer, length);
4630 }
4631 Py_DECREF(pyresult);
4632 }
4633 }
4634 {
4636 result = operations_research::sat::CpSatHelper::SolverResponseStats((operations_research::sat::CpSolverResponse const &)*arg1);
4638 }
4639 resultobj = SWIG_From_std_string(static_cast< std::string >(result));
4640 {
4641 delete arg1;
4642 }
4643 return resultobj;
4644fail:
4645 {
4646 delete arg1;
4647 }
4648 return NULL;
4649}
4650
4651
4652SWIGINTERN PyObject *_wrap_CpSatHelper_ValidateModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4653 PyObject *resultobj = 0;
4655 PyObject *swig_obj[1] ;
4656 std::string result;
4657
4658 if (!args) SWIG_fail;
4659 swig_obj[0] = args;
4660 {
4662 PyObject* const pyresult = PyObject_CallMethod(
4663 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4664 if (pyresult != nullptr) {
4665 char* buffer = nullptr;
4666 Py_ssize_t length = 0;
4667 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4668 if (buffer != nullptr) {
4669 arg1->ParseFromArray(buffer, length);
4670 }
4671 Py_DECREF(pyresult);
4672 }
4673 }
4674 {
4678 }
4679 resultobj = SWIG_From_std_string(static_cast< std::string >(result));
4680 {
4681 delete arg1;
4682 }
4683 return resultobj;
4684fail:
4685 {
4686 delete arg1;
4687 }
4688 return NULL;
4689}
4690
4691
4692SWIGINTERN PyObject *_wrap_CpSatHelper_VariableDomain(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4693 PyObject *resultobj = 0;
4695 void *argp1 = 0 ;
4696 int res1 = 0 ;
4697 PyObject *swig_obj[1] ;
4699
4700 if (!args) SWIG_fail;
4701 swig_obj[0] = args;
4703 if (!SWIG_IsOK(res1)) {
4704 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CpSatHelper_VariableDomain" "', argument " "1"" of type '" "operations_research::sat::IntegerVariableProto const &""'");
4705 }
4706 if (!argp1) {
4707 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CpSatHelper_VariableDomain" "', argument " "1"" of type '" "operations_research::sat::IntegerVariableProto const &""'");
4708 }
4709 arg1 = reinterpret_cast< operations_research::sat::IntegerVariableProto * >(argp1);
4710 {
4712 result = operations_research::sat::CpSatHelper::VariableDomain((operations_research::sat::IntegerVariableProto const &)*arg1);
4714 }
4716 return resultobj;
4717fail:
4718 return NULL;
4719}
4720
4721
4722SWIGINTERN PyObject *_wrap_CpSatHelper_WriteModelToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4723 PyObject *resultobj = 0;
4725 std::string *arg2 = 0 ;
4726 int res2 = SWIG_OLDOBJ ;
4727 PyObject *swig_obj[2] ;
4728 bool result;
4729
4730 if (!SWIG_Python_UnpackTuple(args, "CpSatHelper_WriteModelToFile", 2, 2, swig_obj)) SWIG_fail;
4731 {
4733 PyObject* const pyresult = PyObject_CallMethod(
4734 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4735 if (pyresult != nullptr) {
4736 char* buffer = nullptr;
4737 Py_ssize_t length = 0;
4738 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4739 if (buffer != nullptr) {
4740 arg1->ParseFromArray(buffer, length);
4741 }
4742 Py_DECREF(pyresult);
4743 }
4744 }
4745 {
4746 std::string *ptr = (std::string *)0;
4747 res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
4748 if (!SWIG_IsOK(res2)) {
4749 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CpSatHelper_WriteModelToFile" "', argument " "2"" of type '" "std::string const &""'");
4750 }
4751 if (!ptr) {
4752 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CpSatHelper_WriteModelToFile" "', argument " "2"" of type '" "std::string const &""'");
4753 }
4754 arg2 = ptr;
4755 }
4756 {
4758 result = (bool)operations_research::sat::CpSatHelper::WriteModelToFile((operations_research::sat::CpModelProto const &)*arg1,(std::string const &)*arg2);
4760 }
4761 resultobj = SWIG_From_bool(static_cast< bool >(result));
4762 {
4763 delete arg1;
4764 }
4765 if (SWIG_IsNewObj(res2)) delete arg2;
4766 return resultobj;
4767fail:
4768 {
4769 delete arg1;
4770 }
4771 if (SWIG_IsNewObj(res2)) delete arg2;
4772 return NULL;
4773}
4774
4775
4776SWIGINTERN PyObject *_wrap_new_CpSatHelper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4777 PyObject *resultobj = 0;
4778 operations_research::sat::CpSatHelper *result = 0 ;
4779
4780 if (!SWIG_Python_UnpackTuple(args, "new_CpSatHelper", 0, 0, 0)) SWIG_fail;
4781 {
4783 result = (operations_research::sat::CpSatHelper *)new operations_research::sat::CpSatHelper();
4785 }
4787 return resultobj;
4788fail:
4789 return NULL;
4790}
4791
4792
4793SWIGINTERN PyObject *_wrap_delete_CpSatHelper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4794 PyObject *resultobj = 0;
4795 operations_research::sat::CpSatHelper *arg1 = (operations_research::sat::CpSatHelper *) 0 ;
4796 void *argp1 = 0 ;
4797 int res1 = 0 ;
4798 PyObject *swig_obj[1] ;
4799
4800 if (!args) SWIG_fail;
4801 swig_obj[0] = args;
4803 if (!SWIG_IsOK(res1)) {
4804 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CpSatHelper" "', argument " "1"" of type '" "operations_research::sat::CpSatHelper *""'");
4805 }
4806 arg1 = reinterpret_cast< operations_research::sat::CpSatHelper * >(argp1);
4807 {
4809 delete arg1;
4811 }
4812 resultobj = SWIG_Py_Void();
4813 return resultobj;
4814fail:
4815 return NULL;
4816}
4817
4818
4819SWIGINTERN PyObject *CpSatHelper_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4820 PyObject *obj;
4821 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
4823 return SWIG_Py_Void();
4824}
4825
4826SWIGINTERN PyObject *CpSatHelper_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4827 return SWIG_Python_InitShadowInstance(args);
4828}
4829
4830static PyMethodDef SwigMethods[] = {
4831 { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
4832 { "delete_SolutionCallback", _wrap_delete_SolutionCallback, METH_O, NULL},
4833 { "SolutionCallback_OnSolutionCallback", _wrap_SolutionCallback_OnSolutionCallback, METH_O, NULL},
4834 { "SolutionCallback_NumBooleans", _wrap_SolutionCallback_NumBooleans, METH_O, NULL},
4835 { "SolutionCallback_NumBranches", _wrap_SolutionCallback_NumBranches, METH_O, NULL},
4836 { "SolutionCallback_NumConflicts", _wrap_SolutionCallback_NumConflicts, METH_O, NULL},
4837 { "SolutionCallback_NumBinaryPropagations", _wrap_SolutionCallback_NumBinaryPropagations, METH_O, NULL},
4838 { "SolutionCallback_NumIntegerPropagations", _wrap_SolutionCallback_NumIntegerPropagations, METH_O, NULL},
4839 { "SolutionCallback_WallTime", _wrap_SolutionCallback_WallTime, METH_O, NULL},
4840 { "SolutionCallback_UserTime", _wrap_SolutionCallback_UserTime, METH_O, NULL},
4841 { "SolutionCallback_ObjectiveValue", _wrap_SolutionCallback_ObjectiveValue, METH_O, NULL},
4842 { "SolutionCallback_BestObjectiveBound", _wrap_SolutionCallback_BestObjectiveBound, METH_O, NULL},
4843 { "SolutionCallback_SolutionIntegerValue", _wrap_SolutionCallback_SolutionIntegerValue, METH_VARARGS, NULL},
4844 { "SolutionCallback_SolutionBooleanValue", _wrap_SolutionCallback_SolutionBooleanValue, METH_VARARGS, NULL},
4845 { "SolutionCallback_StopSearch", _wrap_SolutionCallback_StopSearch, METH_O, NULL},
4846 { "SolutionCallback_Response", _wrap_SolutionCallback_Response, METH_O, NULL},
4847 { "SolutionCallback_HasResponse", _wrap_SolutionCallback_HasResponse, METH_O, NULL},
4848 { "new_SolutionCallback", _wrap_new_SolutionCallback, METH_O, NULL},
4849 { "disown_SolutionCallback", _wrap_disown_SolutionCallback, METH_O, NULL},
4850 { "SolutionCallback_swigregister", SolutionCallback_swigregister, METH_O, NULL},
4851 { "SolutionCallback_swiginit", SolutionCallback_swiginit, METH_VARARGS, NULL},
4852 { "SolveWrapper_SetParameters", _wrap_SolveWrapper_SetParameters, METH_VARARGS, NULL},
4853 { "SolveWrapper_AddSolutionCallback", _wrap_SolveWrapper_AddSolutionCallback, METH_VARARGS, NULL},
4854 { "SolveWrapper_ClearSolutionCallback", _wrap_SolveWrapper_ClearSolutionCallback, METH_VARARGS, NULL},
4855 { "SolveWrapper_AddLogCallback", _wrap_SolveWrapper_AddLogCallback, METH_VARARGS, NULL},
4856 { "SolveWrapper_Solve", _wrap_SolveWrapper_Solve, METH_VARARGS, NULL},
4857 { "SolveWrapper_StopSearch", _wrap_SolveWrapper_StopSearch, METH_O, NULL},
4858 { "new_SolveWrapper", _wrap_new_SolveWrapper, METH_NOARGS, NULL},
4859 { "delete_SolveWrapper", _wrap_delete_SolveWrapper, METH_O, NULL},
4860 { "SolveWrapper_swigregister", SolveWrapper_swigregister, METH_O, NULL},
4861 { "SolveWrapper_swiginit", SolveWrapper_swiginit, METH_VARARGS, NULL},
4862 { "CpSatHelper_ModelStats", _wrap_CpSatHelper_ModelStats, METH_O, NULL},
4863 { "CpSatHelper_SolverResponseStats", _wrap_CpSatHelper_SolverResponseStats, METH_O, NULL},
4864 { "CpSatHelper_ValidateModel", _wrap_CpSatHelper_ValidateModel, METH_O, NULL},
4865 { "CpSatHelper_VariableDomain", _wrap_CpSatHelper_VariableDomain, METH_O, NULL},
4866 { "CpSatHelper_WriteModelToFile", _wrap_CpSatHelper_WriteModelToFile, METH_VARARGS, NULL},
4867 { "new_CpSatHelper", _wrap_new_CpSatHelper, METH_NOARGS, NULL},
4868 { "delete_CpSatHelper", _wrap_delete_CpSatHelper, METH_O, NULL},
4869 { "CpSatHelper_swigregister", CpSatHelper_swigregister, METH_O, NULL},
4870 { "CpSatHelper_swiginit", CpSatHelper_swiginit, METH_VARARGS, NULL},
4871 { NULL, NULL, 0, NULL }
4872};
4873
4874static PyMethodDef SwigMethods_proxydocs[] = {
4875 { NULL, NULL, 0, NULL }
4876};
4877
4878
4879/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4880
4881static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
4882static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0};
4883static 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};
4884static swig_type_info _swigt__p_operations_research__Domain = {"_p_operations_research__Domain", "operations_research::Domain *", 0, 0, (void*)0, 0};
4885static swig_type_info _swigt__p_operations_research__sat__CpSatHelper = {"_p_operations_research__sat__CpSatHelper", "operations_research::sat::CpSatHelper *", 0, 0, (void*)0, 0};
4886static swig_type_info _swigt__p_operations_research__sat__IntegerVariableProto = {"_p_operations_research__sat__IntegerVariableProto", "operations_research::sat::IntegerVariableProto *", 0, 0, (void*)0, 0};
4887static swig_type_info _swigt__p_operations_research__sat__SolutionCallback = {"_p_operations_research__sat__SolutionCallback", "operations_research::sat::SolutionCallback *", 0, 0, (void*)0, 0};
4888static swig_type_info _swigt__p_operations_research__sat__SolveWrapper = {"_p_operations_research__sat__SolveWrapper", "operations_research::sat::SolveWrapper *", 0, 0, (void*)0, 0};
4889static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
4890static 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};
4891static 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};
4892static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0};
4893static 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};
4894static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
4895
4911};
4912
4913static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4914static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
4915static swig_cast_info _swigc__p_long[] = { {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
4921static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
4922static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
4924static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
4927
4943};
4944
4945
4946/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4947
4949{0, 0, 0, 0.0, 0, 0}};
4950
4951#ifdef __cplusplus
4952}
4953#endif
4954/* -----------------------------------------------------------------------------
4955 * Type initialization:
4956 * This problem is tough by the requirement that no dynamic
4957 * memory is used. Also, since swig_type_info structures store pointers to
4958 * swig_cast_info structures and swig_cast_info structures store pointers back
4959 * to swig_type_info structures, we need some lookup code at initialization.
4960 * The idea is that swig generates all the structures that are needed.
4961 * The runtime then collects these partially filled structures.
4962 * The SWIG_InitializeModule function takes these initial arrays out of
4963 * swig_module, and does all the lookup, filling in the swig_module.types
4964 * array with the correct data and linking the correct swig_cast_info
4965 * structures together.
4966 *
4967 * The generated swig_type_info structures are assigned statically to an initial
4968 * array. We just loop through that array, and handle each type individually.
4969 * First we lookup if this type has been already loaded, and if so, use the
4970 * loaded structure instead of the generated one. Then we have to fill in the
4971 * cast linked list. The cast data is initially stored in something like a
4972 * two-dimensional array. Each row corresponds to a type (there are the same
4973 * number of rows as there are in the swig_type_initial array). Each entry in
4974 * a column is one of the swig_cast_info structures for that type.
4975 * The cast_initial array is actually an array of arrays, because each row has
4976 * a variable number of columns. So to actually build the cast linked list,
4977 * we find the array of casts associated with the type, and loop through it
4978 * adding the casts to the list. The one last trick we need to do is making
4979 * sure the type pointer in the swig_cast_info struct is correct.
4980 *
4981 * First off, we lookup the cast->type name to see if it is already loaded.
4982 * There are three cases to handle:
4983 * 1) If the cast->type has already been loaded AND the type we are adding
4984 * casting info to has not been loaded (it is in this module), THEN we
4985 * replace the cast->type pointer with the type pointer that has already
4986 * been loaded.
4987 * 2) If BOTH types (the one we are adding casting info to, and the
4988 * cast->type) are loaded, THEN the cast info has already been loaded by
4989 * the previous module so we just ignore it.
4990 * 3) Finally, if cast->type has not already been loaded, then we add that
4991 * swig_cast_info to the linked list (because the cast->type) pointer will
4992 * be correct.
4993 * ----------------------------------------------------------------------------- */
4994
4995#ifdef __cplusplus
4996extern "C" {
4997#if 0
4998} /* c-mode */
4999#endif
5000#endif
5001
5002#if 0
5003#define SWIGRUNTIME_DEBUG
5004#endif
5005
5006
5007SWIGRUNTIME void
5008SWIG_InitializeModule(void *clientdata) {
5009 size_t i;
5010 swig_module_info *module_head, *iter;
5011 int init;
5012
5013 /* check to see if the circular list has been setup, if not, set it up */
5014 if (swig_module.next==0) {
5015 /* Initialize the swig_module */
5019 init = 1;
5020 } else {
5021 init = 0;
5022 }
5023
5024 /* Try and load any already created modules */
5025 module_head = SWIG_GetModule(clientdata);
5026 if (!module_head) {
5027 /* This is the first module loaded for this interpreter */
5028 /* so set the swig module into the interpreter */
5029 SWIG_SetModule(clientdata, &swig_module);
5030 } else {
5031 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
5032 iter=module_head;
5033 do {
5034 if (iter==&swig_module) {
5035 /* Our module is already in the list, so there's nothing more to do. */
5036 return;
5037 }
5038 iter=iter->next;
5039 } while (iter!= module_head);
5040
5041 /* otherwise we must add our module into the list */
5042 swig_module.next = module_head->next;
5043 module_head->next = &swig_module;
5044 }
5045
5046 /* When multiple interpreters are used, a module could have already been initialized in
5047 a different interpreter, but not yet have a pointer in this interpreter.
5048 In this case, we do not want to continue adding types... everything should be
5049 set up already */
5050 if (init == 0) return;
5051
5052 /* Now work on filling in swig_module.types */
5053#ifdef SWIGRUNTIME_DEBUG
5054 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
5055#endif
5056 for (i = 0; i < swig_module.size; ++i) {
5057 swig_type_info *type = 0;
5058 swig_type_info *ret;
5059 swig_cast_info *cast;
5060
5061#ifdef SWIGRUNTIME_DEBUG
5062 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
5063#endif
5064
5065 /* if there is another module already loaded */
5066 if (swig_module.next != &swig_module) {
5068 }
5069 if (type) {
5070 /* Overwrite clientdata field */
5071#ifdef SWIGRUNTIME_DEBUG
5072 printf("SWIG_InitializeModule: found type %s\n", type->name);
5073#endif
5076#ifdef SWIGRUNTIME_DEBUG
5077 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
5078#endif
5079 }
5080 } else {
5081 type = swig_module.type_initial[i];
5082 }
5083
5084 /* Insert casting types */
5085 cast = swig_module.cast_initial[i];
5086 while (cast->type) {
5087 /* Don't need to add information already in the list */
5088 ret = 0;
5089#ifdef SWIGRUNTIME_DEBUG
5090 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
5091#endif
5092 if (swig_module.next != &swig_module) {
5094#ifdef SWIGRUNTIME_DEBUG
5095 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
5096#endif
5097 }
5098 if (ret) {
5099 if (type == swig_module.type_initial[i]) {
5100#ifdef SWIGRUNTIME_DEBUG
5101 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
5102#endif
5103 cast->type = ret;
5104 ret = 0;
5105 } else {
5106 /* Check for casting already in the list */
5107 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
5108#ifdef SWIGRUNTIME_DEBUG
5109 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
5110#endif
5111 if (!ocast) ret = 0;
5112 }
5113 }
5114
5115 if (!ret) {
5116#ifdef SWIGRUNTIME_DEBUG
5117 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
5118#endif
5119 if (type->cast) {
5120 type->cast->prev = cast;
5121 cast->next = type->cast;
5122 }
5123 type->cast = cast;
5124 }
5125 cast++;
5126 }
5127 /* Set entry in modules->types array equal to the type */
5128 swig_module.types[i] = type;
5129 }
5130 swig_module.types[i] = 0;
5131
5132#ifdef SWIGRUNTIME_DEBUG
5133 printf("**** SWIG_InitializeModule: Cast List ******\n");
5134 for (i = 0; i < swig_module.size; ++i) {
5135 int j = 0;
5137 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
5138 while (cast->type) {
5139 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
5140 cast++;
5141 ++j;
5142 }
5143 printf("---- Total casts: %d\n",j);
5144 }
5145 printf("**** SWIG_InitializeModule: Cast List ******\n");
5146#endif
5147}
5148
5149/* This function will propagate the clientdata field of type to
5150* any new swig_type_info structures that have been added into the list
5151* of equivalent types. It is like calling
5152* SWIG_TypeClientData(type, clientdata) a second time.
5153*/
5154SWIGRUNTIME void
5156 size_t i;
5157 swig_cast_info *equiv;
5158 static int init_run = 0;
5159
5160 if (init_run) return;
5161 init_run = 1;
5162
5163 for (i = 0; i < swig_module.size; i++) {
5164 if (swig_module.types[i]->clientdata) {
5165 equiv = swig_module.types[i]->cast;
5166 while (equiv) {
5167 if (!equiv->converter) {
5168 if (equiv->type && !equiv->type->clientdata)
5170 }
5171 equiv = equiv->next;
5172 }
5173 }
5174 }
5175}
5176
5177#ifdef __cplusplus
5178#if 0
5179{
5180 /* c-mode */
5181#endif
5182}
5183#endif
5184
5185
5186
5187#ifdef __cplusplus
5188extern "C" {
5189#endif
5190
5191 /* Python-specific SWIG API */
5192#define SWIG_newvarlink() SWIG_Python_newvarlink()
5193#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
5194#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
5195
5196 /* -----------------------------------------------------------------------------
5197 * global variable support code.
5198 * ----------------------------------------------------------------------------- */
5199
5200 typedef struct swig_globalvar {
5201 char *name; /* Name of global variable */
5202 PyObject *(*get_attr)(void); /* Return the current value */
5203 int (*set_attr)(PyObject *); /* Set the value */
5204 struct swig_globalvar *next;
5206
5207 typedef struct swig_varlinkobject {
5208 PyObject_HEAD
5211
5212 SWIGINTERN PyObject *
5214#if PY_VERSION_HEX >= 0x03000000
5215 return PyUnicode_InternFromString("<Swig global variables>");
5216#else
5217 return PyString_FromString("<Swig global variables>");
5218#endif
5219 }
5220
5221 SWIGINTERN PyObject *
5223#if PY_VERSION_HEX >= 0x03000000
5224 PyObject *str = PyUnicode_InternFromString("(");
5225 PyObject *tail;
5226 PyObject *joined;
5228 for (var = v->vars; var; var=var->next) {
5229 tail = PyUnicode_FromString(var->name);
5230 joined = PyUnicode_Concat(str, tail);
5231 Py_DecRef(str);
5232 Py_DecRef(tail);
5233 str = joined;
5234 if (var->next) {
5235 tail = PyUnicode_InternFromString(", ");
5236 joined = PyUnicode_Concat(str, tail);
5237 Py_DecRef(str);
5238 Py_DecRef(tail);
5239 str = joined;
5240 }
5241 }
5242 tail = PyUnicode_InternFromString(")");
5243 joined = PyUnicode_Concat(str, tail);
5244 Py_DecRef(str);
5245 Py_DecRef(tail);
5246 str = joined;
5247#else
5248 PyObject *str = PyString_FromString("(");
5250 for (var = v->vars; var; var=var->next) {
5251 PyString_ConcatAndDel(&str,PyString_FromString(var->name));
5252 if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
5253 }
5254 PyString_ConcatAndDel(&str,PyString_FromString(")"));
5255#endif
5256 return str;
5257 }
5258
5259 SWIGINTERN void
5261 swig_globalvar *var = v->vars;
5262 while (var) {
5263 swig_globalvar *n = var->next;
5264 free(var->name);
5265 free(var);
5266 var = n;
5267 }
5268 }
5269
5270 SWIGINTERN PyObject *
5272 PyObject *res = NULL;
5273 swig_globalvar *var = v->vars;
5274 while (var) {
5275 if (strcmp(var->name,n) == 0) {
5276 res = (*var->get_attr)();
5277 break;
5278 }
5279 var = var->next;
5280 }
5281 if (res == NULL && !PyErr_Occurred()) {
5282 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
5283 }
5284 return res;
5285 }
5286
5287 SWIGINTERN int
5288 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
5289 int res = 1;
5290 swig_globalvar *var = v->vars;
5291 while (var) {
5292 if (strcmp(var->name,n) == 0) {
5293 res = (*var->set_attr)(p);
5294 break;
5295 }
5296 var = var->next;
5297 }
5298 if (res == 1 && !PyErr_Occurred()) {
5299 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
5300 }
5301 return res;
5302 }
5303
5304 SWIGINTERN PyTypeObject*
5306 static char varlink__doc__[] = "Swig var link object";
5307 static PyTypeObject varlink_type;
5308 static int type_init = 0;
5309 if (!type_init) {
5310 const PyTypeObject tmp = {
5311#if PY_VERSION_HEX >= 0x03000000
5312 PyVarObject_HEAD_INIT(NULL, 0)
5313#else
5314 PyObject_HEAD_INIT(NULL)
5315 0, /* ob_size */
5316#endif
5317 "swigvarlink", /* tp_name */
5318 sizeof(swig_varlinkobject), /* tp_basicsize */
5319 0, /* tp_itemsize */
5320 (destructor) swig_varlink_dealloc, /* tp_dealloc */
5321 0, /* tp_print */
5322 (getattrfunc) swig_varlink_getattr, /* tp_getattr */
5323 (setattrfunc) swig_varlink_setattr, /* tp_setattr */
5324 0, /* tp_compare */
5325 (reprfunc) swig_varlink_repr, /* tp_repr */
5326 0, /* tp_as_number */
5327 0, /* tp_as_sequence */
5328 0, /* tp_as_mapping */
5329 0, /* tp_hash */
5330 0, /* tp_call */
5331 (reprfunc) swig_varlink_str, /* tp_str */
5332 0, /* tp_getattro */
5333 0, /* tp_setattro */
5334 0, /* tp_as_buffer */
5335 0, /* tp_flags */
5336 varlink__doc__, /* tp_doc */
5337 0, /* tp_traverse */
5338 0, /* tp_clear */
5339 0, /* tp_richcompare */
5340 0, /* tp_weaklistoffset */
5341 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
5342 0, /* tp_del */
5343 0, /* tp_version_tag */
5344#if PY_VERSION_HEX >= 0x03040000
5345 0, /* tp_finalize */
5346#endif
5347#if PY_VERSION_HEX >= 0x03080000
5348 0, /* tp_vectorcall */
5349#endif
5350#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
5351 0, /* tp_print */
5352#endif
5353#ifdef COUNT_ALLOCS
5354 0, /* tp_allocs */
5355 0, /* tp_frees */
5356 0, /* tp_maxalloc */
5357 0, /* tp_prev */
5358 0 /* tp_next */
5359#endif
5360 };
5361 varlink_type = tmp;
5362 type_init = 1;
5363 if (PyType_Ready(&varlink_type) < 0)
5364 return NULL;
5365 }
5366 return &varlink_type;
5367 }
5368
5369 /* Create a variable linking object for use later */
5370 SWIGINTERN PyObject *
5372 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
5373 if (result) {
5374 result->vars = 0;
5375 }
5376 return ((PyObject*) result);
5377 }
5378
5379 SWIGINTERN void
5380 SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
5383 if (gv) {
5384 size_t size = strlen(name)+1;
5385 gv->name = (char *)malloc(size);
5386 if (gv->name) {
5387 memcpy(gv->name, name, size);
5388 gv->get_attr = get_attr;
5389 gv->set_attr = set_attr;
5390 gv->next = v->vars;
5391 }
5392 }
5393 v->vars = gv;
5394 }
5395
5396 SWIGINTERN PyObject *
5398 static PyObject *globals = 0;
5399 if (!globals) {
5400 globals = SWIG_newvarlink();
5401 }
5402 return globals;
5403 }
5404
5405 /* -----------------------------------------------------------------------------
5406 * constants/methods manipulation
5407 * ----------------------------------------------------------------------------- */
5408
5409 /* Install Constants */
5410 SWIGINTERN void
5412 PyObject *obj = 0;
5413 size_t i;
5414 for (i = 0; constants[i].type; ++i) {
5415 switch(constants[i].type) {
5416 case SWIG_PY_POINTER:
5417 obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
5418 break;
5419 case SWIG_PY_BINARY:
5420 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
5421 break;
5422 default:
5423 obj = 0;
5424 break;
5425 }
5426 if (obj) {
5427 PyDict_SetItemString(d, constants[i].name, obj);
5428 Py_DECREF(obj);
5429 }
5430 }
5431 }
5432
5433 /* -----------------------------------------------------------------------------*/
5434 /* Fix SwigMethods to carry the callback ptrs when needed */
5435 /* -----------------------------------------------------------------------------*/
5436
5437 SWIGINTERN void
5438 SWIG_Python_FixMethods(PyMethodDef *methods,
5439 swig_const_info *const_table,
5440 swig_type_info **types,
5441 swig_type_info **types_initial) {
5442 size_t i;
5443 for (i = 0; methods[i].ml_name; ++i) {
5444 const char *c = methods[i].ml_doc;
5445 if (!c) continue;
5446 c = strstr(c, "swig_ptr: ");
5447 if (c) {
5448 int j;
5449 swig_const_info *ci = 0;
5450 const char *name = c + 10;
5451 for (j = 0; const_table[j].type; ++j) {
5452 if (strncmp(const_table[j].name, name,
5453 strlen(const_table[j].name)) == 0) {
5454 ci = &(const_table[j]);
5455 break;
5456 }
5457 }
5458 if (ci) {
5459 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
5460 if (ptr) {
5461 size_t shift = (ci->ptype) - types;
5462 swig_type_info *ty = types_initial[shift];
5463 size_t ldoc = (c - methods[i].ml_doc);
5464 size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
5465 char *ndoc = (char*)malloc(ldoc + lptr + 10);
5466 if (ndoc) {
5467 char *buff = ndoc;
5468 memcpy(buff, methods[i].ml_doc, ldoc);
5469 buff += ldoc;
5470 memcpy(buff, "swig_ptr: ", 10);
5471 buff += 10;
5472 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
5473 methods[i].ml_doc = ndoc;
5474 }
5475 }
5476 }
5477 }
5478 }
5479 }
5480
5481 /* -----------------------------------------------------------------------------
5482 * Method creation and docstring support functions
5483 * ----------------------------------------------------------------------------- */
5484
5485 /* -----------------------------------------------------------------------------
5486 * Function to find the method definition with the correct docstring for the
5487 * proxy module as opposed to the low-level API
5488 * ----------------------------------------------------------------------------- */
5489
5490 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
5491 /* Find the function in the modified method table */
5492 size_t offset = 0;
5493 int found = 0;
5494 while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
5495 if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
5496 found = 1;
5497 break;
5498 }
5499 offset++;
5500 }
5501 /* Use the copy with the modified docstring if available */
5502 return found ? &SwigMethods_proxydocs[offset] : NULL;
5503 }
5504
5505 /* -----------------------------------------------------------------------------
5506 * Wrapper of PyInstanceMethod_New() used in Python 3
5507 * It is exported to the generated module, used for -fastproxy
5508 * ----------------------------------------------------------------------------- */
5509
5510 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
5511 if (PyCFunction_Check(func)) {
5512 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
5513 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
5514 if (ml)
5515 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
5516 }
5517#if PY_VERSION_HEX >= 0x03000000
5518 return PyInstanceMethod_New(func);
5519#else
5520 return PyMethod_New(func, NULL, NULL);
5521#endif
5522 }
5523
5524 /* -----------------------------------------------------------------------------
5525 * Wrapper of PyStaticMethod_New()
5526 * It is exported to the generated module, used for -fastproxy
5527 * ----------------------------------------------------------------------------- */
5528
5529 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
5530 if (PyCFunction_Check(func)) {
5531 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
5532 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
5533 if (ml)
5534 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
5535 }
5536 return PyStaticMethod_New(func);
5537 }
5538
5539#ifdef __cplusplus
5540}
5541#endif
5542
5543/* -----------------------------------------------------------------------------*
5544 * Partial Init method
5545 * -----------------------------------------------------------------------------*/
5546
5547#ifdef __cplusplus
5548extern "C"
5549#endif
5550
5552#if PY_VERSION_HEX >= 0x03000000
5553PyObject*
5554#else
5555void
5556#endif
5557SWIG_init(void) {
5558 PyObject *m, *d, *md, *globals;
5559
5560#if PY_VERSION_HEX >= 0x03000000
5561 static struct PyModuleDef SWIG_module = {
5562 PyModuleDef_HEAD_INIT,
5563 SWIG_name,
5564 NULL,
5565 -1,
5567 NULL,
5568 NULL,
5569 NULL,
5570 NULL
5571 };
5572#endif
5573
5574#if defined(SWIGPYTHON_BUILTIN)
5575 static SwigPyClientData SwigPyObject_clientdata = {
5576 0, 0, 0, 0, 0, 0, 0
5577 };
5578 static PyGetSetDef this_getset_def = {
5579 (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
5580 };
5581 static SwigPyGetSet thisown_getset_closure = {
5584 };
5585 static PyGetSetDef thisown_getset_def = {
5586 (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
5587 };
5588 PyTypeObject *builtin_pytype;
5589 int builtin_base_count;
5590 swig_type_info *builtin_basetype;
5591 PyObject *tuple;
5592 PyGetSetDescrObject *static_getset;
5593 PyTypeObject *metatype;
5594 PyTypeObject *swigpyobject;
5595 SwigPyClientData *cd;
5596 PyObject *public_interface, *public_symbol;
5597 PyObject *this_descr;
5598 PyObject *thisown_descr;
5599 PyObject *self = 0;
5600 int i;
5601
5602 (void)builtin_pytype;
5603 (void)builtin_base_count;
5604 (void)builtin_basetype;
5605 (void)tuple;
5606 (void)static_getset;
5607 (void)self;
5608
5609 /* Metaclass is used to implement static member variables */
5610 metatype = SwigPyObjectType();
5611 assert(metatype);
5612#endif
5613
5614 (void)globals;
5615
5616 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
5617 SWIG_This();
5620#ifndef SWIGPYTHON_BUILTIN
5622#endif
5623
5624 /* Fix SwigMethods to carry the callback ptrs when needed */
5626
5627#if PY_VERSION_HEX >= 0x03000000
5628 m = PyModule_Create(&SWIG_module);
5629#else
5630 m = Py_InitModule(SWIG_name, SwigMethods);
5631#endif
5632
5633 md = d = PyModule_GetDict(m);
5634 (void)md;
5635
5637
5638#ifdef SWIGPYTHON_BUILTIN
5639 swigpyobject = SwigPyObject_TypeOnce();
5640
5641 SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
5642 assert(SwigPyObject_stype);
5643 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
5644 if (!cd) {
5645 SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
5646 SwigPyObject_clientdata.pytype = swigpyobject;
5647 } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
5648 PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
5649# if PY_VERSION_HEX >= 0x03000000
5650 return NULL;
5651# else
5652 return;
5653# endif
5654 }
5655
5656 /* All objects have a 'this' attribute */
5657 this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
5658 (void)this_descr;
5659
5660 /* All objects have a 'thisown' attribute */
5661 thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
5662 (void)thisown_descr;
5663
5664 public_interface = PyList_New(0);
5665 public_symbol = 0;
5666 (void)public_symbol;
5667
5668 PyDict_SetItemString(md, "__all__", public_interface);
5669 Py_DECREF(public_interface);
5670 for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
5671 SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
5672 for (i = 0; swig_const_table[i].name != 0; ++i)
5673 SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
5674#endif
5675
5677
5678
5679 /* Initialize threading */
5681#if PY_VERSION_HEX >= 0x03000000
5682 return m;
5683#else
5684 return;
5685#endif
5686}
5687
int64_t max
Definition: alldiff_cst.cc:140
int64_t min
Definition: alldiff_cst.cc:139
PyObject * get() const
SharedPyPtr(const SharedPyPtr &other)
SharedPyPtr(PyObject *obj)
static void raise(JNIEnv *jenv, jthrowable throwable)
DirectorException(PyObject *error, const char *hdr="", const char *msg="")
const char * getMessage() const
PyObject * swig_get_self() const
int swig_release_ownership(void *vptr) const
static PyObject * swig_pyobj_disown(PyObject *pyobj, PyObject *SWIGUNUSEDPARM(args))
jobject swig_get_self(JNIEnv *jenv) const
virtual void swig_set_inner(const char *, bool) const
void swig_disown() const
void swig_acquire_ownership_array(Type *vptr) const
void swig_acquire_ownership_obj(void *vptr, int own) const
Director(PyObject *self)
virtual bool swig_get_inner(const char *) const
void swig_acquire_ownership(Type *vptr) const
DirectorMethodException(const char *msg="")
DirectorPureVirtualException(const char *msg="")
DirectorTypeMismatchException(PyObject *error, const char *msg="")
DirectorTypeMismatchException(const char *msg="")
Guard(PyThread_type_lock &mutex)
virtual void OnSolutionCallback() const
We call domain any subset of Int64 = [kint64min, kint64max].
PyObject * operator->() const
SwigPtr_PyObject(PyObject *obj, bool initial_ref=true)
SwigPtr_PyObject & operator=(const SwigPtr_PyObject &item)
SwigPtr_PyObject(const SwigPtr_PyObject &item)
Block * next
const std::string name
int64_t value
IntVar * var
Definition: expr_array.cc:1874
absl::Status ValidateModel(const ModelProto &model, const bool check_names)
CpSolverResponse Solve(const CpModelProto &model_proto)
Solves the given CpModelProto and returns an instance of CpSolverResponse.
Collection of objects used to extend the Constraint Solver library.
void * malloc(YYSIZE_T)
void free(void *)
if(!yyg->yy_init)
Definition: parser.yy.cc:965
static int input(yyscan_t yyscanner)
int64_t tail
SWIGRUNTIME swig_module_info * SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata))
SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty)
static swig_cast_info * swig_cast_initial[]
SWIGINTERN PyObject * _wrap_SolutionCallback_NumIntegerPropagations(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * _wrap_disown_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * _wrap_CpSatHelper_VariableDomain(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME swig_cast_info * SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty)
#define SWIG_MangledTypeQuery(name)
SWIGINTERN PyObject * _wrap_SolutionCallback_SolutionIntegerValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
static PyObject * Swig_This_global
SWIGRUNTIME int SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
SWIGINTERN int SWIG_AsVal_double(PyObject *obj, double *val)
SWIGINTERN Py_ssize_t SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
SWIGINTERN PyObject * _wrap_SolutionCallback_SolutionBooleanValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
static swig_type_info _swigt__p_operations_research__Domain
#define SWIG_TypeQuery(name)
#define SWIG_POINTER_OWN
#define SWIG_SyntaxError
#define SWIG_POINTER_NEW
#define SWIG_CheckState(r)
SWIGINTERN PyObject * _wrap_SolutionCallback_StopSearch(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
static swig_cast_info _swigc__p_int[]
SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb)
#define SWIG_BUFFER_SIZE
#define SWIG_TypeError
SWIGRUNTIME int SWIG_Python_AddErrMesg(const char *mesg, int infront)
SWIGRUNTIME PyObject * SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
SWIGINTERN void SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[])
SWIGINTERN PyObject * _wrap_delete_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME PyObject * SwigPyObject_next(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
#define SWIG_POINTER_IMPLICIT_CONV
static ReturnT HandleResult(PyObject *pyresult)
SWIGRUNTIME PyObject * SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
#define SWIG_PY_POINTER
struct swig_cast_info swig_cast_info
SWIGINTERN PyObject * _wrap_SolutionCallback_OnSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * _wrap_SolutionCallback_UserTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_init
#define SWIG_DIRECTOR_RGTR(ARG1, ARG2)
SWIGINTERN int swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2)
SWIGRUNTIME PyObject * SwigPyObject_hex(SwigPyObject *v)
SWIGINTERN PyObject * _wrap_SolveWrapper_AddSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)
SWIGRUNTIME void SwigPyObject_dealloc(PyObject *v)
SWIGRUNTIME PyTypeObject * SwigPyPacked_TypeOnce(void)
#define SWIG_PYTHON_THREAD_END_BLOCK
SWIGINTERN PyObject * _wrap_SolveWrapper_AddLogCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_RuntimeError
SWIGRUNTIME PyObject * SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
SWIGRUNTIME PyObject * SwigPyObject_append(PyObject *v, PyObject *next)
SWIGINTERN PyObject * swig_varlink_getattr(swig_varlinkobject *v, char *n)
SWIGINTERN PyObject * SWIG_Python_newvarlink(void)
struct swig_varlinkobject swig_varlinkobject
#define SWIG_NewClientData(obj)
static swig_type_info _swigt__p_operations_research__sat__SolutionCallback
#define PyObject_DEL
SWIGINTERN PyObject * swig_varlink_str(swig_varlinkobject *v)
static swig_type_info _swigt__p_unsigned_char
static swig_cast_info _swigc__p_operations_research__sat__IntegerVariableProto[]
SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
#define SWIGRUNTIME
SWIGINTERN PyObject * _wrap_SolutionCallback_Response(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * _wrap_new_CpSatHelper(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_PY_BINARY
#define SWIG_SetErrorMsg
#define SWIG_RUNTIME_VERSION
SWIGINTERN char * SWIG_Python_str_AsChar(PyObject *str)
SWIGRUNTIMEINLINE const char * SwigPyObject_GetDesc(PyObject *self)
SWIGINTERN PyObject * SwigPyObject_own(PyObject *v, PyObject *args)
#define SWIG_POINTER_NOSHADOW
#define SWIG_OLDOBJ
SWIGRUNTIME void SWIG_TypeClientData(swig_type_info *ti, void *clientdata)
SWIGRUNTIME swig_type_info * SWIG_TypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name)
static swig_type_info _swigt__p_short
#define SWIG_ValueError
SWIGINTERN PyObject * _wrap_CpSatHelper_WriteModelToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN void SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int(*set_attr)(PyObject *p))
SWIGINTERN PyObject * SwigPyObject_acquire(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
static PyMethodDef swigobject_methods[]
SWIGINTERN PyObject * _wrap_delete_SolveWrapper(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME char * SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz)
SWIGINTERN PyObject * _wrap_new_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_AddCast(r)
SWIGRUNTIME PyObject * SWIG_Python_TypeCache(void)
#define SWIG_IsNewObj(r)
#define SWIG_InternalNewPointerObj(ptr, type, flags)
SWIGINTERN PyObject * _wrap_SolutionCallback_NumBranches(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME PyObject * SwigPyObject_long(SwigPyObject *v)
#define SWIG_exception_fail(code, msg)
#define SWIG_DIRECTOR_CAST(ARG)
SWIGRUNTIMEINLINE PyObject * SWIG_Py_Void(void)
SWIGINTERN PyObject * _wrap_CpSatHelper_ValidateModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
SWIGINTERN PyObject * _wrap_delete_CpSatHelper(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_AttributeError
SWIGRUNTIME const char * SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name)
static swig_module_info swig_module
static swig_cast_info _swigc__p_unsigned_char[]
SWIGINTERN PyObject * _wrap_SolutionCallback_WallTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
static swig_cast_info _swigc__p_short[]
#define SWIG_From_long
SWIGRUNTIME int SWIG_Python_TypeErrorOccurred(PyObject *obj)
SWIGRUNTIME void SWIG_Python_DestroyModule(PyObject *obj)
#define SWIG_SetModule(clientdata, pointer)
SWIGRUNTIME SwigPyClientData * SwigPyClientData_New(PyObject *obj)
SWIGINTERN PyTypeObject * swig_varlink_type(void)
#define SWIGUNUSEDPARM(p)
SWIGRUNTIME swig_type_info * SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr)
#define SWIG_as_voidptr(a)
SWIGINTERN swig_type_info * SWIG_pchar_descriptor(void)
static swig_const_info swig_const_table[]
SWIGINTERN PyObject * SwigPyObject_disown(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
SWIGRUNTIMEINLINE int SwigPyPacked_Check(PyObject *op)
#define SWIG_Python_CallFunctor(functor, obj)
SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata)
static swig_type_info _swigt__p_unsigned_short
SWIGRUNTIME int SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
#define SWIG_ConvertPtr(obj, pptr, type, flags)
SWIGRUNTIME int SWIG_TypeCmp(const char *nb, const char *tb)
SWIGRUNTIME const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz)
struct swig_const_info swig_const_info
void HandleResult< void >(PyObject *pyresult)
SWIGINTERN int SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name)
SWIGINTERN PyObject * _wrap_SolutionCallback_BestObjectiveBound(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
void *(* swig_converter_func)(void *, int *)
SWIGINTERN PyObject * _wrap_SolutionCallback_NumConflicts(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN PyObject * _wrap_SolveWrapper_Solve(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERNINLINE PyObject * SWIG_From_std_string(const std::string &s)
SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
SWIGRUNTIME PyObject * SwigPyPacked_repr(SwigPyPacked *v)
#define SWIG_newvarlink()
SWIGRUNTIME void SWIG_Python_RaiseOrModifyTypeError(const char *message)
SWIGRUNTIME swig_type_info * SWIG_Python_TypeQuery(const char *type)
static swig_type_info _swigt__p_unsigned_long
#define SWIG_Python_str_DelForPy3(x)
static swig_cast_info _swigc__p_char[]
static swig_type_info _swigt__p_operations_research__sat__CpSatHelper
SWIGINTERN PyObject * SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
#define SWIGINTERN
SWIGRUNTIMEINLINE PyObject * SWIG_Python_ExceptionType(swig_type_info *desc)
SWIGRUNTIMEINLINE int SwigPyObject_Check(PyObject *op)
#define SWIG_From_double
SWIGINTERN void SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj)
SWIGRUNTIME swig_type_info * SWIG_MangledTypeQueryModule(swig_module_info *start, swig_module_info *end, const char *name)
static swig_cast_info _swigc__p_unsigned_short[]
struct swig_globalvar swig_globalvar
#define SWIGPY_CAPSULE_NAME
SWIGRUNTIME void * SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags)
#define SWIG_ArgError(r)
SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char *mesg)
SWIGINTERN PyObject * _wrap_SolveWrapper_SetParameters(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERNINLINE PyObject * SWIG_FromCharPtrAndSize(const char *carray, size_t size)
SWIGRUNTIME const char * SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name)
#define SWIG_NewPointerObj(ptr, type, flags)
SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info *swig_module)
#define SWIG_GUARD(mutex)
SWIGINTERN void SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj)
SWIGINTERN PyObject * _wrap_SolveWrapper_ClearSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_POINTER_NO_NULL
#define SWIG_Python_str_FromFormat
#define SWIG_InstallConstants(d, constants)
struct swig_type_info *(* swig_dycast_func)(void **)
#define SWIG_IOError
static PyMethodDef SwigMethods[]
#define SWIGTYPE_p_operations_research__sat__SolutionCallback
#define SWIG_NullReferenceError
SWIGINTERN PyObject * _wrap_SolutionCallback_HasResponse(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME PyTypeObject * SwigPyPacked_type(void)
static swig_cast_info _swigc__p_operations_research__sat__SolveWrapper[]
SWIGRUNTIMEINLINE const char * SWIG_TypeName(const swig_type_info *ty)
#define SWIG_POINTER_DISOWN
#define SWIG_STATIC_POINTER(var)
struct swig_type_info swig_type_info
SWIGRUNTIME char * SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz)
SWIGRUNTIME char * SWIG_PackData(char *c, void *ptr, size_t sz)
SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty)
SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg)
SWIGINTERN PyObject * _wrap_CpSatHelper_ModelStats(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME PyObject * SwigPyObject_format(const char *fmt, SwigPyObject *v)
SWIGRUNTIME PyObject * SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags)
#define SWIG_NEWOBJ
static swig_type_info _swigt__p_signed_char
SWIGINTERN int SWIG_AsPtr_std_string(PyObject *obj, std::string **val)
SWIGRUNTIME int SWIG_Python_ArgFail(int argnum)
SWIGRUNTIME swig_type_info * SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
SWIGINTERNINLINE PyObject * SWIG_From_bool(bool value)
SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own)
#define SWIG_NewPackedObj(ptr, sz, type)
SWIGINTERN PyObject * CpSatHelper_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_GetModule(clientdata)
static swig_cast_info _swigc__p_unsigned_int[]
#define SWIG_fail
static swig_type_info _swigt__p_int
SWIGINTERN PyObject * _wrap_SolutionCallback_NumBinaryPropagations(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME void SWIG_PropagateClientData(void)
static swig_cast_info _swigc__p_unsigned_long[]
SWIGINTERN PyObject * _wrap_SolveWrapper_StopSearch(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME PyObject * SwigPyPacked_str(SwigPyPacked *v)
SWIGINTERN PyObject * _wrap_SolutionCallback_NumBooleans(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME int SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
#define SWIGTYPE_p_operations_research__Domain
static swig_type_info _swigt__p_long
SWIGRUNTIME const char * SWIG_TypePrettyName(const swig_type_info *type)
SWIGRUNTIMEINLINE PyObject * SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type)
SWIGRUNTIME swig_cast_info * SWIG_TypeCheck(const char *c, swig_type_info *ty)
static PyMethodDef SwigMethods_proxydocs[]
SWIGRUNTIME PyObject * SWIG_This(void)
SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject *obj)
SWIGINTERN PyObject * SolutionCallback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGINTERN int SWIG_AsVal_int(PyObject *obj, int *val)
SWIGINTERN PyObject * SWIG_Python_AppendOutput(PyObject *result, PyObject *obj)
#define SWIG_TYPE_TABLE_NAME
#define SWIG_BUILTIN_TP_INIT
static swig_type_info _swigt__p_unsigned_int
#define SWIG_CAST_NEW_MEMORY
SWIGRUNTIME PyObject * SwigPyObject_repr(SwigPyObject *v)
SWIGINTERN int SWIG_AsVal_long(PyObject *obj, long *val)
SWIGINTERN PyObject * _wrap_new_SolveWrapper(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_PYTHON_THREAD_END_ALLOW
struct swig_module_info swig_module_info
SWIGRUNTIME PyObject * SWIG_Python_ErrorType(int code)
SWIGINTERN PyObject * SolveWrapper_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_ERROR
SWIGRUNTIME void SwigPyClientData_Del(SwigPyClientData *data)
#define SWIG_name
static swig_cast_info _swigc__p_operations_research__sat__SolutionCallback[]
SWIGRUNTIME SwigPyObject * SWIG_Python_GetSwigThis(PyObject *pyobj)
#define SWIGTYPE_p_operations_research__sat__CpSatHelper
SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject *v)
SWIGINTERN PyObject * swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v))
static swig_cast_info _swigc__p_long[]
static swig_type_info * swig_type_initial[]
static ReturnT InvokePythonCallableReturning(PyObject *pyfunc, const char *format, Args... args)
SWIGINTERN PyObject * SolveWrapper_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIME void SwigPyPacked_dealloc(PyObject *v)
static swig_cast_info _swigc__p_operations_research__sat__CpSatHelper[]
SWIGINTERN PyObject * SWIG_Python_str_FromChar(const char *c)
SWIGRUNTIME PyObject * SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
SWIGINTERN PyObject * _wrap_SolutionCallback_ObjectiveValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info *ty)
SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef *methods, swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial)
#define SWIG_MemoryError
SWIGINTERN PyObject * _wrap_CpSatHelper_SolverResponseStats(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
static swig_type_info _swigt__p_operations_research__sat__IntegerVariableProto
#define SWIG_SystemError
#define SWIG_DivisionByZero
static swig_type_info _swigt__p_char
static swig_cast_info _swigc__p_operations_research__Domain[]
SWIGRUNTIME PyTypeObject * SwigPyObject_type(void)
#define SWIG_OverflowError
#define SWIGEXPORT
SWIGRUNTIME PyTypeObject * SwigPyObject_TypeOnce(void)
SWIGINTERN PyObject * SolutionCallback_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_IsOK(r)
#define SWIGTYPE_p_operations_research__sat__SolveWrapper
SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc)
static swig_type_info _swigt__p_operations_research__sat__SolveWrapper
#define SWIGTYPE_p_operations_research__sat__IntegerVariableProto
SWIGINTERN PyObject * CpSatHelper_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args)
#define SWIG_IndexError
SWIGRUNTIME PyObject * SwigPyObject_oct(SwigPyObject *v)
static swig_type_info * swig_types[15]
SWIGRUNTIME PyObject * SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
#define SWIG_PYTHON_INITIALIZE_THREADS
SWIGINTERN PyObject * SWIG_Python_InitShadowInstance(PyObject *args)
#define SWIG_AddNewMask(r)
SWIGINTERN PyObject * SWIG_globals(void)
SWIGINTERN PyMethodDef * SWIG_PythonGetProxyDoc(const char *name)
#define SWIG_OK
#define SWIG_PYTHON_THREAD_BEGIN_BLOCK
#define SWIGINTERNINLINE
static swig_cast_info _swigc__p_signed_char[]
#define SWIG_PYTHON_THREAD_BEGIN_ALLOW
#define Py_TYPE(op)
SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject *obj, int own)
#define SWIGRUNTIMEINLINE
SWIGRUNTIMEINLINE void * SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory)
GCItem * operator->() const
GCItem_var(GCItem *item=0)
GCItem_var & operator=(GCItem *item)
virtual int get_own() const
PyObject_HEAD void * ptr
PyObject_HEAD void * pack
SwigVar_PyObject(PyObject *obj=0)
SwigVar_PyObject & operator=(PyObject *obj)
struct swig_cast_info * prev
struct swig_cast_info * next
swig_converter_func converter
struct swig_globalvar * next
PyObject *(* get_attr)(void)
struct swig_module_info * next
struct swig_cast_info * cast
PyObject_HEAD swig_globalvar * vars
std::string message
Definition: trace.cc:398