/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/Map.cs
ViewVC logotype

Contents of /trunk/gr2lib/core/coretypes/implementation/Map.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (show annotations) (download)
Sat Jul 17 13:54:18 2010 UTC (9 years, 4 months ago) by william
File size: 2119 byte(s)
add compiler directive to write exceptions to console or not

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using gr2lib.core.helpers;
6 using gr2lib.core.interfaces;
7 using System.Diagnostics;
8 namespace gr2lib.core.coretypes.implementation
9 {
10 public class Map : IMap
11 {
12 public Map()
13 {
14 //this.NativePointer = IntPtr.Zero;
15 //this.MapPointer = IntPtr.Zero;
16 this.Usage = "";
17 }
18 internal static Map ReadFromMemory(IntPtr pointer)
19 {
20 try
21 {
22 if (pointer == IntPtr.Zero) return null;
23 native.Map native = Helpers.ReadFromMemory<native.Map>(pointer);
24 Map managed = ReadFromNative(native);
25 managed.NativePointer = pointer;
26 return managed;
27 }
28 catch
29 {
30 StackTrace st = new StackTrace(true);
31 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
32 Console.WriteLine(st.ToString());
33 #endif
34 return default(Map);
35 }
36 }
37
38 internal static Map ReadFromNative(native.Map native)
39 {
40 try
41 {
42 Map managed = new Map();
43 managed.Usage = native.Usage;
44 managed.MapPointer = native.MapPointer;
45 return managed;
46 }
47 catch
48 {
49 StackTrace st = new StackTrace(true);
50 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
51 Console.WriteLine(st.ToString());
52 #endif
53 return default(Map);
54 }
55 }
56
57 #region INativePointer Members
58 private IntPtr _NativePointer;
59 public IntPtr NativePointer { get { return _NativePointer; } set { _NativePointer = value; } }
60 #endregion
61
62 #region IMap Members
63 private string _Usage;
64 private IntPtr _MapPointer;
65
66 public string Usage { get { return _Usage; } set { _Usage = value; } }
67 public IntPtr MapPointer { get { return _MapPointer; } set { _MapPointer = value; } }
68 #endregion
69 }
70 }

  ViewVC Help
Powered by ViewVC 1.1.22