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

Diff of /trunk/gr2lib/core/coretypes/implementation/granny_log_callback_builder.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib/core/coretypes/implementation/granny_log_callback_builder.cs	2010/07/24 02:23:18	186
+++ trunk/gr2lib/core/coretypes/implementation/granny_log_callback_builder.cs	2010/07/24 04:16:43	187
@@ -11,18 +11,41 @@
 namespace gr2lib.core.coretypes.implementation
 {
     #region  public class grannylog_messageType : igrannylog_messageType
+    /// <summary>
+    /// igrannylog_messageType interface
+    /// </summary>
     public interface igrannylog_messageType
     {
+        /// <summary>
+        /// Gets LogTimeStamp
+        /// </summary>
         DateTime LogTimeStamp { get; }
+        /// <summary>
+        /// Gets LogTimeStamp as string
+        /// </summary>
         string LogTimeStampAsString { get; } 
 
+        /// <summary>
+        /// Message Type as NameValuePair
+        /// </summary>
         NameValuePair<string, granny_log_message_type> Type { get; }
+        /// <summary>
+        /// Message Origin as NameValuePair
+        /// </summary>
         NameValuePair<string, granny_log_message_origin> Origin { get; }
+        /// <summary>
+        /// get the message
+        /// </summary>
         string Message { get; }
     }
+    /// <summary>
+    /// grannylog_messageType class
+    /// </summary>
     public class grannylog_messageType : igrannylog_messageType
     {
-
+        /// <summary>
+        /// default constructor
+        /// </summary>
         public grannylog_messageType()
         {
             _LogTimeStamp = DateTime.Now;
@@ -30,7 +53,9 @@
             _Origin = new NameValuePair<string, granny_log_message_origin>("default_origin", 0);
             _Message = "{no message}";
         }
-
+        /// <summary>
+        /// default constructor - specify: Type, Origin, Message)
+        /// </summary>
         public grannylog_messageType(NameValuePair<string, granny_log_message_type> Type, NameValuePair<string, granny_log_message_origin> Origin, string Message)
         {
             _LogTimeStamp = DateTime.Now;
@@ -46,67 +71,122 @@
         private string _Message;
 
         private DateTime _LogTimeStamp;
+
+        /// <summary>
+        /// Gets LogTimeStamp
+        /// </summary>
         public DateTime LogTimeStamp { get { return _LogTimeStamp; } }
-        public string LogTimeStampAsString { get { return this.LogTimeStamp.ToString("MM/dd/yyyy hh:mm:ss.fff tt"); } } 
+        /// <summary>
+        /// Gets LogTimeStamp as string
+        /// </summary>
+        public string LogTimeStampAsString { get { return this.LogTimeStamp.ToString("MM/dd/yyyy hh:mm:ss.fff tt"); } }
+        /// <summary>
+        /// Message Type as NameValuePair
+        /// </summary>
         public NameValuePair<string, granny_log_message_type> Type { get { return _Type; } }
+        /// <summary>
+        /// Message Origin as NameValuePair
+        /// </summary>
         public NameValuePair<string, granny_log_message_origin> Origin { get { return _Origin; } }
+        /// <summary>
+        /// get the message
+        /// </summary>
         public string Message { get { return _Message; } }
         #endregion
     }
     #endregion
 
     #region public class granny_log_eventargs : EventArgs
+    /// <summary>
+    /// granny_log_eventargs class
+    /// </summary>
     public class granny_log_eventargs : EventArgs
     {
         private string message;
         private granny_log_message_type type;
         private granny_log_message_origin origin;
-        private string _type_string;
-        private string _origin_string;
-
-        public granny_log_eventargs(granny_log_message_type type, granny_log_message_origin origin, string message)
-        {
-            this.type = type;
-            this.origin = origin;
-            this.message = message;
-            this._type_string = coreapi.GrannyGetLogMessageTypeString(type);
-            this._origin_string = coreapi.GrannyGetLogMessageOriginString(origin);
-        }
-        public granny_log_eventargs(granny_log_message_type type, granny_log_message_origin origin, [MarshalAs(UnmanagedType.LPStr)] string message, string type_string, string origin_string)
+        /// <summary>
+        /// default constructor - specify: type, origin, message
+        /// </summary>
+        /// <param name="type"></param>
+        /// <param name="origin"></param>
+        /// <param name="message"></param>
+        public granny_log_eventargs(granny_log_message_type type, granny_log_message_origin origin, [MarshalAs(UnmanagedType.LPStr)] string message)
         {
             this.type = type;
             this.origin = origin;
             this.message = message;
-            this._type_string = type_string;
-            this._origin_string = origin_string;
         }
 
+        /// <summary>
+        /// Get Message Log Type value
+        /// </summary>
         public granny_log_message_type Type { get { return type; } }
+
+        /// <summary>
+        /// Get Message Log Origin value
+        /// </summary>
         public granny_log_message_origin Origin { get { return origin; } }
 
-        public string TypeString { get { return _type_string; } }
-        public string OriginString { get { return _origin_string; } }
+        /// <summary>
+        /// Get Message Log Type name
+        /// </summary>
+        public string TypeString { get { return coreapi.GrannyGetLogMessageTypeString(type); } }
+        /// <summary>
+        /// Get Message Log Origin name
+        /// </summary>
+        public string OriginString { get { return coreapi.GrannyGetLogMessageOriginString(origin); } }
+        /// <summary>
+        /// Get the Message
+        /// </summary>
         public string Message { get { return message; } }
     }
     #endregion
 
     #region public class granny_log_callback_builder : igranny_log_callback_builder
+    /// <summary>
+    /// granny_log_callback_builder class
+    /// </summary>
     public class granny_log_callback_builder : igranny_log_callback_builder
     {
+        /// <summary>
+        /// granny_log_callback_method delegate
+        /// </summary>
+        /// <param name="Type">granny_log_message_type</param>
+        /// <param name="Origin">granny_log_message_origin</param>
+        /// <param name="Message">The log message</param>
+        /// <param name="UserData">Pointer to UserData, in this implementation is always: IntPtr.Zero</param>
         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
         public delegate void granny_log_callback_method(granny_log_message_type Type, granny_log_message_origin Origin, [MarshalAs(UnmanagedType.LPStr)] string Message, IntPtr UserData);
 
+        /// <summary>
+        /// OnMessageLogged delegate
+        /// </summary>
+        /// <param name="sender">object</param>
+        /// <param name="e">granny_log_eventargs</param>
         public delegate void OnMessageLogged(object sender, granny_log_eventargs e);
+        /// <summary>
+        /// Handler for OnMessageLogged delegate, use this if you wish to handle Granny2 Log Events in your own code
+        /// </summary>
         public event OnMessageLogged OnMessageLoggedEventHandler;
 
         internal granny_log_callback _log_call_back;
         internal granny_log_callback_method _callback = null;
 
+        /// <summary>
+        /// granny_log_callback
+        /// </summary>
         [StructLayout(LayoutKind.Sequential, Pack = 4), Size(Size = 8)]
         public struct granny_log_callback
         {
+            /// <summary>
+            /// the fucntion to call when something is logged
+            /// </summary>
             [MarshalAs(UnmanagedType.FunctionPtr)]
             public granny_log_callback_method Function;
+            /// <summary>
+            /// pointer to UserData, in this implementation is always: IntPtr.Zero
+            /// </summary>
             public IntPtr UserData;
         }
 
@@ -130,7 +210,7 @@
                         new NameValuePair<string, granny_log_message_type>(TypeString, Type),
                         new NameValuePair<string, granny_log_message_origin>(OriginString, Origin),
                         Message);
-                    this.Ingored.Add(_msg_ignored);
+                    this.Ignored.Add(_msg_ignored);
                     break;
                 case granny_log_message_type.GrannyNoteLogMessage:
                     grannylog_messageType _msg_note = new grannylog_messageType(
@@ -173,11 +253,21 @@
         }
         #endregion
 
+        /// <summary>
+        /// default constructor
+        /// </summary>
         public granny_log_callback_builder() { _callback = new granny_log_callback_method(this.LogCallback); }
         //public granny_log_callback_builder(coreapi.granny_log_callback_method LogCallBack) { this._callback = LogCallBack; }
+        /// <summary>
+        /// default constructor - specify: OnMessageLoggedEvntHandler
+        /// </summary>
+        /// <param name="OnMessageLoggedEvntHandler">delegate that will be called when ever something is logged (use this if you wish to handle Granny2 Log Events in your own code)</param>
         public granny_log_callback_builder(OnMessageLogged OnMessageLoggedEvntHandler) { OnMessageLoggedEventHandler = OnMessageLoggedEvntHandler; _callback = new granny_log_callback_method(this.LogCallback); }
 
         #region Start Logger
+        /// <summary>
+        /// When called will initialize the logger
+        /// </summary>
         public void StartLogging()
         {
             try
@@ -199,6 +289,9 @@
         #endregion
 
         #region Stop Logger
+        /// <summary>
+        /// When called will destroy the logger
+        /// </summary>
         public void StopLogging()
         {
             try
@@ -226,10 +319,25 @@
         private List<grannylog_messageType> _Error = new List<grannylog_messageType>();
         private List<grannylog_messageType> _OnePastLastMessage = new List<grannylog_messageType>();
 
-        public List<grannylog_messageType> Ingored { get { return _Ingored; } }
+        /// <summary>
+        /// Get the Ignored Log
+        /// </summary>
+        public List<grannylog_messageType> Ignored { get { return _Ingored; } }
+        /// <summary>
+        /// Get the Note Log
+        /// </summary>
         public List<grannylog_messageType> Note { get { return _Note; } }
+        /// <summary>
+        /// Get the Warning Log
+        /// </summary>
         public List<grannylog_messageType> Warning { get { return _Warning; } }
+        /// <summary>
+        /// Get the Error Log
+        /// </summary>
         public List<grannylog_messageType> Error { get { return _Error; } }
+        /// <summary>
+        /// Get the OnePastLastMessage Log
+        /// </summary>
         public List<grannylog_messageType> OnePastLastMessage { get { return _OnePastLastMessage; } }
         #endregion
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22