DotNet Reference

.Net Reference

SolveWrapper.cs
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 4.0.2
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 
11 namespace Google.OrTools.Sat {
12 
13 // Used to wrap log callbacks (std::function<void(const std::string&>)
14 public delegate void StringToVoidDelegate(string message);
15 
16 public class SolveWrapper : global::System.IDisposable {
17  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
18  protected bool swigCMemOwn;
19 
20  internal SolveWrapper(global::System.IntPtr cPtr, bool cMemoryOwn) {
21  swigCMemOwn = cMemoryOwn;
22  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
23  }
24 
25  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SolveWrapper obj) {
26  return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
27  }
28 
29  ~SolveWrapper() {
30  Dispose(false);
31  }
32 
33  public void Dispose() {
34  Dispose(true);
35  global::System.GC.SuppressFinalize(this);
36  }
37 
38  protected virtual void Dispose(bool disposing) {
39  lock(this) {
40  if (swigCPtr.Handle != global::System.IntPtr.Zero) {
41  if (swigCMemOwn) {
42  swigCMemOwn = false;
44  }
45  swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
46  }
47  }
48  }
49 
50  public void SetStringParameters(string string_parameters) {
53  }
54 
55  public void AddSolutionCallback(SolutionCallback callback) {
58  }
59 
60  public void ClearSolutionCallback(SolutionCallback callback) {
63  }
64 
65  public void AddLogCallbackFromClass(LogCallback log_callback) {
67  }
68 
70  byte[] tmp = new byte[4];
71  System.IntPtr data = operations_research_satPINVOKE.SolveWrapper_Solve(swigCPtr, model_proto.CalculateSize(), ProtoHelper.ProtoToByteArray(model_proto));
72  System.Runtime.InteropServices.Marshal.Copy(data, tmp, 0, 4);
73  int size = System.BitConverter.ToInt32(tmp, 0);
74  byte[] buf = new byte[size + 4];
75  System.Runtime.InteropServices.Marshal.Copy(data, buf, 0, size + 4);
76  // TODO(user): delete the C++ buffer.
77  try {
78  Google.Protobuf.CodedInputStream input =
79  new Google.Protobuf.CodedInputStream(buf, 4, size);
81  proto.MergeFrom(input);
82  return proto;
83  } catch (Google.Protobuf.InvalidProtocolBufferException /*e*/) {
84  throw new System.Exception(
85  "Unable to parse Google.OrTools.Sat.CpSolverResponse protocol message.");
86  }
87 }
88 
89  public void StopSearch() {
91  }
92 
93  public SolveWrapper() : this(operations_research_satPINVOKE.new_SolveWrapper(), true) {
94  }
95 
96 }
97 
98 }
static byte[] ProtoToByteArray(IMessage message)
Definition: ProtoHelper.cs:22
A constraint programming problem.
Definition: CpModel.pb.cs:7952
The response returned by a solver trying to solve a CpModelProto.
Definition: CpModel.pb.cs:8424
void MergeFrom(CpSolverResponse other)
Definition: CpModel.pb.cs:9099
void ClearSolutionCallback(SolutionCallback callback)
Definition: SolveWrapper.cs:60
void AddLogCallbackFromClass(LogCallback log_callback)
Definition: SolveWrapper.cs:65
Google.OrTools.Sat.CpSolverResponse Solve(Google.OrTools.Sat.CpModelProto model_proto)
Definition: SolveWrapper.cs:69
virtual void Dispose(bool disposing)
Definition: SolveWrapper.cs:38
void AddSolutionCallback(SolutionCallback callback)
Definition: SolveWrapper.cs:55
void SetStringParameters(string string_parameters)
Definition: SolveWrapper.cs:50
static void SolveWrapper_StopSearch(global::System.Runtime.InteropServices.HandleRef jarg1)
static void SolveWrapper_ClearSolutionCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void SolveWrapper_SetStringParameters(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2)
static void delete_SolveWrapper(global::System.Runtime.InteropServices.HandleRef jarg1)
static void SolveWrapper_AddLogCallbackFromClass(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static void SolveWrapper_AddSolutionCallback(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2)
static System.IntPtr SolveWrapper_Solve(global::System.Runtime.InteropServices.HandleRef jarg1, int model_proto_size, byte[] jarg2)
delegate void StringToVoidDelegate(string message)