/[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 186 - (show annotations) (download)
Sat Jul 24 02:23:18 2010 UTC (9 years, 3 months ago) by william
File size: 2686 byte(s)
continue to add xml documentation

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 using gr2lib.core.exceptions;
9 namespace gr2lib.core.coretypes.implementation
10 {
11
12 /// <summary>
13 /// Map class
14 /// </summary>
15 public class Map : IMap
16 {
17 /// <summary>
18 /// default constructor
19 /// </summary>
20 public Map()
21 {
22 //this.NativePointer = IntPtr.Zero;
23 //this.MapPointer = IntPtr.Zero;
24 this.Usage = "";
25 }
26 internal static Map ReadFromMemory(IntPtr pointer)
27 {
28 try
29 {
30 if (pointer == IntPtr.Zero) return null;
31 native.Map native = Helpers.ReadFromMemory<native.Map>(pointer);
32 Map managed = ReadFromNative(native);
33 managed.NativePointer = pointer;
34 return managed;
35 }
36 catch (Exception ex)
37 {
38 StackTrace st = new StackTrace(true);
39 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
40 Granny2ExceptionWriter.WriteToConsole(ex,st);
41 #endif
42 return default(Map);
43 }
44 }
45
46 internal static Map ReadFromNative(native.Map native)
47 {
48 try
49 {
50 Map managed = new Map();
51 managed.Usage = native.Usage;
52 managed.MapPointer = native.MapPointer;
53 return managed;
54 }
55 catch (Exception ex)
56 {
57 StackTrace st = new StackTrace(true);
58 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
59 Granny2ExceptionWriter.WriteToConsole(ex,st);
60 #endif
61 return default(Map);
62 }
63 }
64
65 #region INativePointer Members
66 private IntPtr _NativePointer;
67 /// <summary>
68 /// When used in a derived class, gets the native pointer for this instance
69 /// </summary>
70 public IntPtr NativePointer { get { return _NativePointer; } set { _NativePointer = value; } }
71 #endregion
72
73
74 #region IMap Members
75 private string _Usage;
76 private IntPtr _MapPointer;
77
78 /// <summary>
79 /// Get or Set the map ussage for this insance
80 /// </summary>
81 public string Usage { get { return _Usage; } set { _Usage = value; } }
82 /// <summary>
83 /// Get or set the map pointer for this instance
84 /// </summary>
85 public IntPtr MapPointer { get { return _MapPointer; } set { _MapPointer = value; } }
86 #endregion
87 }
88 }

  ViewVC Help
Powered by ViewVC 1.1.22