OR-Tools  9.0
init_csharp_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 SWIGCSHARP
13 #define SWIGCSHARP
14 #endif
15 
16 
17 
18 #ifdef __cplusplus
19 /* SwigValueWrapper is described in swig.swg */
20 template<typename T> class SwigValueWrapper {
21  struct SwigMovePointer {
22  T *ptr;
23  SwigMovePointer(T *p) : ptr(p) { }
24  ~SwigMovePointer() { delete ptr; }
25  SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
26  } pointer;
27  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
28  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
29 public:
30  SwigValueWrapper() : pointer(0) { }
31  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
32  operator T&() const { return *pointer.ptr; }
33  T *operator&() { return pointer.ptr; }
34 };
35 
36 template <typename T> T SwigValueInit() {
37  return T();
38 }
39 #endif
40 
41 /* -----------------------------------------------------------------------------
42  * This section contains generic SWIG labels for method/variable
43  * declarations/attributes, and other compiler dependent labels.
44  * ----------------------------------------------------------------------------- */
45 
46 /* template workaround for compilers that cannot correctly implement the C++ standard */
47 #ifndef SWIGTEMPLATEDISAMBIGUATOR
48 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
49 # define SWIGTEMPLATEDISAMBIGUATOR template
50 # elif defined(__HP_aCC)
51 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
52 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
53 # define SWIGTEMPLATEDISAMBIGUATOR template
54 # else
55 # define SWIGTEMPLATEDISAMBIGUATOR
56 # endif
57 #endif
58 
59 /* inline attribute */
60 #ifndef SWIGINLINE
61 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
62 # define SWIGINLINE inline
63 # else
64 # define SWIGINLINE
65 # endif
66 #endif
67 
68 /* attribute recognised by some compilers to avoid 'unused' warnings */
69 #ifndef SWIGUNUSED
70 # if defined(__GNUC__)
71 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
72 # define SWIGUNUSED __attribute__ ((__unused__))
73 # else
74 # define SWIGUNUSED
75 # endif
76 # elif defined(__ICC)
77 # define SWIGUNUSED __attribute__ ((__unused__))
78 # else
79 # define SWIGUNUSED
80 # endif
81 #endif
82 
83 #ifndef SWIG_MSC_UNSUPPRESS_4505
84 # if defined(_MSC_VER)
85 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
86 # endif
87 #endif
88 
89 #ifndef SWIGUNUSEDPARM
90 # ifdef __cplusplus
91 # define SWIGUNUSEDPARM(p)
92 # else
93 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
94 # endif
95 #endif
96 
97 /* internal SWIG method */
98 #ifndef SWIGINTERN
99 # define SWIGINTERN static SWIGUNUSED
100 #endif
101 
102 /* internal inline SWIG method */
103 #ifndef SWIGINTERNINLINE
104 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
105 #endif
106 
107 /* exporting methods */
108 #if defined(__GNUC__)
109 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
110 # ifndef GCC_HASCLASSVISIBILITY
111 # define GCC_HASCLASSVISIBILITY
112 # endif
113 # endif
114 #endif
115 
116 #ifndef SWIGEXPORT
117 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
118 # if defined(STATIC_LINKED)
119 # define SWIGEXPORT
120 # else
121 # define SWIGEXPORT __declspec(dllexport)
122 # endif
123 # else
124 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
125 # define SWIGEXPORT __attribute__ ((visibility("default")))
126 # else
127 # define SWIGEXPORT
128 # endif
129 # endif
130 #endif
131 
132 /* calling conventions for Windows */
133 #ifndef SWIGSTDCALL
134 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
135 # define SWIGSTDCALL __stdcall
136 # else
137 # define SWIGSTDCALL
138 # endif
139 #endif
140 
141 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
142 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
143 # define _CRT_SECURE_NO_DEPRECATE
144 #endif
145 
146 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
147 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
148 # define _SCL_SECURE_NO_DEPRECATE
149 #endif
150 
151 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
152 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
153 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
154 #endif
155 
156 /* Intel's compiler complains if a variable which was never initialised is
157  * cast to void, which is a common idiom which we use to indicate that we
158  * are aware a variable isn't used. So we just silence that warning.
159  * See: https://github.com/swig/swig/issues/192 for more discussion.
160  */
161 #ifdef __INTEL_COMPILER
162 # pragma warning disable 592
163 #endif
164 
165 
166 #include <stdlib.h>
167 #include <string.h>
168 #include <stdio.h>
169 
170 
171 /* Support for throwing C# exceptions from C/C++. There are two types:
172  * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
173 typedef enum {
186 
187 typedef enum {
192 
193 typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
194 typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
195 
196 typedef struct {
200 
201 typedef struct {
205 
213  { SWIG_CSharpIOException, NULL },
218 };
219 
224 };
225 
228  if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
230  }
231  callback(msg);
232 }
233 
234 static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
236  if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
238  }
239  callback(msg, param_name);
240 }
241 
242 
243 #ifdef __cplusplus
244 extern "C"
245 #endif
247  SWIG_CSharpExceptionCallback_t applicationCallback,
248  SWIG_CSharpExceptionCallback_t arithmeticCallback,
249  SWIG_CSharpExceptionCallback_t divideByZeroCallback,
250  SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback,
251  SWIG_CSharpExceptionCallback_t invalidCastCallback,
252  SWIG_CSharpExceptionCallback_t invalidOperationCallback,
254  SWIG_CSharpExceptionCallback_t nullReferenceCallback,
255  SWIG_CSharpExceptionCallback_t outOfMemoryCallback,
256  SWIG_CSharpExceptionCallback_t overflowCallback,
257  SWIG_CSharpExceptionCallback_t systemCallback) {
269 }
270 
271 #ifdef __cplusplus
272 extern "C"
273 #endif
276  SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
277  SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
281 }
282 
283 
284 /* Callback for returning strings to C# without leaking memory */
285 typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
287 
288 
289 #ifdef __cplusplus
290 extern "C"
291 #endif
294 }
295 
296 
297 /* Contract support */
298 
299 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
300 
301 
302 #include <cstdint>
303 #include <string>
304 #include <vector>
305 
306 #include "ortools/base/basictypes.h"
307 
308 
309 #include <stdint.h> // Use the C99 official header
310 
311 
312 #define SWIGWORDSIZE64
313 #ifndef LONG_MAX
314 #include <limits.h>
315 #endif
316 #if (__WORDSIZE == 32) || (LONG_MAX == INT_MAX)
317 # error "SWIG wrapped code invalid in 32 bit architecture, regenerate code using -DSWIGWORDSIZE32"
318 #endif
319 
320 
321 #include <string>
322 
323 
324 #include "ortools/init/init.h"
325 
326 
327 #ifdef __cplusplus
328 extern "C" {
329 #endif
330 
333  bool arg2 ;
334 
335  arg1 = (operations_research::CppFlags *)jarg1;
336  arg2 = jarg2 ? true : false;
337  if (arg1) (arg1)->logtostderr = arg2;
338 }
339 
340 
342  unsigned int jresult ;
344  bool result;
345 
346  arg1 = (operations_research::CppFlags *)jarg1;
347  result = (bool) ((arg1)->logtostderr);
348  jresult = result;
349  return jresult;
350 }
351 
352 
355  bool arg2 ;
356 
357  arg1 = (operations_research::CppFlags *)jarg1;
358  arg2 = jarg2 ? true : false;
359  if (arg1) (arg1)->log_prefix = arg2;
360 }
361 
362 
364  unsigned int jresult ;
366  bool result;
367 
368  arg1 = (operations_research::CppFlags *)jarg1;
369  result = (bool) ((arg1)->log_prefix);
370  jresult = result;
371  return jresult;
372 }
373 
374 
377  std::string *arg2 = 0 ;
378 
379  arg1 = (operations_research::CppFlags *)jarg1;
380  if (!jarg2) {
382  return ;
383  }
384  std::string arg2_str(jarg2);
385  arg2 = &arg2_str;
386  if (arg1) (arg1)->cp_model_dump_prefix = *arg2;
387 }
388 
389 
391  char * jresult ;
393  std::string *result = 0 ;
394 
395  arg1 = (operations_research::CppFlags *)jarg1;
396  result = (std::string *) & ((arg1)->cp_model_dump_prefix);
397  jresult = SWIG_csharp_string_callback(result->c_str());
398  return jresult;
399 }
400 
401 
404  bool arg2 ;
405 
406  arg1 = (operations_research::CppFlags *)jarg1;
407  arg2 = jarg2 ? true : false;
408  if (arg1) (arg1)->cp_model_dump_models = arg2;
409 }
410 
411 
413  unsigned int jresult ;
415  bool result;
416 
417  arg1 = (operations_research::CppFlags *)jarg1;
418  result = (bool) ((arg1)->cp_model_dump_models);
419  jresult = result;
420  return jresult;
421 }
422 
423 
426  bool arg2 ;
427 
428  arg1 = (operations_research::CppFlags *)jarg1;
429  arg2 = jarg2 ? true : false;
430  if (arg1) (arg1)->cp_model_dump_lns = arg2;
431 }
432 
433 
435  unsigned int jresult ;
437  bool result;
438 
439  arg1 = (operations_research::CppFlags *)jarg1;
440  result = (bool) ((arg1)->cp_model_dump_lns);
441  jresult = result;
442  return jresult;
443 }
444 
445 
448  bool arg2 ;
449 
450  arg1 = (operations_research::CppFlags *)jarg1;
451  arg2 = jarg2 ? true : false;
452  if (arg1) (arg1)->cp_model_dump_response = arg2;
453 }
454 
455 
457  unsigned int jresult ;
459  bool result;
460 
461  arg1 = (operations_research::CppFlags *)jarg1;
462  result = (bool) ((arg1)->cp_model_dump_response);
463  jresult = result;
464  return jresult;
465 }
466 
467 
469  void * jresult ;
470  operations_research::CppFlags *result = 0 ;
471 
473  jresult = (void *)result;
474  return jresult;
475 }
476 
477 
480 
481  arg1 = (operations_research::CppFlags *)jarg1;
482  delete arg1;
483 }
484 
485 
487  std::string *arg1 = 0 ;
488 
489  if (!jarg1) {
491  return ;
492  }
493  std::string arg1_str(jarg1);
494  arg1 = &arg1_str;
495  operations_research::CppBridge::InitLogging((std::string const &)*arg1);
496 }
497 
498 
501 }
502 
503 
506 
507  arg1 = (operations_research::CppFlags *)jarg1;
508  if (!arg1) {
509  SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "operations_research::CppFlags const & type is null", 0);
510  return ;
511  }
513 }
514 
515 
517  unsigned int jresult ;
518  std::string *arg1 = 0 ;
519  bool result;
520 
521  if (!jarg1) {
523  return 0;
524  }
525  std::string arg1_str(jarg1);
526  arg1 = &arg1_str;
527  result = (bool)operations_research::CppBridge::LoadGurobiSharedLibrary((std::string const &)*arg1);
528  jresult = result;
529  return jresult;
530 }
531 
532 
534  void * jresult ;
535  operations_research::CppBridge *result = 0 ;
536 
538  jresult = (void *)result;
539  return jresult;
540 }
541 
542 
545 
546  arg1 = (operations_research::CppBridge *)jarg1;
547  delete arg1;
548 }
549 
550 
551 #ifdef __cplusplus
552 }
553 #endif
554 
This class performs various C++ initialization.
Definition: init.h:66
static void InitLogging(const std::string &program_name)
Initialize the C++ logging layer.
Definition: init.h:73
static bool LoadGurobiSharedLibrary(const std::string &full_library_path)
Load the gurobi shared library.
Definition: init.h:109
static void ShutdownLogging()
Shutdown the C++ logging layer.
Definition: init.h:83
static void SetFlags(const CppFlags &flags)
Sets all the C++ flags contained in the CppFlags structure.
Definition: init.h:90
MPCallback * callback
SWIGEXPORT void *SWIGSTDCALL CSharp_GooglefOrToolsfInit_new_CppBridge___()
static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[]
void(SWIGSTDCALL * SWIG_CSharpExceptionCallback_t)(const char *)
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_response_get___(void *jarg1)
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_response_set___(void *jarg1, unsigned int jarg2)
static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name)
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_logtostderr_get___(void *jarg1)
SWIGEXPORT char *SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_prefix_get___(void *jarg1)
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_models_get___(void *jarg1)
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_logtostderr_set___(void *jarg1, unsigned int jarg2)
void(SWIGSTDCALL * SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *)
SWIGEXPORT void *SWIGSTDCALL CSharp_GooglefOrToolsfInit_new_CppFlags___()
static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback
#define SWIGUNUSED
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppBridge_ShutdownLogging___()
static SWIG_CSharpException_t SWIG_csharp_exceptions[]
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppBridge_SetFlags___(void *jarg1)
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_lns_get___(void *jarg1)
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppBridge_LoadGurobiSharedLibrary___(char *jarg1)
SWIG_CSharpExceptionArgumentCodes
@ SWIG_CSharpArgumentException
@ SWIG_CSharpArgumentOutOfRangeException
@ SWIG_CSharpArgumentNullException
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppBridge_InitLogging___(char *jarg1)
char *(SWIGSTDCALL * SWIG_CSharpStringHelperCallback)(const char *)
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_delete_CppBridge___(void *jarg1)
static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg)
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_log_prefix_set___(void *jarg1, unsigned int jarg2)
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_operations_research_init(SWIG_CSharpStringHelperCallback callback)
SWIGEXPORT unsigned int SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_log_prefix_get___(void *jarg1)
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_operations_research_init(SWIG_CSharpExceptionCallback_t applicationCallback, SWIG_CSharpExceptionCallback_t arithmeticCallback, SWIG_CSharpExceptionCallback_t divideByZeroCallback, SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, SWIG_CSharpExceptionCallback_t invalidCastCallback, SWIG_CSharpExceptionCallback_t invalidOperationCallback, SWIG_CSharpExceptionCallback_t ioCallback, SWIG_CSharpExceptionCallback_t nullReferenceCallback, SWIG_CSharpExceptionCallback_t outOfMemoryCallback, SWIG_CSharpExceptionCallback_t overflowCallback, SWIG_CSharpExceptionCallback_t systemCallback)
#define SWIGSTDCALL
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_lns_set___(void *jarg1, unsigned int jarg2)
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_models_set___(void *jarg1, unsigned int jarg2)
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_delete_CppFlags___(void *jarg1)
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_operations_research_init(SWIG_CSharpExceptionArgumentCallback_t argumentCallback, SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback, SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback)
#define SWIGEXPORT
SWIGEXPORT void SWIGSTDCALL CSharp_GooglefOrToolsfInit_CppFlags_cp_model_dump_prefix_set___(void *jarg1, char *jarg2)
SWIG_CSharpExceptionCodes
@ SWIG_CSharpDivideByZeroException
@ SWIG_CSharpOutOfMemoryException
@ SWIG_CSharpArithmeticException
@ SWIG_CSharpSystemException
@ SWIG_CSharpApplicationException
@ SWIG_CSharpNullReferenceException
@ SWIG_CSharpInvalidCastException
@ SWIG_CSharpInvalidOperationException
@ SWIG_CSharpOverflowException
@ SWIG_CSharpIOException
@ SWIG_CSharpIndexOutOfRangeException
SWIG_CSharpExceptionArgumentCodes
SWIG_CSharpExceptionCallback_t callback
SWIG_CSharpExceptionArgumentCallback_t callback
Simple structure that holds useful C++ flags to setup from non-C++ languages.
Definition: init.h:20