Z3 |

Params.cs
Go to the documentation of this file.
1/*++
2 Copyright (c) 2012 Microsoft Corporation
3
4 Module Name:
5
6 Parameter.cs
7
8 Abstract:
9
10 Z3 Managed API: Parameters
11
12 Author:
13
14 Christoph Wintersteiger (cwinter) 2012-03-20
15
16 Notes:
17
18--*/
19
20 using System.Diagnostics;
21 using System;
22
23 namespace Microsoft.Z3
24{
28 public class Params : Z3Object
29 {
33 public Params Add(Symbol name, bool value)
34 {
35 Debug.Assert(name != null);
36
37 Native.Z3_params_set_bool(Context.nCtx, NativeObject, name.NativeObject, (byte)(value ? 1 : 0));
38 return this;
39 }
40
44 public Params Add(Symbol name, uint value)
45 {
46 Debug.Assert(name != null);
47
48 Native.Z3_params_set_uint(Context.nCtx, NativeObject, name.NativeObject, value);
49 return this;
50 }
51
55 public Params Add(Symbol name, double value)
56 {
57 Debug.Assert(name != null);
58
59 Native.Z3_params_set_double(Context.nCtx, NativeObject, name.NativeObject, value);
60 return this;
61 }
62
66 public Params Add(Symbol name, string value)
67 {
68 Debug.Assert(value != null);
69
70 Native.Z3_params_set_symbol(Context.nCtx, NativeObject, name.NativeObject, Context.MkSymbol(value).NativeObject);
71 return this;
72 }
73
77 public Params Add(Symbol name, Symbol value)
78 {
79 Debug.Assert(name != null);
80 Debug.Assert(value != null);
81
82 Native.Z3_params_set_symbol(Context.nCtx, NativeObject, name.NativeObject, value.NativeObject);
83 return this;
84 }
85
86
90 public Params Add(string name, bool value)
91 {
92 Native.Z3_params_set_bool(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, (byte)(value ? 1 : 0));
93 return this;
94 }
95
99 public Params Add(string name, uint value)
100 {
101 Native.Z3_params_set_uint(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value);
102 return this;
103 }
104
108 public Params Add(string name, double value)
109 {
110 Native.Z3_params_set_double(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value);
111 return this;
112 }
113
117 public Params Add(string name, Symbol value)
118 {
119 Debug.Assert(value != null);
120
121 Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, value.NativeObject);
122 return this;
123 }
124
128 public Params Add(string name, string value)
129 {
130 Debug.Assert(name != null);
131 Debug.Assert(value != null);
132
133 Native.Z3_params_set_symbol(Context.nCtx, NativeObject, Context.MkSymbol(name).NativeObject, Context.MkSymbol(value).NativeObject);
134 return this;
135 }
136
140 public override string ToString()
141 {
142 return Native.Z3_params_to_string(Context.nCtx, NativeObject);
143 }
144
145 #region Internal
146 internal Params(Context ctx)
147 : base(ctx, Native.Z3_mk_params(ctx.nCtx))
148 {
149 Debug.Assert(ctx != null);
150 }
151
152 internal class DecRefQueue : IDecRefQueue
153 {
154 public DecRefQueue() : base() { }
155 public DecRefQueue(uint move_limit) : base(move_limit) { }
156 internal override void IncRef(Context ctx, IntPtr obj)
157 {
158 Native.Z3_params_inc_ref(ctx.nCtx, obj);
159 }
160
161 internal override void DecRef(Context ctx, IntPtr obj)
162 {
163 Native.Z3_params_dec_ref(ctx.nCtx, obj);
164 }
165 };
166
167 internal override void IncRef(IntPtr o)
168 {
169 Context.Params_DRQ.IncAndClear(Context, o);
170 base.IncRef(o);
171 }
172
173 internal override void DecRef(IntPtr o)
174 {
175 Context.Params_DRQ.Add(o);
176 base.DecRef(o);
177 }
178 #endregion
179 }
180}
Microsoft.Z3.Context
The main interaction with Z3 happens via the Context.
Definition: Context.cs:32
Microsoft.Z3.Context.Params_DRQ
IDecRefQueue Params_DRQ
Params DRQ
Definition: Context.cs:4765
Microsoft.Z3.Context.MkSymbol
IntSymbol MkSymbol(int i)
Creates a new symbol using an integer.
Definition: Context.cs:90
Microsoft.Z3.Params
A Params objects represents a configuration in the form of Symbol/value pairs.
Definition: Params.cs:29
Microsoft.Z3.Params.Add
Params Add(string name, uint value)
Adds a parameter setting.
Definition: Params.cs:99
Microsoft.Z3.Params.Add
Params Add(string name, string value)
Adds a parameter setting.
Definition: Params.cs:128
Microsoft.Z3.Params.Add
Params Add(string name, double value)
Adds a parameter setting.
Definition: Params.cs:108
Microsoft.Z3.Params.Add
Params Add(string name, Symbol value)
Adds a parameter setting.
Definition: Params.cs:117
Microsoft.Z3.Params.Add
Params Add(Symbol name, uint value)
Adds a parameter setting.
Definition: Params.cs:44
Microsoft.Z3.Params.ToString
override string ToString()
A string representation of the parameter set.
Definition: Params.cs:140
Microsoft.Z3.Params.Add
Params Add(Symbol name, bool value)
Adds a parameter setting.
Definition: Params.cs:33
Microsoft.Z3.Params.Add
Params Add(string name, bool value)
Adds a parameter setting.
Definition: Params.cs:90
Microsoft.Z3.Params.Add
Params Add(Symbol name, double value)
Adds a parameter setting.
Definition: Params.cs:55
Microsoft.Z3.Params.Add
Params Add(Symbol name, string value)
Adds a parameter setting.
Definition: Params.cs:66
Microsoft.Z3.Params.Add
Params Add(Symbol name, Symbol value)
Adds a parameter setting.
Definition: Params.cs:77
Microsoft.Z3.Symbol
Symbols are used to name several term and type constructors.
Definition: Symbol.cs:30
Microsoft.Z3.Z3Object
Internal base class for interfacing with native Z3 objects. Should not be used externally.
Definition: Z3Object.cs:33
Microsoft.Z3
Definition: AlgebraicNum.cs:27
Z3_mk_params
Z3_params Z3_API Z3_mk_params(Z3_context c)
Create a Z3 (empty) parameter set. Starting at Z3 4.0, parameter sets are used to configure many comp...