OR-Tools  9.2
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*/
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*/
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_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_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#include <string>
3231
3232
3233#include "ortools/base/python-swig.h"
3234
3235
3236#include <functional>
3237
3238// A copyable, ref-counted python pointer.
3239// TODO(user): Make it movable-only when we support generalized lambda
3240// capture.
3241class SharedPyPtr {
3242 public:
3243 explicit SharedPyPtr(PyObject* obj) : obj_(obj) { Py_INCREF(obj_); }
3244 SharedPyPtr(const SharedPyPtr& other) : obj_(other.obj_) { Py_INCREF(obj_); }
3245
3246 ~SharedPyPtr() { Py_DECREF(obj_); }
3247
3248 PyObject* get() const { return obj_; }
3249
3250 private:
3251 // We do not follow the rule of three as we only want to copy construct.
3252 SharedPyPtr& operator=(const SharedPyPtr&);
3253
3254 PyObject* const obj_;
3255};
3256
3257template <typename ReturnT>
3258static ReturnT HandleResult(PyObject* pyresult) {
3259 // This zero-initializes builtin types.
3260 ReturnT result = ReturnT();
3261 if (!pyresult) {
3262 if (!PyErr_Occurred()) {
3263 PyErr_SetString(PyExc_RuntimeError,
3264 "SWIG std::function invocation failed.");
3265 }
3266 return result;
3267 } else {
3268 if (!PyObjAs<ReturnT>(pyresult, &result)) {
3269 if (!PyErr_Occurred()) {
3270 PyErr_SetString(PyExc_RuntimeError,
3271 "SWIG std::function invocation failed.");
3272 }
3273 }
3274 Py_DECREF(pyresult);
3275 }
3276 return result;
3277}
3278
3279template <>
3280void HandleResult<void>(PyObject * pyresult) {
3281 if (!pyresult) {
3282 if (!PyErr_Occurred()) {
3283 PyErr_SetString(PyExc_RuntimeError,
3284 "SWIG std::function invocation failed.");
3285 }
3286 } else {
3287 Py_DECREF(pyresult);
3288 }
3289}
3290
3291template <typename ReturnT, typename... Args>
3292static ReturnT InvokePythonCallableReturning(PyObject* pyfunc,
3293 const char* format, Args... args) {
3294 // The const_cast is safe (it's here only because the python API is not
3295 // const-correct).
3296 return HandleResult<ReturnT>(
3297 PyObject_CallFunction(pyfunc, const_cast<char*>(format), args...));
3298}
3299
3300template <typename ReturnT>
3301static ReturnT InvokePythonCallableReturning(PyObject* pyfunc) {
3302 return HandleResult<ReturnT>(PyObject_CallFunctionObjArgs(pyfunc, nullptr));
3303}
3304
3305
3306
3309#include "ortools/sat/swig_helper.h"
3310
3311
3312#include <limits.h>
3313#if !defined(SWIG_NO_LLONG_MAX)
3314# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
3315# define LLONG_MAX __LONG_LONG_MAX__
3316# define LLONG_MIN (-LLONG_MAX - 1LL)
3317# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
3318# endif
3319#endif
3320
3321
3322#if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
3323# define SWIG_LONG_LONG_AVAILABLE
3324#endif
3325
3326
3327#ifdef SWIG_LONG_LONG_AVAILABLE
3328SWIGINTERNINLINE PyObject*
3329SWIG_From_long_SS_long (long long value)
3330{
3331 return ((value < LONG_MIN) || (value > LONG_MAX)) ?
3332 PyLong_FromLongLong(value) : PyInt_FromLong(static_cast< long >(value));
3333}
3334#endif
3335
3336
3337 #define SWIG_From_double PyFloat_FromDouble
3338
3339
3340SWIGINTERN int
3341SWIG_AsVal_double (PyObject *obj, double *val)
3342{
3343 int res = SWIG_TypeError;
3344 if (PyFloat_Check(obj)) {
3345 if (val) *val = PyFloat_AsDouble(obj);
3346 return SWIG_OK;
3347#if PY_VERSION_HEX < 0x03000000
3348 } else if (PyInt_Check(obj)) {
3349 if (val) *val = (double) PyInt_AsLong(obj);
3350 return SWIG_OK;
3351#endif
3352 } else if (PyLong_Check(obj)) {
3353 double v = PyLong_AsDouble(obj);
3354 if (!PyErr_Occurred()) {
3355 if (val) *val = v;
3356 return SWIG_OK;
3357 } else {
3358 PyErr_Clear();
3359 }
3360 }
3361#ifdef SWIG_PYTHON_CAST_MODE
3362 {
3363 int dispatch = 0;
3364 double d = PyFloat_AsDouble(obj);
3365 if (!PyErr_Occurred()) {
3366 if (val) *val = d;
3367 return SWIG_AddCast(SWIG_OK);
3368 } else {
3369 PyErr_Clear();
3370 }
3371 if (!dispatch) {
3372 long v = PyLong_AsLong(obj);
3373 if (!PyErr_Occurred()) {
3374 if (val) *val = v;
3376 } else {
3377 PyErr_Clear();
3378 }
3379 }
3380 }
3381#endif
3382 return res;
3383}
3384
3385
3386#include <float.h>
3387
3388
3389#include <math.h>
3390
3391
3393SWIG_CanCastAsInteger(double *d, double min, double max) {
3394 double x = *d;
3395 if ((min <= x && x <= max)) {
3396 double fx = floor(x);
3397 double cx = ceil(x);
3398 double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
3399 if ((errno == EDOM) || (errno == ERANGE)) {
3400 errno = 0;
3401 } else {
3402 double summ, reps, diff;
3403 if (rd < x) {
3404 diff = x - rd;
3405 } else if (rd > x) {
3406 diff = rd - x;
3407 } else {
3408 return 1;
3409 }
3410 summ = rd + x;
3411 reps = diff/summ;
3412 if (reps < 8*DBL_EPSILON) {
3413 *d = rd;
3414 return 1;
3415 }
3416 }
3417 }
3418 return 0;
3419}
3420
3421
3422SWIGINTERN int
3423SWIG_AsVal_long (PyObject *obj, long* val)
3424{
3425#if PY_VERSION_HEX < 0x03000000
3426 if (PyInt_Check(obj)) {
3427 if (val) *val = PyInt_AsLong(obj);
3428 return SWIG_OK;
3429 } else
3430#endif
3431 if (PyLong_Check(obj)) {
3432 long v = PyLong_AsLong(obj);
3433 if (!PyErr_Occurred()) {
3434 if (val) *val = v;
3435 return SWIG_OK;
3436 } else {
3437 PyErr_Clear();
3438 return SWIG_OverflowError;
3439 }
3440 }
3441#ifdef SWIG_PYTHON_CAST_MODE
3442 {
3443 int dispatch = 0;
3444 long v = PyInt_AsLong(obj);
3445 if (!PyErr_Occurred()) {
3446 if (val) *val = v;
3447 return SWIG_AddCast(SWIG_OK);
3448 } else {
3449 PyErr_Clear();
3450 }
3451 if (!dispatch) {
3452 double d;
3453 int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3454 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
3455 if (val) *val = (long)(d);
3456 return res;
3457 }
3458 }
3459 }
3460#endif
3461 return SWIG_TypeError;
3462}
3463
3464
3465SWIGINTERN int
3466SWIG_AsVal_int (PyObject * obj, int *val)
3467{
3468 long v;
3469 int res = SWIG_AsVal_long (obj, &v);
3470 if (SWIG_IsOK(res)) {
3471 if ((v < INT_MIN || v > INT_MAX)) {
3472 return SWIG_OverflowError;
3473 } else {
3474 if (val) *val = static_cast< int >(v);
3475 }
3476 }
3477 return res;
3478}
3479
3480
3481SWIGINTERNINLINE PyObject*
3483{
3484 return PyBool_FromLong(value ? 1 : 0);
3485}
3486
3487
3490{
3491 static int init = 0;
3492 static swig_type_info* info = 0;
3493 if (!init) {
3494 info = SWIG_TypeQuery("_p_char");
3495 init = 1;
3496 }
3497 return info;
3498}
3499
3500
3501SWIGINTERNINLINE PyObject *
3502SWIG_FromCharPtrAndSize(const char* carray, size_t size)
3503{
3504 if (carray) {
3505 if (size > INT_MAX) {
3506 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3507 return pchar_descriptor ?
3508 SWIG_InternalNewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
3509 } else {
3510#if PY_VERSION_HEX >= 0x03000000
3511#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3512 return PyBytes_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
3513#else
3514 return PyUnicode_DecodeUTF8(carray, static_cast< Py_ssize_t >(size), "surrogateescape");
3515#endif
3516#else
3517 return PyString_FromStringAndSize(carray, static_cast< Py_ssize_t >(size));
3518#endif
3519 }
3520 } else {
3521 return SWIG_Py_Void();
3522 }
3523}
3524
3525
3526SWIGINTERNINLINE PyObject *
3527SWIG_From_std_string (const std::string& s)
3528{
3529 return SWIG_FromCharPtrAndSize(s.data(), s.size());
3530}
3531
3532
3533SWIGINTERN int
3534SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
3535{
3536#if PY_VERSION_HEX>=0x03000000
3537#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3538 if (PyBytes_Check(obj))
3539#else
3540 if (PyUnicode_Check(obj))
3541#endif
3542#else
3543 if (PyString_Check(obj))
3544#endif
3545 {
3546 char *cstr; Py_ssize_t len;
3547 int ret = SWIG_OK;
3548#if PY_VERSION_HEX>=0x03000000
3549#if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3550 if (!alloc && cptr) {
3551 /* We can't allow converting without allocation, since the internal
3552 representation of string in Python 3 is UCS-2/UCS-4 but we require
3553 a UTF-8 representation.
3554 TODO(bhy) More detailed explanation */
3555 return SWIG_RuntimeError;
3556 }
3557 obj = PyUnicode_AsUTF8String(obj);
3558 if (!obj)
3559 return SWIG_TypeError;
3560 if (alloc)
3561 *alloc = SWIG_NEWOBJ;
3562#endif
3563 if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
3564 return SWIG_TypeError;
3565#else
3566 if (PyString_AsStringAndSize(obj, &cstr, &len) == -1)
3567 return SWIG_TypeError;
3568#endif
3569 if (cptr) {
3570 if (alloc) {
3571 if (*alloc == SWIG_NEWOBJ) {
3572 *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
3573 *alloc = SWIG_NEWOBJ;
3574 } else {
3575 *cptr = cstr;
3576 *alloc = SWIG_OLDOBJ;
3577 }
3578 } else {
3579#if PY_VERSION_HEX>=0x03000000
3580#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3581 *cptr = PyBytes_AsString(obj);
3582#else
3583 assert(0); /* Should never reach here with Unicode strings in Python 3 */
3584#endif
3585#else
3586 *cptr = SWIG_Python_str_AsChar(obj);
3587 if (!*cptr)
3588 ret = SWIG_TypeError;
3589#endif
3590 }
3591 }
3592 if (psize) *psize = len + 1;
3593#if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3594 Py_XDECREF(obj);
3595#endif
3596 return ret;
3597 } else {
3598#if defined(SWIG_PYTHON_2_UNICODE)
3599#if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3600#error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
3601#endif
3602#if PY_VERSION_HEX<0x03000000
3603 if (PyUnicode_Check(obj)) {
3604 char *cstr; Py_ssize_t len;
3605 if (!alloc && cptr) {
3606 return SWIG_RuntimeError;
3607 }
3608 obj = PyUnicode_AsUTF8String(obj);
3609 if (!obj)
3610 return SWIG_TypeError;
3611 if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
3612 if (cptr) {
3613 if (alloc) *alloc = SWIG_NEWOBJ;
3614 *cptr = reinterpret_cast< char* >(memcpy(new char[len + 1], cstr, sizeof(char)*(len + 1)));
3615 }
3616 if (psize) *psize = len + 1;
3617
3618 Py_XDECREF(obj);
3619 return SWIG_OK;
3620 } else {
3621 Py_XDECREF(obj);
3622 }
3623 }
3624#endif
3625#endif
3626
3627 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3628 if (pchar_descriptor) {
3629 void* vptr = 0;
3630 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
3631 if (cptr) *cptr = (char *) vptr;
3632 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
3633 if (alloc) *alloc = SWIG_OLDOBJ;
3634 return SWIG_OK;
3635 }
3636 }
3637 }
3638 return SWIG_TypeError;
3639}
3640
3641
3642SWIGINTERN int
3643SWIG_AsPtr_std_string (PyObject * obj, std::string **val)
3644{
3645 char* buf = 0 ; size_t size = 0; int alloc = SWIG_OLDOBJ;
3646 if (SWIG_IsOK((SWIG_AsCharPtrAndSize(obj, &buf, &size, &alloc)))) {
3647 if (buf) {
3648 if (val) *val = new std::string(buf, size - 1);
3649 if (alloc == SWIG_NEWOBJ) delete[] buf;
3650 return SWIG_NEWOBJ;
3651 } else {
3652 if (val) *val = 0;
3653 return SWIG_OLDOBJ;
3654 }
3655 } else {
3656 static int init = 0;
3657 static swig_type_info* descriptor = 0;
3658 if (!init) {
3659 descriptor = SWIG_TypeQuery("std::string" " *");
3660 init = 1;
3661 }
3662 if (descriptor) {
3663 std::string *vptr;
3664 int res = SWIG_ConvertPtr(obj, (void**)&vptr, descriptor, 0);
3665 if (SWIG_IsOK(res) && val) *val = vptr;
3666 return res;
3667 }
3668 }
3669 return SWIG_ERROR;
3670}
3671
3672
3673
3674/* ---------------------------------------------------
3675 * C++ director class methods
3676 * --------------------------------------------------- */
3677
3678#include "sat_python_wrap.h"
3679
3680SwigDirector_SolutionCallback::SwigDirector_SolutionCallback(PyObject *self): operations_research::sat::SolutionCallback(), Swig::Director(self) {
3681 SWIG_DIRECTOR_RGTR((operations_research::sat::SolutionCallback *)this, this);
3682}
3683
3684
3685
3686
3688}
3689
3692 {
3693 if (!swig_get_self()) {
3694 Swig::DirectorException::raise("'self' uninitialized, maybe you forgot to call SolutionCallback.__init__.");
3695 }
3696#if defined(SWIG_PYTHON_DIRECTOR_VTABLE)
3697 const size_t swig_method_index = 0;
3698 const char *const swig_method_name = "OnSolutionCallback";
3699 PyObject *method = swig_get_method(swig_method_index, swig_method_name);
3700 swig::SwigVar_PyObject args = PyTuple_New(0);
3701 swig::SwigVar_PyObject result = PyObject_Call(method, (PyObject *) args, NULL);
3702#else
3703 swig::SwigVar_PyObject swig_method_name = SWIG_Python_str_FromChar("OnSolutionCallback");
3704 swig::SwigVar_PyObject result = PyObject_CallMethodObjArgs(swig_get_self(), (PyObject *) swig_method_name, NULL);
3705#endif
3706 if (!result) {
3707 PyObject *error = PyErr_Occurred();
3708 if (error) {
3709 Swig::DirectorMethodException::raise("Error detected when calling 'SolutionCallback.OnSolutionCallback'");
3710 }
3711 }
3712 }
3714}
3715
3716
3717#ifdef __cplusplus
3718extern "C" {
3719#endif
3720SWIGINTERN PyObject *_wrap_delete_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3721 PyObject *resultobj = 0;
3722 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3723 void *argp1 = 0 ;
3724 int res1 = 0 ;
3725 PyObject *swig_obj[1] ;
3726
3727 if (!args) SWIG_fail;
3728 swig_obj[0] = args;
3730 if (!SWIG_IsOK(res1)) {
3731 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
3732 }
3733 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3734 {
3736 delete arg1;
3738 }
3739 resultobj = SWIG_Py_Void();
3740 return resultobj;
3741fail:
3742 return NULL;
3743}
3744
3745
3746SWIGINTERN PyObject *_wrap_SolutionCallback_OnSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3747 PyObject *resultobj = 0;
3748 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3749 void *argp1 = 0 ;
3750 int res1 = 0 ;
3751 PyObject *swig_obj[1] ;
3752 Swig::Director *director = 0;
3753 bool upcall = false;
3754
3755 if (!args) SWIG_fail;
3756 swig_obj[0] = args;
3758 if (!SWIG_IsOK(res1)) {
3759 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_OnSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3760 }
3761 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3762 director = SWIG_DIRECTOR_CAST(arg1);
3763 upcall = (director && (director->swig_get_self()==swig_obj[0]));
3764 try {
3765 if (upcall) {
3766 Swig::DirectorPureVirtualException::raise("operations_research::sat::SolutionCallback::OnSolutionCallback");
3767 } else {
3768 ((operations_research::sat::SolutionCallback const *)arg1)->OnSolutionCallback();
3769 }
3770 } catch (Swig::DirectorException&) {
3771 SWIG_fail;
3772 }
3773 resultobj = SWIG_Py_Void();
3774 return resultobj;
3775fail:
3776 return NULL;
3777}
3778
3779
3780SWIGINTERN PyObject *_wrap_SolutionCallback_NumBooleans(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3781 PyObject *resultobj = 0;
3782 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3783 void *argp1 = 0 ;
3784 int res1 = 0 ;
3785 PyObject *swig_obj[1] ;
3786 int64_t result;
3787
3788 if (!args) SWIG_fail;
3789 swig_obj[0] = args;
3791 if (!SWIG_IsOK(res1)) {
3792 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumBooleans" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3793 }
3794 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3795 {
3797 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumBooleans();
3799 }
3800 resultobj = SWIG_From_long_SS_long(static_cast< long long >(result));
3801 return resultobj;
3802fail:
3803 return NULL;
3804}
3805
3806
3807SWIGINTERN PyObject *_wrap_SolutionCallback_NumBranches(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3808 PyObject *resultobj = 0;
3809 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3810 void *argp1 = 0 ;
3811 int res1 = 0 ;
3812 PyObject *swig_obj[1] ;
3813 int64_t result;
3814
3815 if (!args) SWIG_fail;
3816 swig_obj[0] = args;
3818 if (!SWIG_IsOK(res1)) {
3819 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumBranches" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3820 }
3821 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3822 {
3824 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumBranches();
3826 }
3827 resultobj = SWIG_From_long_SS_long(static_cast< long long >(result));
3828 return resultobj;
3829fail:
3830 return NULL;
3831}
3832
3833
3834SWIGINTERN PyObject *_wrap_SolutionCallback_NumConflicts(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3835 PyObject *resultobj = 0;
3836 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3837 void *argp1 = 0 ;
3838 int res1 = 0 ;
3839 PyObject *swig_obj[1] ;
3840 int64_t result;
3841
3842 if (!args) SWIG_fail;
3843 swig_obj[0] = args;
3845 if (!SWIG_IsOK(res1)) {
3846 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumConflicts" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3847 }
3848 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3849 {
3851 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumConflicts();
3853 }
3854 resultobj = SWIG_From_long_SS_long(static_cast< long long >(result));
3855 return resultobj;
3856fail:
3857 return NULL;
3858}
3859
3860
3862 PyObject *resultobj = 0;
3863 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3864 void *argp1 = 0 ;
3865 int res1 = 0 ;
3866 PyObject *swig_obj[1] ;
3867 int64_t result;
3868
3869 if (!args) SWIG_fail;
3870 swig_obj[0] = args;
3872 if (!SWIG_IsOK(res1)) {
3873 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumBinaryPropagations" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3874 }
3875 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3876 {
3878 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumBinaryPropagations();
3880 }
3881 resultobj = SWIG_From_long_SS_long(static_cast< long long >(result));
3882 return resultobj;
3883fail:
3884 return NULL;
3885}
3886
3887
3889 PyObject *resultobj = 0;
3890 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3891 void *argp1 = 0 ;
3892 int res1 = 0 ;
3893 PyObject *swig_obj[1] ;
3894 int64_t result;
3895
3896 if (!args) SWIG_fail;
3897 swig_obj[0] = args;
3899 if (!SWIG_IsOK(res1)) {
3900 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_NumIntegerPropagations" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3901 }
3902 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3903 {
3905 result = (int64_t)((operations_research::sat::SolutionCallback const *)arg1)->NumIntegerPropagations();
3907 }
3908 resultobj = SWIG_From_long_SS_long(static_cast< long long >(result));
3909 return resultobj;
3910fail:
3911 return NULL;
3912}
3913
3914
3915SWIGINTERN PyObject *_wrap_SolutionCallback_WallTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3916 PyObject *resultobj = 0;
3917 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3918 void *argp1 = 0 ;
3919 int res1 = 0 ;
3920 PyObject *swig_obj[1] ;
3921 double result;
3922
3923 if (!args) SWIG_fail;
3924 swig_obj[0] = args;
3926 if (!SWIG_IsOK(res1)) {
3927 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_WallTime" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3928 }
3929 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3930 {
3932 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->WallTime();
3934 }
3935 resultobj = SWIG_From_double(static_cast< double >(result));
3936 return resultobj;
3937fail:
3938 return NULL;
3939}
3940
3941
3942SWIGINTERN PyObject *_wrap_SolutionCallback_UserTime(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3943 PyObject *resultobj = 0;
3944 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3945 void *argp1 = 0 ;
3946 int res1 = 0 ;
3947 PyObject *swig_obj[1] ;
3948 double result;
3949
3950 if (!args) SWIG_fail;
3951 swig_obj[0] = args;
3953 if (!SWIG_IsOK(res1)) {
3954 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_UserTime" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3955 }
3956 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3957 {
3959 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->UserTime();
3961 }
3962 resultobj = SWIG_From_double(static_cast< double >(result));
3963 return resultobj;
3964fail:
3965 return NULL;
3966}
3967
3968
3969SWIGINTERN PyObject *_wrap_SolutionCallback_ObjectiveValue(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3970 PyObject *resultobj = 0;
3971 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3972 void *argp1 = 0 ;
3973 int res1 = 0 ;
3974 PyObject *swig_obj[1] ;
3975 double result;
3976
3977 if (!args) SWIG_fail;
3978 swig_obj[0] = args;
3980 if (!SWIG_IsOK(res1)) {
3981 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_ObjectiveValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
3982 }
3983 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
3984 {
3986 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->ObjectiveValue();
3988 }
3989 resultobj = SWIG_From_double(static_cast< double >(result));
3990 return resultobj;
3991fail:
3992 return NULL;
3993}
3994
3995
3996SWIGINTERN PyObject *_wrap_SolutionCallback_BestObjectiveBound(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3997 PyObject *resultobj = 0;
3998 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
3999 void *argp1 = 0 ;
4000 int res1 = 0 ;
4001 PyObject *swig_obj[1] ;
4002 double result;
4003
4004 if (!args) SWIG_fail;
4005 swig_obj[0] = args;
4007 if (!SWIG_IsOK(res1)) {
4008 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_BestObjectiveBound" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4009 }
4010 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4011 {
4013 result = (double)((operations_research::sat::SolutionCallback const *)arg1)->BestObjectiveBound();
4015 }
4016 resultobj = SWIG_From_double(static_cast< double >(result));
4017 return resultobj;
4018fail:
4019 return NULL;
4020}
4021
4022
4024 PyObject *resultobj = 0;
4025 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4026 int arg2 ;
4027 void *argp1 = 0 ;
4028 int res1 = 0 ;
4029 int val2 ;
4030 int ecode2 = 0 ;
4031 PyObject *swig_obj[2] ;
4032 int64_t result;
4033
4034 if (!SWIG_Python_UnpackTuple(args, "SolutionCallback_SolutionIntegerValue", 2, 2, swig_obj)) SWIG_fail;
4036 if (!SWIG_IsOK(res1)) {
4037 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_SolutionIntegerValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4038 }
4039 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4040 ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
4041 if (!SWIG_IsOK(ecode2)) {
4042 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SolutionCallback_SolutionIntegerValue" "', argument " "2"" of type '" "int""'");
4043 }
4044 arg2 = static_cast< int >(val2);
4045 {
4047 result = (int64_t)(arg1)->SolutionIntegerValue(arg2);
4049 }
4050 resultobj = SWIG_From_long_SS_long(static_cast< long long >(result));
4051 return resultobj;
4052fail:
4053 return NULL;
4054}
4055
4056
4058 PyObject *resultobj = 0;
4059 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4060 int arg2 ;
4061 void *argp1 = 0 ;
4062 int res1 = 0 ;
4063 int val2 ;
4064 int ecode2 = 0 ;
4065 PyObject *swig_obj[2] ;
4066 bool result;
4067
4068 if (!SWIG_Python_UnpackTuple(args, "SolutionCallback_SolutionBooleanValue", 2, 2, swig_obj)) SWIG_fail;
4070 if (!SWIG_IsOK(res1)) {
4071 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_SolutionBooleanValue" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4072 }
4073 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4074 ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
4075 if (!SWIG_IsOK(ecode2)) {
4076 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SolutionCallback_SolutionBooleanValue" "', argument " "2"" of type '" "int""'");
4077 }
4078 arg2 = static_cast< int >(val2);
4079 {
4081 result = (bool)(arg1)->SolutionBooleanValue(arg2);
4083 }
4084 resultobj = SWIG_From_bool(static_cast< bool >(result));
4085 return resultobj;
4086fail:
4087 return NULL;
4088}
4089
4090
4091SWIGINTERN PyObject *_wrap_SolutionCallback_StopSearch(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4092 PyObject *resultobj = 0;
4093 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4094 void *argp1 = 0 ;
4095 int res1 = 0 ;
4096 PyObject *swig_obj[1] ;
4097
4098 if (!args) SWIG_fail;
4099 swig_obj[0] = args;
4101 if (!SWIG_IsOK(res1)) {
4102 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_StopSearch" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4103 }
4104 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4105 {
4107 (arg1)->StopSearch();
4109 }
4110 resultobj = SWIG_Py_Void();
4111 return resultobj;
4112fail:
4113 return NULL;
4114}
4115
4116
4117SWIGINTERN PyObject *_wrap_SolutionCallback_Response(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4118 PyObject *resultobj = 0;
4119 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4120 void *argp1 = 0 ;
4121 int res1 = 0 ;
4122 PyObject *swig_obj[1] ;
4124
4125 if (!args) SWIG_fail;
4126 swig_obj[0] = args;
4128 if (!SWIG_IsOK(res1)) {
4129 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_Response" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4130 }
4131 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4132 {
4134 result = ((operations_research::sat::SolutionCallback const *)arg1)->Response();
4136 }
4137 {
4138 PyObject* const module = PyImport_ImportModule("ortools.sat.cp_model_pb2");
4139 if (module != nullptr) {
4140 PyObject* const dict = PyModule_GetDict(module);
4141 if (dict != nullptr) {
4142 PyObject* const clss = PyDict_GetItemString(dict, "CpSolverResponse");
4143 if (clss != nullptr) {
4144 std::string encoded_protobuf;
4145 (&result)->SerializeToString(&encoded_protobuf);
4146
4147 PyObject* const python_encoded_protobuf = PyBytes_FromStringAndSize(
4148 encoded_protobuf.c_str(), encoded_protobuf.size());
4149
4150
4151
4152
4153 PyObject* const result = PyObject_CallMethod(
4154 clss, const_cast<char*>("FromString"),
4155 const_cast<char*>("(O)"),
4156 python_encoded_protobuf);
4157 Py_DECREF(python_encoded_protobuf);
4158 resultobj = result;
4159 }
4160 }
4161 Py_DECREF(module);
4162 }
4163 }
4164 return resultobj;
4165fail:
4166 return NULL;
4167}
4168
4169
4170SWIGINTERN PyObject *_wrap_SolutionCallback_HasResponse(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4171 PyObject *resultobj = 0;
4172 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4173 void *argp1 = 0 ;
4174 int res1 = 0 ;
4175 PyObject *swig_obj[1] ;
4176 bool result;
4177
4178 if (!args) SWIG_fail;
4179 swig_obj[0] = args;
4181 if (!SWIG_IsOK(res1)) {
4182 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolutionCallback_HasResponse" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback const *""'");
4183 }
4184 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4185 {
4187 result = (bool)((operations_research::sat::SolutionCallback const *)arg1)->HasResponse();
4189 }
4190 resultobj = SWIG_From_bool(static_cast< bool >(result));
4191 return resultobj;
4192fail:
4193 return NULL;
4194}
4195
4196
4197SWIGINTERN PyObject *_wrap_new_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4198 PyObject *resultobj = 0;
4199 PyObject *arg1 = (PyObject *) 0 ;
4200 PyObject *swig_obj[1] ;
4201 operations_research::sat::SolutionCallback *result = 0 ;
4202
4203 if (!args) SWIG_fail;
4204 swig_obj[0] = args;
4205 arg1 = swig_obj[0];
4206 {
4208 if ( arg1 != Py_None ) {
4209 /* subclassed */
4210 result = (operations_research::sat::SolutionCallback *)new SwigDirector_SolutionCallback(arg1);
4211 } else {
4212 SWIG_SetErrorMsg(PyExc_RuntimeError,"accessing abstract class or protected constructor");
4213 SWIG_fail;
4214 }
4215
4217 }
4219 return resultobj;
4220fail:
4221 return NULL;
4222}
4223
4224
4225SWIGINTERN PyObject *_wrap_disown_SolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4226 PyObject *resultobj = 0;
4227 operations_research::sat::SolutionCallback *arg1 = (operations_research::sat::SolutionCallback *) 0 ;
4228 void *argp1 = 0 ;
4229 int res1 = 0 ;
4230 PyObject *swig_obj[1] ;
4231
4232 if (!args) SWIG_fail;
4233 swig_obj[0] = args;
4235 if (!SWIG_IsOK(res1)) {
4236 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "disown_SolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolutionCallback *""'");
4237 }
4238 arg1 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp1);
4239 {
4241 {
4242 Swig::Director *director = SWIG_DIRECTOR_CAST(arg1);
4243 if (director) director->swig_disown();
4244 }
4245
4247 }
4248 resultobj = SWIG_Py_Void();
4249 return resultobj;
4250fail:
4251 return NULL;
4252}
4253
4254
4255SWIGINTERN PyObject *SolutionCallback_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4256 PyObject *obj;
4257 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
4259 return SWIG_Py_Void();
4260}
4261
4262SWIGINTERN PyObject *SolutionCallback_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4263 return SWIG_Python_InitShadowInstance(args);
4264}
4265
4266SWIGINTERN PyObject *_wrap_SolveWrapper_SetParameters(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4267 PyObject *resultobj = 0;
4268 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4270 void *argp1 = 0 ;
4271 int res1 = 0 ;
4272 PyObject *swig_obj[2] ;
4273
4274 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_SetParameters", 2, 2, swig_obj)) SWIG_fail;
4275 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4276 if (!SWIG_IsOK(res1)) {
4277 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_SetParameters" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4278 }
4279 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4280 {
4282 PyObject* const pyresult = PyObject_CallMethod(
4283 swig_obj[1], const_cast<char*>("SerializeToString"), nullptr);
4284 if (pyresult != nullptr) {
4285 char* buffer = nullptr;
4286 Py_ssize_t length = 0;
4287 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4288 if (buffer != nullptr) {
4289 arg2->ParseFromArray(buffer, length);
4290 }
4291 Py_DECREF(pyresult);
4292 }
4293 }
4294 {
4296 (arg1)->SetParameters((operations_research::sat::SatParameters const &)*arg2);
4298 }
4299 resultobj = SWIG_Py_Void();
4300 {
4301 delete arg2;
4302 }
4303 return resultobj;
4304fail:
4305 {
4306 delete arg2;
4307 }
4308 return NULL;
4309}
4310
4311
4312SWIGINTERN PyObject *_wrap_SolveWrapper_AddSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4313 PyObject *resultobj = 0;
4314 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4315 operations_research::sat::SolutionCallback *arg2 = 0 ;
4316 void *argp1 = 0 ;
4317 int res1 = 0 ;
4318 void *argp2 = 0 ;
4319 int res2 = 0 ;
4320 PyObject *swig_obj[2] ;
4321
4322 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_AddSolutionCallback", 2, 2, swig_obj)) SWIG_fail;
4323 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4324 if (!SWIG_IsOK(res1)) {
4325 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_AddSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4326 }
4327 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4329 if (!SWIG_IsOK(res2)) {
4330 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SolveWrapper_AddSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4331 }
4332 if (!argp2) {
4333 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SolveWrapper_AddSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4334 }
4335 arg2 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp2);
4336 {
4338 (arg1)->AddSolutionCallback((operations_research::sat::SolutionCallback const &)*arg2);
4340 }
4341 resultobj = SWIG_Py_Void();
4342 return resultobj;
4343fail:
4344 return NULL;
4345}
4346
4347
4348SWIGINTERN PyObject *_wrap_SolveWrapper_ClearSolutionCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4349 PyObject *resultobj = 0;
4350 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4351 operations_research::sat::SolutionCallback *arg2 = 0 ;
4352 void *argp1 = 0 ;
4353 int res1 = 0 ;
4354 void *argp2 = 0 ;
4355 int res2 = 0 ;
4356 PyObject *swig_obj[2] ;
4357
4358 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_ClearSolutionCallback", 2, 2, swig_obj)) SWIG_fail;
4359 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4360 if (!SWIG_IsOK(res1)) {
4361 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_ClearSolutionCallback" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4362 }
4363 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4365 if (!SWIG_IsOK(res2)) {
4366 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SolveWrapper_ClearSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4367 }
4368 if (!argp2) {
4369 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SolveWrapper_ClearSolutionCallback" "', argument " "2"" of type '" "operations_research::sat::SolutionCallback const &""'");
4370 }
4371 arg2 = reinterpret_cast< operations_research::sat::SolutionCallback * >(argp2);
4372 {
4374 (arg1)->ClearSolutionCallback((operations_research::sat::SolutionCallback const &)*arg2);
4376 }
4377 resultobj = SWIG_Py_Void();
4378 return resultobj;
4379fail:
4380 return NULL;
4381}
4382
4383
4384SWIGINTERN PyObject *_wrap_SolveWrapper_AddLogCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4385 PyObject *resultobj = 0;
4386 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4387 SwigValueWrapper< std::function< void (std::string const &) > > arg2 ;
4388 void *argp1 = 0 ;
4389 int res1 = 0 ;
4390 PyObject *swig_obj[2] ;
4391
4392 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_AddLogCallback", 2, 2, swig_obj)) SWIG_fail;
4393 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4394 if (!SWIG_IsOK(res1)) {
4395 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_AddLogCallback" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4396 }
4397 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4398 {
4399 SharedPyPtr input(swig_obj[1]);
4400 arg2 = [input](const std::string& str) {
4401 PyObject* py_str = PyUnicode_FromStringAndSize(str.c_str(), str.size());
4402 PyObject* result;
4404 result = PyObject_CallFunction(input.get(), "O", py_str);
4406 Py_DECREF(py_str);
4407 return result;
4408 };
4409 }
4410 {
4412 (arg1)->AddLogCallback(arg2);
4414 }
4415 resultobj = SWIG_Py_Void();
4416 return resultobj;
4417fail:
4418 return NULL;
4419}
4420
4421
4422SWIGINTERN PyObject *_wrap_SolveWrapper_Solve(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4423 PyObject *resultobj = 0;
4424 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4426 void *argp1 = 0 ;
4427 int res1 = 0 ;
4428 PyObject *swig_obj[2] ;
4430
4431 if (!SWIG_Python_UnpackTuple(args, "SolveWrapper_Solve", 2, 2, swig_obj)) SWIG_fail;
4432 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4433 if (!SWIG_IsOK(res1)) {
4434 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_Solve" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4435 }
4436 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4437 {
4439 PyObject* const pyresult = PyObject_CallMethod(
4440 swig_obj[1], const_cast<char*>("SerializeToString"), nullptr);
4441 if (pyresult != nullptr) {
4442 char* buffer = nullptr;
4443 Py_ssize_t length = 0;
4444 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4445 if (buffer != nullptr) {
4446 arg2->ParseFromArray(buffer, length);
4447 }
4448 Py_DECREF(pyresult);
4449 }
4450 }
4451 {
4453 result = (arg1)->Solve((operations_research::sat::CpModelProto const &)*arg2);
4455 }
4456 {
4457 PyObject* const module = PyImport_ImportModule("ortools.sat.cp_model_pb2");
4458 if (module != nullptr) {
4459 PyObject* const dict = PyModule_GetDict(module);
4460 if (dict != nullptr) {
4461 PyObject* const clss = PyDict_GetItemString(dict, "CpSolverResponse");
4462 if (clss != nullptr) {
4463 std::string encoded_protobuf;
4464 (&result)->SerializeToString(&encoded_protobuf);
4465
4466 PyObject* const python_encoded_protobuf = PyBytes_FromStringAndSize(
4467 encoded_protobuf.c_str(), encoded_protobuf.size());
4468
4469
4470
4471
4472 PyObject* const result = PyObject_CallMethod(
4473 clss, const_cast<char*>("FromString"),
4474 const_cast<char*>("(O)"),
4475 python_encoded_protobuf);
4476 Py_DECREF(python_encoded_protobuf);
4477 resultobj = result;
4478 }
4479 }
4480 Py_DECREF(module);
4481 }
4482 }
4483 {
4484 delete arg2;
4485 }
4486 return resultobj;
4487fail:
4488 {
4489 delete arg2;
4490 }
4491 return NULL;
4492}
4493
4494
4495SWIGINTERN PyObject *_wrap_SolveWrapper_StopSearch(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4496 PyObject *resultobj = 0;
4497 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4498 void *argp1 = 0 ;
4499 int res1 = 0 ;
4500 PyObject *swig_obj[1] ;
4501
4502 if (!args) SWIG_fail;
4503 swig_obj[0] = args;
4504 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_operations_research__sat__SolveWrapper, 0 | 0 );
4505 if (!SWIG_IsOK(res1)) {
4506 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SolveWrapper_StopSearch" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4507 }
4508 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4509 {
4511 (arg1)->StopSearch();
4513 }
4514 resultobj = SWIG_Py_Void();
4515 return resultobj;
4516fail:
4517 return NULL;
4518}
4519
4520
4521SWIGINTERN PyObject *_wrap_new_SolveWrapper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4522 PyObject *resultobj = 0;
4523 operations_research::sat::SolveWrapper *result = 0 ;
4524
4525 if (!SWIG_Python_UnpackTuple(args, "new_SolveWrapper", 0, 0, 0)) SWIG_fail;
4526 {
4528 result = (operations_research::sat::SolveWrapper *)new operations_research::sat::SolveWrapper();
4530 }
4532 return resultobj;
4533fail:
4534 return NULL;
4535}
4536
4537
4538SWIGINTERN PyObject *_wrap_delete_SolveWrapper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4539 PyObject *resultobj = 0;
4540 operations_research::sat::SolveWrapper *arg1 = (operations_research::sat::SolveWrapper *) 0 ;
4541 void *argp1 = 0 ;
4542 int res1 = 0 ;
4543 PyObject *swig_obj[1] ;
4544
4545 if (!args) SWIG_fail;
4546 swig_obj[0] = args;
4548 if (!SWIG_IsOK(res1)) {
4549 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SolveWrapper" "', argument " "1"" of type '" "operations_research::sat::SolveWrapper *""'");
4550 }
4551 arg1 = reinterpret_cast< operations_research::sat::SolveWrapper * >(argp1);
4552 {
4554 delete arg1;
4556 }
4557 resultobj = SWIG_Py_Void();
4558 return resultobj;
4559fail:
4560 return NULL;
4561}
4562
4563
4564SWIGINTERN PyObject *SolveWrapper_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4565 PyObject *obj;
4566 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
4568 return SWIG_Py_Void();
4569}
4570
4571SWIGINTERN PyObject *SolveWrapper_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4572 return SWIG_Python_InitShadowInstance(args);
4573}
4574
4575SWIGINTERN PyObject *_wrap_CpSatHelper_ModelStats(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4576 PyObject *resultobj = 0;
4578 PyObject *swig_obj[1] ;
4579 std::string result;
4580
4581 if (!args) SWIG_fail;
4582 swig_obj[0] = args;
4583 {
4585 PyObject* const pyresult = PyObject_CallMethod(
4586 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4587 if (pyresult != nullptr) {
4588 char* buffer = nullptr;
4589 Py_ssize_t length = 0;
4590 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4591 if (buffer != nullptr) {
4592 arg1->ParseFromArray(buffer, length);
4593 }
4594 Py_DECREF(pyresult);
4595 }
4596 }
4597 {
4599 result = operations_research::sat::CpSatHelper::ModelStats((operations_research::sat::CpModelProto const &)*arg1);
4601 }
4602 resultobj = SWIG_From_std_string(static_cast< std::string >(result));
4603 {
4604 delete arg1;
4605 }
4606 return resultobj;
4607fail:
4608 {
4609 delete arg1;
4610 }
4611 return NULL;
4612}
4613
4614
4615SWIGINTERN PyObject *_wrap_CpSatHelper_SolverResponseStats(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4616 PyObject *resultobj = 0;
4618 PyObject *swig_obj[1] ;
4619 std::string result;
4620
4621 if (!args) SWIG_fail;
4622 swig_obj[0] = args;
4623 {
4625 PyObject* const pyresult = PyObject_CallMethod(
4626 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4627 if (pyresult != nullptr) {
4628 char* buffer = nullptr;
4629 Py_ssize_t length = 0;
4630 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4631 if (buffer != nullptr) {
4632 arg1->ParseFromArray(buffer, length);
4633 }
4634 Py_DECREF(pyresult);
4635 }
4636 }
4637 {
4639 result = operations_research::sat::CpSatHelper::SolverResponseStats((operations_research::sat::CpSolverResponse const &)*arg1);
4641 }
4642 resultobj = SWIG_From_std_string(static_cast< std::string >(result));
4643 {
4644 delete arg1;
4645 }
4646 return resultobj;
4647fail:
4648 {
4649 delete arg1;
4650 }
4651 return NULL;
4652}
4653
4654
4655SWIGINTERN PyObject *_wrap_CpSatHelper_ValidateModel(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4656 PyObject *resultobj = 0;
4658 PyObject *swig_obj[1] ;
4659 std::string result;
4660
4661 if (!args) SWIG_fail;
4662 swig_obj[0] = args;
4663 {
4665 PyObject* const pyresult = PyObject_CallMethod(
4666 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4667 if (pyresult != nullptr) {
4668 char* buffer = nullptr;
4669 Py_ssize_t length = 0;
4670 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4671 if (buffer != nullptr) {
4672 arg1->ParseFromArray(buffer, length);
4673 }
4674 Py_DECREF(pyresult);
4675 }
4676 }
4677 {
4681 }
4682 resultobj = SWIG_From_std_string(static_cast< std::string >(result));
4683 {
4684 delete arg1;
4685 }
4686 return resultobj;
4687fail:
4688 {
4689 delete arg1;
4690 }
4691 return NULL;
4692}
4693
4694
4695SWIGINTERN PyObject *_wrap_CpSatHelper_VariableDomain(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4696 PyObject *resultobj = 0;
4698 void *argp1 = 0 ;
4699 int res1 = 0 ;
4700 PyObject *swig_obj[1] ;
4702
4703 if (!args) SWIG_fail;
4704 swig_obj[0] = args;
4706 if (!SWIG_IsOK(res1)) {
4707 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CpSatHelper_VariableDomain" "', argument " "1"" of type '" "operations_research::sat::IntegerVariableProto const &""'");
4708 }
4709 if (!argp1) {
4710 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CpSatHelper_VariableDomain" "', argument " "1"" of type '" "operations_research::sat::IntegerVariableProto const &""'");
4711 }
4712 arg1 = reinterpret_cast< operations_research::sat::IntegerVariableProto * >(argp1);
4713 {
4715 result = operations_research::sat::CpSatHelper::VariableDomain((operations_research::sat::IntegerVariableProto const &)*arg1);
4717 }
4719 return resultobj;
4720fail:
4721 return NULL;
4722}
4723
4724
4725SWIGINTERN PyObject *_wrap_CpSatHelper_WriteModelToFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4726 PyObject *resultobj = 0;
4728 std::string *arg2 = 0 ;
4729 int res2 = SWIG_OLDOBJ ;
4730 PyObject *swig_obj[2] ;
4731 bool result;
4732
4733 if (!SWIG_Python_UnpackTuple(args, "CpSatHelper_WriteModelToFile", 2, 2, swig_obj)) SWIG_fail;
4734 {
4736 PyObject* const pyresult = PyObject_CallMethod(
4737 swig_obj[0], const_cast<char*>("SerializeToString"), nullptr);
4738 if (pyresult != nullptr) {
4739 char* buffer = nullptr;
4740 Py_ssize_t length = 0;
4741 int result = PyString_AsStringAndSize(pyresult, &buffer, &length);
4742 if (buffer != nullptr) {
4743 arg1->ParseFromArray(buffer, length);
4744 }
4745 Py_DECREF(pyresult);
4746 }
4747 }
4748 {
4749 std::string *ptr = (std::string *)0;
4750 res2 = SWIG_AsPtr_std_string(swig_obj[1], &ptr);
4751 if (!SWIG_IsOK(res2)) {
4752 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CpSatHelper_WriteModelToFile" "', argument " "2"" of type '" "std::string const &""'");
4753 }
4754 if (!ptr) {
4755 SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CpSatHelper_WriteModelToFile" "', argument " "2"" of type '" "std::string const &""'");
4756 }
4757 arg2 = ptr;
4758 }
4759 {
4761 result = (bool)operations_research::sat::CpSatHelper::WriteModelToFile((operations_research::sat::CpModelProto const &)*arg1,(std::string const &)*arg2);
4763 }
4764 resultobj = SWIG_From_bool(static_cast< bool >(result));
4765 {
4766 delete arg1;
4767 }
4768 if (SWIG_IsNewObj(res2)) delete arg2;
4769 return resultobj;
4770fail:
4771 {
4772 delete arg1;
4773 }
4774 if (SWIG_IsNewObj(res2)) delete arg2;
4775 return NULL;
4776}
4777
4778
4779SWIGINTERN PyObject *_wrap_new_CpSatHelper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4780 PyObject *resultobj = 0;
4781 operations_research::sat::CpSatHelper *result = 0 ;
4782
4783 if (!SWIG_Python_UnpackTuple(args, "new_CpSatHelper", 0, 0, 0)) SWIG_fail;
4784 {
4786 result = (operations_research::sat::CpSatHelper *)new operations_research::sat::CpSatHelper();
4788 }
4790 return resultobj;
4791fail:
4792 return NULL;
4793}
4794
4795
4796SWIGINTERN PyObject *_wrap_delete_CpSatHelper(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4797 PyObject *resultobj = 0;
4798 operations_research::sat::CpSatHelper *arg1 = (operations_research::sat::CpSatHelper *) 0 ;
4799 void *argp1 = 0 ;
4800 int res1 = 0 ;
4801 PyObject *swig_obj[1] ;
4802
4803 if (!args) SWIG_fail;
4804 swig_obj[0] = args;
4806 if (!SWIG_IsOK(res1)) {
4807 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CpSatHelper" "', argument " "1"" of type '" "operations_research::sat::CpSatHelper *""'");
4808 }
4809 arg1 = reinterpret_cast< operations_research::sat::CpSatHelper * >(argp1);
4810 {
4812 delete arg1;
4814 }
4815 resultobj = SWIG_Py_Void();
4816 return resultobj;
4817fail:
4818 return NULL;
4819}
4820
4821
4822SWIGINTERN PyObject *CpSatHelper_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4823 PyObject *obj;
4824 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
4826 return SWIG_Py_Void();
4827}
4828
4829SWIGINTERN PyObject *CpSatHelper_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4830 return SWIG_Python_InitShadowInstance(args);
4831}
4832
4833static PyMethodDef SwigMethods[] = {
4834 { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
4835 { "delete_SolutionCallback", _wrap_delete_SolutionCallback, METH_O, NULL},
4836 { "SolutionCallback_OnSolutionCallback", _wrap_SolutionCallback_OnSolutionCallback, METH_O, NULL},
4837 { "SolutionCallback_NumBooleans", _wrap_SolutionCallback_NumBooleans, METH_O, NULL},
4838 { "SolutionCallback_NumBranches", _wrap_SolutionCallback_NumBranches, METH_O, NULL},
4839 { "SolutionCallback_NumConflicts", _wrap_SolutionCallback_NumConflicts, METH_O, NULL},
4840 { "SolutionCallback_NumBinaryPropagations", _wrap_SolutionCallback_NumBinaryPropagations, METH_O, NULL},
4841 { "SolutionCallback_NumIntegerPropagations", _wrap_SolutionCallback_NumIntegerPropagations, METH_O, NULL},
4842 { "SolutionCallback_WallTime", _wrap_SolutionCallback_WallTime, METH_O, NULL},
4843 { "SolutionCallback_UserTime", _wrap_SolutionCallback_UserTime, METH_O, NULL},
4844 { "SolutionCallback_ObjectiveValue", _wrap_SolutionCallback_ObjectiveValue, METH_O, NULL},
4845 { "SolutionCallback_BestObjectiveBound", _wrap_SolutionCallback_BestObjectiveBound, METH_O, NULL},
4846 { "SolutionCallback_SolutionIntegerValue", _wrap_SolutionCallback_SolutionIntegerValue, METH_VARARGS, NULL},
4847 { "SolutionCallback_SolutionBooleanValue", _wrap_SolutionCallback_SolutionBooleanValue, METH_VARARGS, NULL},
4848 { "SolutionCallback_StopSearch", _wrap_SolutionCallback_StopSearch, METH_O, NULL},
4849 { "SolutionCallback_Response", _wrap_SolutionCallback_Response, METH_O, NULL},
4850 { "SolutionCallback_HasResponse", _wrap_SolutionCallback_HasResponse, METH_O, NULL},
4851 { "new_SolutionCallback", _wrap_new_SolutionCallback, METH_O, NULL},
4852 { "disown_SolutionCallback", _wrap_disown_SolutionCallback, METH_O, NULL},
4853 { "SolutionCallback_swigregister", SolutionCallback_swigregister, METH_O, NULL},
4854 { "SolutionCallback_swiginit", SolutionCallback_swiginit, METH_VARARGS, NULL},
4855 { "SolveWrapper_SetParameters", _wrap_SolveWrapper_SetParameters, METH_VARARGS, NULL},
4856 { "SolveWrapper_AddSolutionCallback", _wrap_SolveWrapper_AddSolutionCallback, METH_VARARGS, NULL},
4857 { "SolveWrapper_ClearSolutionCallback", _wrap_SolveWrapper_ClearSolutionCallback, METH_VARARGS, NULL},
4858 { "SolveWrapper_AddLogCallback", _wrap_SolveWrapper_AddLogCallback, METH_VARARGS, NULL},
4859 { "SolveWrapper_Solve", _wrap_SolveWrapper_Solve, METH_VARARGS, NULL},
4860 { "SolveWrapper_StopSearch", _wrap_SolveWrapper_StopSearch, METH_O, NULL},
4861 { "new_SolveWrapper", _wrap_new_SolveWrapper, METH_NOARGS, NULL},
4862 { "delete_SolveWrapper", _wrap_delete_SolveWrapper, METH_O, NULL},
4863 { "SolveWrapper_swigregister", SolveWrapper_swigregister, METH_O, NULL},
4864 { "SolveWrapper_swiginit", SolveWrapper_swiginit, METH_VARARGS, NULL},
4865 { "CpSatHelper_ModelStats", _wrap_CpSatHelper_ModelStats, METH_O, NULL},
4866 { "CpSatHelper_SolverResponseStats", _wrap_CpSatHelper_SolverResponseStats, METH_O, NULL},
4867 { "CpSatHelper_ValidateModel", _wrap_CpSatHelper_ValidateModel, METH_O, NULL},
4868 { "CpSatHelper_VariableDomain", _wrap_CpSatHelper_VariableDomain, METH_O, NULL},
4869 { "CpSatHelper_WriteModelToFile", _wrap_CpSatHelper_WriteModelToFile, METH_VARARGS, NULL},
4870 { "new_CpSatHelper", _wrap_new_CpSatHelper, METH_NOARGS, NULL},
4871 { "delete_CpSatHelper", _wrap_delete_CpSatHelper, METH_O, NULL},
4872 { "CpSatHelper_swigregister", CpSatHelper_swigregister, METH_O, NULL},
4873 { "CpSatHelper_swiginit", CpSatHelper_swiginit, METH_VARARGS, NULL},
4874 { NULL, NULL, 0, NULL }
4875};
4876
4877static PyMethodDef SwigMethods_proxydocs[] = {
4878 { NULL, NULL, 0, NULL }
4879};
4880
4881
4882/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4883
4884static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
4885static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
4886static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
4887static swig_type_info _swigt__p_operations_research__Domain = {"_p_operations_research__Domain", "operations_research::Domain *", 0, 0, (void*)0, 0};
4888static swig_type_info _swigt__p_operations_research__sat__CpSatHelper = {"_p_operations_research__sat__CpSatHelper", "operations_research::sat::CpSatHelper *", 0, 0, (void*)0, 0};
4889static swig_type_info _swigt__p_operations_research__sat__IntegerVariableProto = {"_p_operations_research__sat__IntegerVariableProto", "operations_research::sat::IntegerVariableProto *", 0, 0, (void*)0, 0};
4890static swig_type_info _swigt__p_operations_research__sat__SolutionCallback = {"_p_operations_research__sat__SolutionCallback", "operations_research::sat::SolutionCallback *", 0, 0, (void*)0, 0};
4891static swig_type_info _swigt__p_operations_research__sat__SolveWrapper = {"_p_operations_research__sat__SolveWrapper", "operations_research::sat::SolveWrapper *", 0, 0, (void*)0, 0};
4892static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
4893static 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};
4894static 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};
4895static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
4896static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
4897static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
4898
4914};
4915
4916static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4917static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
4918static swig_cast_info _swigc__p_long_long[] = { {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
4924static swig_cast_info _swigc__p_short[] = { {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
4925static swig_cast_info _swigc__p_signed_char[] = { {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
4927static swig_cast_info _swigc__p_unsigned_int[] = { {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
4930
4946};
4947
4948
4949/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4950
4952{0, 0, 0, 0.0, 0, 0}};
4953
4954#ifdef __cplusplus
4955}
4956#endif
4957/* -----------------------------------------------------------------------------
4958 * Type initialization:
4959 * This problem is tough by the requirement that no dynamic
4960 * memory is used. Also, since swig_type_info structures store pointers to
4961 * swig_cast_info structures and swig_cast_info structures store pointers back
4962 * to swig_type_info structures, we need some lookup code at initialization.
4963 * The idea is that swig generates all the structures that are needed.
4964 * The runtime then collects these partially filled structures.
4965 * The SWIG_InitializeModule function takes these initial arrays out of
4966 * swig_module, and does all the lookup, filling in the swig_module.types
4967 * array with the correct data and linking the correct swig_cast_info
4968 * structures together.
4969 *
4970 * The generated swig_type_info structures are assigned statically to an initial
4971 * array. We just loop through that array, and handle each type individually.
4972 * First we lookup if this type has been already loaded, and if so, use the
4973 * loaded structure instead of the generated one. Then we have to fill in the
4974 * cast linked list. The cast data is initially stored in something like a
4975 * two-dimensional array. Each row corresponds to a type (there are the same
4976 * number of rows as there are in the swig_type_initial array). Each entry in
4977 * a column is one of the swig_cast_info structures for that type.
4978 * The cast_initial array is actually an array of arrays, because each row has
4979 * a variable number of columns. So to actually build the cast linked list,
4980 * we find the array of casts associated with the type, and loop through it
4981 * adding the casts to the list. The one last trick we need to do is making
4982 * sure the type pointer in the swig_cast_info struct is correct.
4983 *
4984 * First off, we lookup the cast->type name to see if it is already loaded.
4985 * There are three cases to handle:
4986 * 1) If the cast->type has already been loaded AND the type we are adding
4987 * casting info to has not been loaded (it is in this module), THEN we
4988 * replace the cast->type pointer with the type pointer that has already
4989 * been loaded.
4990 * 2) If BOTH types (the one we are adding casting info to, and the
4991 * cast->type) are loaded, THEN the cast info has already been loaded by
4992 * the previous module so we just ignore it.
4993 * 3) Finally, if cast->type has not already been loaded, then we add that
4994 * swig_cast_info to the linked list (because the cast->type) pointer will
4995 * be correct.
4996 * ----------------------------------------------------------------------------- */
4997
4998#ifdef __cplusplus
4999extern "C" {
5000#if 0
5001} /* c-mode */
5002#endif
5003#endif
5004
5005#if 0
5006#define SWIGRUNTIME_DEBUG
5007#endif
5008
5009
5010SWIGRUNTIME void
5011SWIG_InitializeModule(void *clientdata) {
5012 size_t i;
5013 swig_module_info *module_head, *iter;
5014 int init;
5015
5016 /* check to see if the circular list has been setup, if not, set it up */
5017 if (swig_module.next==0) {
5018 /* Initialize the swig_module */
5022 init = 1;
5023 } else {
5024 init = 0;
5025 }
5026
5027 /* Try and load any already created modules */
5028 module_head = SWIG_GetModule(clientdata);
5029 if (!module_head) {
5030 /* This is the first module loaded for this interpreter */
5031 /* so set the swig module into the interpreter */
5032 SWIG_SetModule(clientdata, &swig_module);
5033 } else {
5034 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
5035 iter=module_head;
5036 do {
5037 if (iter==&swig_module) {
5038 /* Our module is already in the list, so there's nothing more to do. */
5039 return;
5040 }
5041 iter=iter->next;
5042 } while (iter!= module_head);
5043
5044 /* otherwise we must add our module into the list */
5045 swig_module.next = module_head->next;
5046 module_head->next = &swig_module;
5047 }
5048
5049 /* When multiple interpreters are used, a module could have already been initialized in
5050 a different interpreter, but not yet have a pointer in this interpreter.
5051 In this case, we do not want to continue adding types... everything should be
5052 set up already */
5053 if (init == 0) return;
5054
5055 /* Now work on filling in swig_module.types */
5056#ifdef SWIGRUNTIME_DEBUG
5057 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
5058#endif
5059 for (i = 0; i < swig_module.size; ++i) {
5060 swig_type_info *type = 0;
5061 swig_type_info *ret;
5062 swig_cast_info *cast;
5063
5064#ifdef SWIGRUNTIME_DEBUG
5065 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
5066#endif
5067
5068 /* if there is another module already loaded */
5069 if (swig_module.next != &swig_module) {
5071 }
5072 if (type) {
5073 /* Overwrite clientdata field */
5074#ifdef SWIGRUNTIME_DEBUG
5075 printf("SWIG_InitializeModule: found type %s\n", type->name);
5076#endif
5079#ifdef SWIGRUNTIME_DEBUG
5080 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
5081#endif
5082 }
5083 } else {
5084 type = swig_module.type_initial[i];
5085 }
5086
5087 /* Insert casting types */
5088 cast = swig_module.cast_initial[i];
5089 while (cast->type) {
5090 /* Don't need to add information already in the list */
5091 ret = 0;
5092#ifdef SWIGRUNTIME_DEBUG
5093 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
5094#endif
5095 if (swig_module.next != &swig_module) {
5097#ifdef SWIGRUNTIME_DEBUG
5098 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
5099#endif
5100 }
5101 if (ret) {
5102 if (type == swig_module.type_initial[i]) {
5103#ifdef SWIGRUNTIME_DEBUG
5104 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
5105#endif
5106 cast->type = ret;
5107 ret = 0;
5108 } else {
5109 /* Check for casting already in the list */
5110 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
5111#ifdef SWIGRUNTIME_DEBUG
5112 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
5113#endif
5114 if (!ocast) ret = 0;
5115 }
5116 }
5117
5118 if (!ret) {
5119#ifdef SWIGRUNTIME_DEBUG
5120 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
5121#endif
5122 if (type->cast) {
5123 type->cast->prev = cast;
5124 cast->next = type->cast;
5125 }
5126 type->cast = cast;
5127 }
5128 cast++;
5129 }
5130 /* Set entry in modules->types array equal to the type */
5131 swig_module.types[i] = type;
5132 }
5133 swig_module.types[i] = 0;
5134
5135#ifdef SWIGRUNTIME_DEBUG
5136 printf("**** SWIG_InitializeModule: Cast List ******\n");
5137 for (i = 0; i < swig_module.size; ++i) {
5138 int j = 0;
5140 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
5141 while (cast->type) {
5142 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
5143 cast++;
5144 ++j;
5145 }
5146 printf("---- Total casts: %d\n",j);
5147 }
5148 printf("**** SWIG_InitializeModule: Cast List ******\n");
5149#endif
5150}
5151
5152/* This function will propagate the clientdata field of type to
5153* any new swig_type_info structures that have been added into the list
5154* of equivalent types. It is like calling
5155* SWIG_TypeClientData(type, clientdata) a second time.
5156*/
5157SWIGRUNTIME void
5159 size_t i;
5160 swig_cast_info *equiv;
5161 static int init_run = 0;
5162
5163 if (init_run) return;
5164 init_run = 1;
5165
5166 for (i = 0; i < swig_module.size; i++) {
5167 if (swig_module.types[i]->clientdata) {
5168 equiv = swig_module.types[i]->cast;
5169 while (equiv) {
5170 if (!equiv->converter) {
5171 if (equiv->type && !equiv->type->clientdata)
5173 }
5174 equiv = equiv->next;
5175 }
5176 }
5177 }
5178}
5179
5180#ifdef __cplusplus
5181#if 0
5182{
5183 /* c-mode */
5184#endif
5185}
5186#endif
5187
5188
5189
5190#ifdef __cplusplus
5191extern "C" {
5192#endif
5193
5194 /* Python-specific SWIG API */
5195#define SWIG_newvarlink() SWIG_Python_newvarlink()
5196#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
5197#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
5198
5199 /* -----------------------------------------------------------------------------
5200 * global variable support code.
5201 * ----------------------------------------------------------------------------- */
5202
5203 typedef struct swig_globalvar {
5204 char *name; /* Name of global variable */
5205 PyObject *(*get_attr)(void); /* Return the current value */
5206 int (*set_attr)(PyObject *); /* Set the value */
5207 struct swig_globalvar *next;
5209
5210 typedef struct swig_varlinkobject {
5211 PyObject_HEAD
5214
5215 SWIGINTERN PyObject *
5217#if PY_VERSION_HEX >= 0x03000000
5218 return PyUnicode_InternFromString("<Swig global variables>");
5219#else
5220 return PyString_FromString("<Swig global variables>");
5221#endif
5222 }
5223
5224 SWIGINTERN PyObject *
5226#if PY_VERSION_HEX >= 0x03000000
5227 PyObject *str = PyUnicode_InternFromString("(");
5228 PyObject *tail;
5229 PyObject *joined;
5231 for (var = v->vars; var; var=var->next) {
5232 tail = PyUnicode_FromString(var->name);
5233 joined = PyUnicode_Concat(str, tail);
5234 Py_DecRef(str);
5235 Py_DecRef(tail);
5236 str = joined;
5237 if (var->next) {
5238 tail = PyUnicode_InternFromString(", ");
5239 joined = PyUnicode_Concat(str, tail);
5240 Py_DecRef(str);
5241 Py_DecRef(tail);
5242 str = joined;
5243 }
5244 }
5245 tail = PyUnicode_InternFromString(")");
5246 joined = PyUnicode_Concat(str, tail);
5247 Py_DecRef(str);
5248 Py_DecRef(tail);
5249 str = joined;
5250#else
5251 PyObject *str = PyString_FromString("(");
5253 for (var = v->vars; var; var=var->next) {
5254 PyString_ConcatAndDel(&str,PyString_FromString(var->name));
5255 if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
5256 }
5257 PyString_ConcatAndDel(&str,PyString_FromString(")"));
5258#endif
5259 return str;
5260 }
5261
5262 SWIGINTERN void
5264 swig_globalvar *var = v->vars;
5265 while (var) {
5266 swig_globalvar *n = var->next;
5267 free(var->name);
5268 free(var);
5269 var = n;
5270 }
5271 }
5272
5273 SWIGINTERN PyObject *
5275 PyObject *res = NULL;
5276 swig_globalvar *var = v->vars;
5277 while (var) {
5278 if (strcmp(var->name,n) == 0) {
5279 res = (*var->get_attr)();
5280 break;
5281 }
5282 var = var->next;
5283 }
5284 if (res == NULL && !PyErr_Occurred()) {
5285 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
5286 }
5287 return res;
5288 }
5289
5290 SWIGINTERN int
5291 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
5292 int res = 1;
5293 swig_globalvar *var = v->vars;
5294 while (var) {
5295 if (strcmp(var->name,n) == 0) {
5296 res = (*var->set_attr)(p);
5297 break;
5298 }
5299 var = var->next;
5300 }
5301 if (res == 1 && !PyErr_Occurred()) {
5302 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
5303 }
5304 return res;
5305 }
5306
5307 SWIGINTERN PyTypeObject*
5309 static char varlink__doc__[] = "Swig var link object";
5310 static PyTypeObject varlink_type;
5311 static int type_init = 0;
5312 if (!type_init) {
5313 const PyTypeObject tmp = {
5314#if PY_VERSION_HEX >= 0x03000000
5315 PyVarObject_HEAD_INIT(NULL, 0)
5316#else
5317 PyObject_HEAD_INIT(NULL)
5318 0, /* ob_size */
5319#endif
5320 "swigvarlink", /* tp_name */
5321 sizeof(swig_varlinkobject), /* tp_basicsize */
5322 0, /* tp_itemsize */
5323 (destructor) swig_varlink_dealloc, /* tp_dealloc */
5324 0, /* tp_print */
5325 (getattrfunc) swig_varlink_getattr, /* tp_getattr */
5326 (setattrfunc) swig_varlink_setattr, /* tp_setattr */
5327 0, /* tp_compare */
5328 (reprfunc) swig_varlink_repr, /* tp_repr */
5329 0, /* tp_as_number */
5330 0, /* tp_as_sequence */
5331 0, /* tp_as_mapping */
5332 0, /* tp_hash */
5333 0, /* tp_call */
5334 (reprfunc) swig_varlink_str, /* tp_str */
5335 0, /* tp_getattro */
5336 0, /* tp_setattro */
5337 0, /* tp_as_buffer */
5338 0, /* tp_flags */
5339 varlink__doc__, /* tp_doc */
5340 0, /* tp_traverse */
5341 0, /* tp_clear */
5342 0, /* tp_richcompare */
5343 0, /* tp_weaklistoffset */
5344 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
5345 0, /* tp_del */
5346 0, /* tp_version_tag */
5347#if PY_VERSION_HEX >= 0x03040000
5348 0, /* tp_finalize */
5349#endif
5350#if PY_VERSION_HEX >= 0x03080000
5351 0, /* tp_vectorcall */
5352#endif
5353#if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
5354 0, /* tp_print */
5355#endif
5356#ifdef COUNT_ALLOCS
5357 0, /* tp_allocs */
5358 0, /* tp_frees */
5359 0, /* tp_maxalloc */
5360 0, /* tp_prev */
5361 0 /* tp_next */
5362#endif
5363 };
5364 varlink_type = tmp;
5365 type_init = 1;
5366 if (PyType_Ready(&varlink_type) < 0)
5367 return NULL;
5368 }
5369 return &varlink_type;
5370 }
5371
5372 /* Create a variable linking object for use later */
5373 SWIGINTERN PyObject *
5375 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
5376 if (result) {
5377 result->vars = 0;
5378 }
5379 return ((PyObject*) result);
5380 }
5381
5382 SWIGINTERN void
5383 SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
5386 if (gv) {
5387 size_t size = strlen(name)+1;
5388 gv->name = (char *)malloc(size);
5389 if (gv->name) {
5390 memcpy(gv->name, name, size);
5391 gv->get_attr = get_attr;
5392 gv->set_attr = set_attr;
5393 gv->next = v->vars;
5394 }
5395 }
5396 v->vars = gv;
5397 }
5398
5399 SWIGINTERN PyObject *
5401 static PyObject *globals = 0;
5402 if (!globals) {
5403 globals = SWIG_newvarlink();
5404 }
5405 return globals;
5406 }
5407
5408 /* -----------------------------------------------------------------------------
5409 * constants/methods manipulation
5410 * ----------------------------------------------------------------------------- */
5411
5412 /* Install Constants */
5413 SWIGINTERN void
5415 PyObject *obj = 0;
5416 size_t i;
5417 for (i = 0; constants[i].type; ++i) {
5418 switch(constants[i].type) {
5419 case SWIG_PY_POINTER:
5420 obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
5421 break;
5422 case SWIG_PY_BINARY:
5423 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
5424 break;
5425 default:
5426 obj = 0;
5427 break;
5428 }
5429 if (obj) {
5430 PyDict_SetItemString(d, constants[i].name, obj);
5431 Py_DECREF(obj);
5432 }
5433 }
5434 }
5435
5436 /* -----------------------------------------------------------------------------*/
5437 /* Fix SwigMethods to carry the callback ptrs when needed */
5438 /* -----------------------------------------------------------------------------*/
5439
5440 SWIGINTERN void
5441 SWIG_Python_FixMethods(PyMethodDef *methods,
5442 swig_const_info *const_table,
5443 swig_type_info **types,
5444 swig_type_info **types_initial) {
5445 size_t i;
5446 for (i = 0; methods[i].ml_name; ++i) {
5447 const char *c = methods[i].ml_doc;
5448 if (!c) continue;
5449 c = strstr(c, "swig_ptr: ");
5450 if (c) {
5451 int j;
5452 swig_const_info *ci = 0;
5453 const char *name = c + 10;
5454 for (j = 0; const_table[j].type; ++j) {
5455 if (strncmp(const_table[j].name, name,
5456 strlen(const_table[j].name)) == 0) {
5457 ci = &(const_table[j]);
5458 break;
5459 }
5460 }
5461 if (ci) {
5462 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
5463 if (ptr) {
5464 size_t shift = (ci->ptype) - types;
5465 swig_type_info *ty = types_initial[shift];
5466 size_t ldoc = (c - methods[i].ml_doc);
5467 size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
5468 char *ndoc = (char*)malloc(ldoc + lptr + 10);
5469 if (ndoc) {
5470 char *buff = ndoc;
5471 memcpy(buff, methods[i].ml_doc, ldoc);
5472 buff += ldoc;
5473 memcpy(buff, "swig_ptr: ", 10);
5474 buff += 10;
5475 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
5476 methods[i].ml_doc = ndoc;
5477 }
5478 }
5479 }
5480 }
5481 }
5482 }
5483
5484 /* -----------------------------------------------------------------------------
5485 * Method creation and docstring support functions
5486 * ----------------------------------------------------------------------------- */
5487
5488 /* -----------------------------------------------------------------------------
5489 * Function to find the method definition with the correct docstring for the
5490 * proxy module as opposed to the low-level API
5491 * ----------------------------------------------------------------------------- */
5492
5493 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
5494 /* Find the function in the modified method table */
5495 size_t offset = 0;
5496 int found = 0;
5497 while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
5498 if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
5499 found = 1;
5500 break;
5501 }
5502 offset++;
5503 }
5504 /* Use the copy with the modified docstring if available */
5505 return found ? &SwigMethods_proxydocs[offset] : NULL;
5506 }
5507
5508 /* -----------------------------------------------------------------------------
5509 * Wrapper of PyInstanceMethod_New() used in Python 3
5510 * It is exported to the generated module, used for -fastproxy
5511 * ----------------------------------------------------------------------------- */
5512
5513 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
5514 if (PyCFunction_Check(func)) {
5515 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
5516 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
5517 if (ml)
5518 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
5519 }
5520#if PY_VERSION_HEX >= 0x03000000
5521 return PyInstanceMethod_New(func);
5522#else
5523 return PyMethod_New(func, NULL, NULL);
5524#endif
5525 }
5526
5527 /* -----------------------------------------------------------------------------
5528 * Wrapper of PyStaticMethod_New()
5529 * It is exported to the generated module, used for -fastproxy
5530 * ----------------------------------------------------------------------------- */
5531
5532 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
5533 if (PyCFunction_Check(func)) {
5534 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
5535 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
5536 if (ml)
5537 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
5538 }
5539 return PyStaticMethod_New(func);
5540 }
5541
5542#ifdef __cplusplus
5543}
5544#endif
5545
5546/* -----------------------------------------------------------------------------*
5547 * Partial Init method
5548 * -----------------------------------------------------------------------------*/
5549
5550#ifdef __cplusplus
5551extern "C"
5552#endif
5553
5555#if PY_VERSION_HEX >= 0x03000000
5556PyObject*
5557#else
5558void
5559#endif
5560SWIG_init(void) {
5561 PyObject *m, *d, *md, *globals;
5562
5563#if PY_VERSION_HEX >= 0x03000000
5564 static struct PyModuleDef SWIG_module = {
5565 PyModuleDef_HEAD_INIT,
5566 SWIG_name,
5567 NULL,
5568 -1,
5570 NULL,
5571 NULL,
5572 NULL,
5573 NULL
5574 };
5575#endif
5576
5577#if defined(SWIGPYTHON_BUILTIN)
5578 static SwigPyClientData SwigPyObject_clientdata = {
5579 0, 0, 0, 0, 0, 0, 0
5580 };
5581 static PyGetSetDef this_getset_def = {
5582 (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
5583 };
5584 static SwigPyGetSet thisown_getset_closure = {
5587 };
5588 static PyGetSetDef thisown_getset_def = {
5589 (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
5590 };
5591 PyTypeObject *builtin_pytype;
5592 int builtin_base_count;
5593 swig_type_info *builtin_basetype;
5594 PyObject *tuple;
5595 PyGetSetDescrObject *static_getset;
5596 PyTypeObject *metatype;
5597 PyTypeObject *swigpyobject;
5598 SwigPyClientData *cd;
5599 PyObject *public_interface, *public_symbol;
5600 PyObject *this_descr;
5601 PyObject *thisown_descr;
5602 PyObject *self = 0;
5603 int i;
5604
5605 (void)builtin_pytype;
5606 (void)builtin_base_count;
5607 (void)builtin_basetype;
5608 (void)tuple;
5609 (void)static_getset;
5610 (void)self;
5611
5612 /* Metaclass is used to implement static member variables */
5613 metatype = SwigPyObjectType();
5614 assert(metatype);
5615#endif
5616
5617 (void)globals;
5618
5619 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
5620 SWIG_This();
5623#ifndef SWIGPYTHON_BUILTIN
5625#endif
5626
5627 /* Fix SwigMethods to carry the callback ptrs when needed */
5629
5630#if PY_VERSION_HEX >= 0x03000000
5631 m = PyModule_Create(&SWIG_module);
5632#else
5633 m = Py_InitModule(SWIG_name, SwigMethods);
5634#endif
5635
5636 md = d = PyModule_GetDict(m);
5637 (void)md;
5638
5640
5641#ifdef SWIGPYTHON_BUILTIN
5642 swigpyobject = SwigPyObject_TypeOnce();
5643
5644 SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
5645 assert(SwigPyObject_stype);
5646 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
5647 if (!cd) {
5648 SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
5649 SwigPyObject_clientdata.pytype = swigpyobject;
5650 } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
5651 PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
5652# if PY_VERSION_HEX >= 0x03000000
5653 return NULL;
5654# else
5655 return;
5656# endif
5657 }
5658
5659 /* All objects have a 'this' attribute */
5660 this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
5661 (void)this_descr;
5662
5663 /* All objects have a 'thisown' attribute */
5664 thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
5665 (void)thisown_descr;
5666
5667 public_interface = PyList_New(0);
5668 public_symbol = 0;
5669 (void)public_symbol;
5670
5671 PyDict_SetItemString(md, "__all__", public_interface);
5672 Py_DECREF(public_interface);
5673 for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
5674 SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
5675 for (i = 0; swig_const_table[i].name != 0; ++i)
5676 SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
5677#endif
5678
5680
5681
5682 /* Initialize threading */
5684#if PY_VERSION_HEX >= 0x03000000
5685 return m;
5686#else
5687 return;
5688#endif
5689}
5690
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(PyObject *error, const char *msg)
static void raise(JNIEnv *jenv, jthrowable throwable)
static void raise(const char *msg)
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="")
static void raise(const char *msg)
static void raise(const char *msg)
DirectorPureVirtualException(const char *msg="")
static void raise(PyObject *error, const char *msg)
DirectorTypeMismatchException(PyObject *error, const char *msg="")
DirectorTypeMismatchException(const char *msg="")
static void raise(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 status
Definition: g_gurobi.cc:35
absl::StatusOr< SolveResult > Solve(const Model &model, const SolverType solver_type, const SolveArguments &solve_args, const SolverInitArguments &init_args)
Definition: solve.cc:155
absl::Status ValidateModel(const ModelProto &model, const bool check_names)
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)
static swig_type_info _swigt__p_long_long
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
static swig_cast_info _swigc__p_long_long[]
#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
static swig_type_info _swigt__p_unsigned_long_long
#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[]
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)
#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)
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
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_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_cast_info _swigc__p_unsigned_long_long[]
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)
std::optional< int64_t > end
int64_t start
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