Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
BestBoundCallback.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.1
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 partial class BestBoundCallback : global::System.IDisposable {
18 private global::System.Runtime.InteropServices.HandleRef swigCPtr;
19 protected bool swigCMemOwn;
20
21 internal BestBoundCallback(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(BestBoundCallback 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(BestBoundCallback 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 ~BestBoundCallback() {
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 NewBestBound(double bound) {
65 operations_research_satPINVOKE.BestBoundCallback_NewBestBound(swigCPtr, bound);
66 }
67
68 public BestBoundCallback() : this(operations_research_satPINVOKE.new_BestBoundCallback(), true) {
69 SwigDirectorConnect();
70 }
71
72 private void SwigDirectorConnect() {
73 if (SwigDerivedClassHasMethod("NewBestBound", swigMethodTypes0))
74 swigDelegate0 = new SwigDelegateBestBoundCallback_0(SwigDirectorMethodNewBestBound);
76 }
77
78 private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) {
79 global::System.Reflection.MethodInfo[] methodInfos = this.GetType().GetMethods(
80 global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Instance);
81 foreach (global::System.Reflection.MethodInfo methodInfo in methodInfos) {
82 if (methodInfo.DeclaringType == null)
83 continue;
84
85 if (methodInfo.Name != methodName)
86 continue;
87
88 var parameters = methodInfo.GetParameters();
89 if (parameters.Length != methodTypes.Length)
90 continue;
91
92 bool parametersMatch = true;
93 for (var i = 0; i < parameters.Length; i++) {
94 if (parameters[i].ParameterType != methodTypes[i]) {
95 parametersMatch = false;
96 break;
97 }
98 }
99
100 if (!parametersMatch)
101 continue;
102
103 if (methodInfo.IsVirtual && (methodInfo.DeclaringType.IsSubclassOf(typeof(BestBoundCallback))) &&
104 methodInfo.DeclaringType != methodInfo.GetBaseDefinition().DeclaringType) {
105 return true;
106 }
107 }
108
109 return false;
110 }
111
112 private void SwigDirectorMethodNewBestBound(double bound) {
113 NewBestBound(bound);
114 }
115
116 public delegate void SwigDelegateBestBoundCallback_0(double bound);
117
118 private SwigDelegateBestBoundCallback_0 swigDelegate0;
119
120 private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(double) };
121}
122
123}
virtual void NewBestBound(double bound)
delegate void SwigDelegateBestBoundCallback_0(double bound)
static void BestBoundCallback_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, BestBoundCallback.SwigDelegateBestBoundCallback_0 delegate0)
static void delete_BestBoundCallback(global::System.Runtime.InteropServices.HandleRef jarg1)