Z3
Loading...
Searching...
No Matches
src
api
dotnet
ASTMap.cs
Go to the documentation of this file.
1
/*++
2
Copyright (c) 2012 Microsoft Corporation
3
4
Module Name:
5
6
ASTMap.cs
7
8
Abstract:
9
10
Z3 Managed API: AST Maps
11
12
Author:
13
14
Christoph Wintersteiger (cwinter) 2012-03-21
15
16
Notes:
17
18
--*/
19
20
using
System.Diagnostics;
21
using
System;
22
23
namespace
Microsoft.Z3
24
{
28
public
class
ASTMap
:
Z3Object
29
{
35
public
bool
Contains
(
AST
k)
36
{
37
Debug.Assert(k !=
null
);
38
39
return
0 != Native.Z3_ast_map_contains(
Context
.nCtx, NativeObject, k.NativeObject);
40
}
41
49
public
AST
Find
(
AST
k)
50
{
51
Debug.Assert(k !=
null
);
52
53
return
new
AST
(
Context
, Native.Z3_ast_map_find(
Context
.nCtx, NativeObject, k.NativeObject));
54
}
55
61
public
void
Insert
(
AST
k,
AST
v)
62
{
63
Debug.Assert(k !=
null
);
64
Debug.Assert(v !=
null
);
65
66
Native.Z3_ast_map_insert(
Context
.nCtx, NativeObject, k.NativeObject, v.NativeObject);
67
}
68
73
public
void
Erase
(
AST
k)
74
{
75
Debug.Assert(k !=
null
);
76
77
Native.Z3_ast_map_erase(
Context
.nCtx, NativeObject, k.NativeObject);
78
}
79
83
public
void
Reset
()
84
{
85
Native.Z3_ast_map_reset(
Context
.nCtx, NativeObject);
86
}
87
91
public
uint
Size
92
{
93
get
{
return
Native.Z3_ast_map_size(
Context
.nCtx, NativeObject); }
94
}
95
99
public
AST
[]
Keys
100
{
101
get
102
{
103
using
ASTVector
res =
new
ASTVector
(
Context
, Native.Z3_ast_map_keys(
Context
.nCtx, NativeObject));
104
return
res.ToArray();
105
}
106
}
107
111
public
override
string
ToString
()
112
{
113
return
Native.Z3_ast_map_to_string(
Context
.nCtx, NativeObject);
114
}
115
116
#region Internal
117
internal
ASTMap
(
Context
ctx, IntPtr obj)
118
: base(ctx, obj)
119
{
120
Debug.Assert(ctx !=
null
);
121
}
122
internal
ASTMap(
Context
ctx)
123
: base(ctx, Native.
Z3_mk_ast_map
(ctx.nCtx))
124
{
125
Debug.Assert(ctx !=
null
);
126
}
127
128
internal
override
void
IncRef(IntPtr o)
129
{
130
Native.Z3_ast_map_inc_ref(
Context
.nCtx, o);
131
}
132
133
internal
override
void
DecRef(IntPtr o)
134
{
135
lock (
Context
)
136
{
137
if
(
Context
.nCtx != IntPtr.Zero)
138
Native.Z3_ast_map_dec_ref(
Context
.nCtx, o);
139
}
140
}
141
#endregion
142
}
143
}
Microsoft.Z3.AST
The abstract syntax tree (AST) class.
Definition
AST.cs:31
Microsoft.Z3.ASTMap
Map from AST to AST.
Definition
ASTMap.cs:29
Microsoft.Z3.ASTMap.Reset
void Reset()
Removes all keys from the map.
Definition
ASTMap.cs:83
Microsoft.Z3.ASTMap.Insert
void Insert(AST k, AST v)
Stores or replaces a new key/value pair in the map.
Definition
ASTMap.cs:61
Microsoft.Z3.ASTMap.Size
uint Size
The size of the map.
Definition
ASTMap.cs:92
Microsoft.Z3.ASTMap.ToString
override string ToString()
Retrieves a string representation of the map.
Definition
ASTMap.cs:111
Microsoft.Z3.ASTMap.Keys
AST[] Keys
The keys stored in the map.
Definition
ASTMap.cs:100
Microsoft.Z3.ASTMap.Erase
void Erase(AST k)
Erases the key k from the map.
Definition
ASTMap.cs:73
Microsoft.Z3.ASTMap.Contains
bool Contains(AST k)
Checks whether the map contains the key k .
Definition
ASTMap.cs:35
Microsoft.Z3.ASTMap.Find
AST Find(AST k)
Finds the value associated with the key k .
Definition
ASTMap.cs:49
Microsoft.Z3.ASTVector
Vectors of ASTs.
Definition
ASTVector.cs:29
Microsoft.Z3.Context
The main interaction with Z3 happens via the Context.
Definition
Context.cs:34
Microsoft.Z3.Z3Object
Internal base class for interfacing with native Z3 objects. Should not be used externally.
Definition
Z3Object.cs:33
Microsoft.Z3.Z3Object.Context
Context Context
Access Context object.
Definition
Z3Object.cs:111
Z3_mk_ast_map
Z3_ast_map Z3_API Z3_mk_ast_map(Z3_context c)
Return an empty mapping from AST to AST.
Microsoft.Z3
Definition
AlgebraicNum.cs:27
Generated on Mon Aug 24 2026 04:10:13 for Z3 by
1.9.8