3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

Managed API: Refactoring and formatting.

Signed-off-by: Christoph M. Wintersteiger <cwinter@microsoft.com>
This commit is contained in:
Christoph M. Wintersteiger 2012-11-23 18:30:51 +00:00
parent edc9dccbcf
commit 7defd469bb
52 changed files with 2006 additions and 1657 deletions

View file

@ -0,0 +1,83 @@
/*++
Copyright (c) 2012 Microsoft Corporation
Module Name:
TupleSort.cs
Abstract:
Z3 Managed API: Tuple Sorts
Author:
Christoph Wintersteiger (cwinter) 2012-11-23
Notes:
--*/
using System;
using System.Diagnostics.Contracts;
namespace Microsoft.Z3
{
/// <summary>
/// Tuple sorts.
/// </summary>
[ContractVerification(true)]
public class TupleSort : Sort
{
/// <summary>
/// The constructor function of the tuple.
/// </summary>
public FuncDecl MkDecl
{
get
{
Contract.Ensures(Contract.Result<FuncDecl>() != null);
return new FuncDecl(Context, Native.Z3_get_tuple_sort_mk_decl(Context.nCtx, NativeObject));
}
}
/// <summary>
/// The number of fields in the tuple.
/// </summary>
public uint NumFields
{
get { return Native.Z3_get_tuple_sort_num_fields(Context.nCtx, NativeObject); }
}
/// <summary>
/// The field declarations.
/// </summary>
public FuncDecl[] FieldDecls
{
get
{
Contract.Ensures(Contract.Result<FuncDecl[]>() != null);
uint n = NumFields;
FuncDecl[] res = new FuncDecl[n];
for (uint i = 0; i < n; i++)
res[i] = new FuncDecl(Context, Native.Z3_get_tuple_sort_field_decl(Context.nCtx, NativeObject, i));
return res;
}
}
#region Internal
internal TupleSort(Context ctx, Symbol name, uint numFields, Symbol[] fieldNames, Sort[] fieldSorts)
: base(ctx)
{
Contract.Requires(ctx != null);
Contract.Requires(name != null);
IntPtr t = IntPtr.Zero;
NativeObject = Native.Z3_mk_tuple_sort(ctx.nCtx, name.NativeObject, numFields,
Symbol.ArrayToNative(fieldNames), AST.ArrayToNative(fieldSorts),
ref t, new IntPtr[numFields]);
}
#endregion
};
}