Z3
Log.cs
Go to the documentation of this file.
1 /*++
2 Copyright (c) 2012 Microsoft Corporation
3 
4 Module Name:
5 
6  Log.cs
7 
8 Abstract:
9 
10  Z3 Managed API: Log
11 
12 Author:
13 
14  Christoph Wintersteiger (cwinter) 2012-03-15
15 
16 Notes:
17 
18 --*/
19 
20 using System;
22 
23 namespace Microsoft.Z3
24 {
32  [ContractVerification(true)]
33  public static class Log
34  {
35  private static bool m_is_open = false;
36 
42  public static bool Open(string filename)
43  {
44  m_is_open = true;
45  return Native.Z3_open_log(filename) == 1;
46  }
47 
51  public static void Close()
52  {
53  m_is_open = false;
54  Native.Z3_close_log();
55  }
56 
60  public static void Append(string s)
61  {
62  Contract.Requires(isOpen());
63 
64  if (!m_is_open)
65  throw new Z3Exception("Log cannot be closed.");
66  Native.Z3_append_log(s);
67  }
68 
73  [Pure]
74  public static bool isOpen()
75  {
76  return m_is_open;
77  }
78  }
79 }