Google OR-Tools v9.9
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
LogCallback.cs
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// <auto-generated />
3//
4// This file was automatically generated by SWIG (https://www.swig.org).
5// Version 4.2.0
6//
7// Do not make changes to this file unless you know what you are doing - modify
8// the SWIG interface file instead.
9//------------------------------------------------------------------------------
10
11namespace Google.OrTools.Sat {
12
13using System;
14using System.Runtime.InteropServices;
15using System.Collections;
16
17public class LogCallback : global::System.IDisposable {
18 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
19 protected bool swigCMemOwn;
20
21 internal LogCallback(global::System.IntPtr cPtr, bool cMemoryOwn) {
22 swigCMemOwn = cMemoryOwn;
23 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
24 }
25
26 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LogCallback obj) {
27 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
28 }
29
30 internal static global::System.Runtime.InteropServices.HandleRef swigRelease(LogCallback obj) {
31 if (obj != null) {
32 if (!obj.swigCMemOwn)
33 throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
34 global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
35 obj.swigCMemOwn = false;
36 obj.Dispose();
37 return ptr;
38 } else {
39 return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
40 }
41 }
42
43 ~LogCallback() {
44 Dispose(false);
45 }
46
47 public void Dispose() {
48 Dispose(true);
49 global::System.GC.SuppressFinalize(this);
50 }
51
52 protected virtual void Dispose(bool disposing) {
53 lock(this) {
54 if (swigCPtr.Handle != global::System.IntPtr.Zero) {
55 if (swigCMemOwn) {
56 swigCMemOwn = false;
58 }
59 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
60 }
61 }
62 }
63
64 public virtual void NewMessage(string message) {
65 operations_research_satPINVOKE.LogCallback_NewMessage(swigCPtr, message);
70 SwigDirectorConnect();
71 }
72
73 private void SwigDirectorConnect() {
74 if (SwigDerivedClassHasMethod("NewMessage", swigMethodTypes0))
75 swigDelegate0 = new SwigDelegateLogCallback_0(SwigDirectorMethodNewMessage);
77 }
78
79 private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {
80 global::System.Reflection.MethodInfo[] methodInfos = this.GetType().GetMethods(
81 global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance);
82 foreach (global::System.Reflection.MethodInfo methodInfo in methodInfos) {
83 if (methodInfo.DeclaringType == null)
84 continue;
85
86 if (methodInfo.Name != methodName)
87 continue;
88
89 var parameters = methodInfo.GetParameters();
90 if (parameters.Length != methodTypes.Length)
91 continue;
92
93 bool parametersMatch = true;
94 for (var i = 0; i < parameters.Length; i++) {
95 if (parameters[i].ParameterType != methodTypes[i]) {
96 parametersMatch = false;
97 break;
98 }
99 }
100
101 if (!parametersMatch)
102 continue;
103
104 if (methodInfo.IsVirtual && (methodInfo.DeclaringType.IsSubclassOf(typeof(LogCallback))) &&
105 methodInfo.DeclaringType != methodInfo.GetBaseDefinition().DeclaringType) {
106 return true;
107 }
108 }
109
110 return false;
111 }
112
113 private void SwigDirectorMethodNewMessage(string message) {
114 NewMessage(message);
115 }
116
117 public delegate void SwigDelegateLogCallback_0(string message);
118
119 private SwigDelegateLogCallback_0 swigDelegate0;
120
121 private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(string) };
122}
123
124}
delegate void SwigDelegateLogCallback_0(string message)
virtual void NewMessage(string message)
static void LogCallback_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, LogCallback.SwigDelegateLogCallback_0 delegate0)
static void delete_LogCallback(global::System.Runtime.InteropServices.HandleRef jarg1)