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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 william 79 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 william 95 using System.Diagnostics;
8 william 79 namespace gr2lib.core.coretypes.implementation
9     {
10     public class Map : IMap
11     {
12 william 80 public Map()
13     {
14 william 83 //this.NativePointer = IntPtr.Zero;
15     //this.MapPointer = IntPtr.Zero;
16 william 80 this.Usage = "";
17     }
18 william 79 internal static Map ReadFromMemory(IntPtr pointer)
19     {
20 william 86 try
21     {
22 william 79 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 william 86 }
28 william 102 catch
29 william 86 {
30 william 95 StackTrace st = new StackTrace(true);
31 william 102 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
32     Console.WriteLine(st.ToString());
33     #endif
34 william 86 return default(Map);
35     }
36 william 79 }
37    
38     internal static Map ReadFromNative(native.Map native)
39     {
40 william 86 try
41     {
42 william 79 Map managed = new Map();
43     managed.Usage = native.Usage;
44     managed.MapPointer = native.MapPointer;
45     return managed;
46 william 86 }
47 william 102 catch
48 william 86 {
49 william 95 StackTrace st = new StackTrace(true);
50 william 102 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
51     Console.WriteLine(st.ToString());
52     #endif
53 william 86 return default(Map);
54     }
55 william 79 }
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