mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
other components
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
e9eab22e5c
commit
68269c43a6
250 changed files with 70871 additions and 0 deletions
98
Microsoft.Z3/ParamDescrs.cs
Normal file
98
Microsoft.Z3/ParamDescrs.cs
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*++
|
||||
Copyright (c) 2012 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
Parameter.cs
|
||||
|
||||
Abstract:
|
||||
|
||||
Z3 Managed API: Parameter Descriptions
|
||||
|
||||
Author:
|
||||
|
||||
Christoph Wintersteiger (cwinter) 2012-03-20
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Microsoft.Z3
|
||||
{
|
||||
/// <summary>
|
||||
/// A ParameterSet represents a configuration in the form of Symbol/value pairs.
|
||||
/// </summary>
|
||||
[ContractVerification(true)]
|
||||
public class ParamDescrs : Z3Object
|
||||
{
|
||||
/// <summary>
|
||||
/// validate a set of parameters.
|
||||
/// </summary>
|
||||
public void Validate(Params p)
|
||||
{
|
||||
Contract.Requires(p != null);
|
||||
Native.Z3_params_validate(Context.nCtx, p.NativeObject, NativeObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve kind of parameter.
|
||||
/// </summary>
|
||||
public Z3_param_kind GetKind(Symbol name)
|
||||
{
|
||||
Contract.Requires(name != null);
|
||||
return (Z3_param_kind)Native.Z3_param_descrs_get_kind(Context.nCtx, NativeObject, name.NativeObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve all names of parameters.
|
||||
/// </summary>
|
||||
public Symbol[] Names
|
||||
{
|
||||
get
|
||||
{
|
||||
uint sz = Native.Z3_param_descrs_size(Context.nCtx, NativeObject);
|
||||
Symbol[] names = new Symbol[sz];
|
||||
for (uint i = 0; i < sz; ++i) {
|
||||
names[i] = Symbol.Create(Context, Native.Z3_param_descrs_get_name(Context.nCtx, NativeObject, i));
|
||||
}
|
||||
return names;
|
||||
}
|
||||
}
|
||||
|
||||
#region Internal
|
||||
internal ParamDescrs(Context ctx, IntPtr obj)
|
||||
: base(ctx, obj)
|
||||
{
|
||||
Contract.Requires(ctx != null);
|
||||
}
|
||||
|
||||
internal class DecRefQueue : Z3.DecRefQueue
|
||||
{
|
||||
public override void IncRef(Context ctx, IntPtr obj)
|
||||
{
|
||||
Native.Z3_param_descrs_inc_ref(ctx.nCtx, obj);
|
||||
}
|
||||
|
||||
public override void DecRef(Context ctx, IntPtr obj)
|
||||
{
|
||||
Native.Z3_param_descrs_dec_ref(ctx.nCtx, obj);
|
||||
}
|
||||
};
|
||||
|
||||
internal override void IncRef(IntPtr o)
|
||||
{
|
||||
Context.ParamDescrs_DRQ.IncAndClear(Context, o);
|
||||
base.IncRef(o);
|
||||
}
|
||||
|
||||
internal override void DecRef(IntPtr o)
|
||||
{
|
||||
Context.ParamDescrs_DRQ.Add(o);
|
||||
base.DecRef(o);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue