Skip to content

Commit 1e1e620

Browse files
committed
Memory
1 parent d166500 commit 1e1e620

67 files changed

Lines changed: 992 additions & 227 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/AutoColumnizer/AutoColumnizer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public string[] GetColumnNames ()
3939
throw new NotImplementedException();
4040
}
4141

42-
public IColumnizedLogLine SplitLine (ILogLineColumnizerCallback callback, ILogLine line)
42+
public IColumnizedLogLineMemory SplitLine (ILogLineColumnizerCallback callback, ILogLine line)
4343
{
4444
throw new NotImplementedException();
4545
}

src/ColumnizerLib/Column.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
namespace ColumnizerLib;
22

3-
public class Column : IColumn
3+
public class Column : IColumnMemory
44
{
5+
//TODO Memory Functions need implementation
56
#region Fields
67

78
private const string REPLACEMENT = "...";
@@ -49,9 +50,9 @@ static Column ()
4950

5051
#region Properties
5152

52-
public static IColumn EmptyColumn { get; }
53+
public static IColumnMemory EmptyColumn { get; }
5354

54-
public IColumnizedLogLine Parent { get; set; }
55+
public IColumnizedLogLineMemory Parent { get; set; }
5556

5657
public string FullValue
5758
{
@@ -75,6 +76,19 @@ public string FullValue
7576

7677
public string Text => DisplayValue;
7778

79+
public IColumnizedLogLineMemory ParentMemory { get; }
80+
81+
public ReadOnlyMemory<char> FullValueMemory
82+
{
83+
get;
84+
set; //implement
85+
}
86+
87+
public ReadOnlyMemory<char> DisplayValueMemory { get; }
88+
89+
public ReadOnlyMemory<char> TextMemory { get; }
90+
IColumnizedLogLine IColumn.Parent { get; }
91+
7892
#endregion
7993

8094
#region Public methods
@@ -99,12 +113,12 @@ public static void SetMaxDisplayLength (int maxLength)
99113
/// </summary>
100114
public static int GetMaxDisplayLength () => _maxDisplayLength;
101115

102-
public static Column[] CreateColumns (int count, IColumnizedLogLine parent)
116+
public static Column[] CreateColumns (int count, IColumnizedLogLineMemory parent)
103117
{
104118
return CreateColumns(count, parent, string.Empty);
105119
}
106120

107-
public static Column[] CreateColumns (int count, IColumnizedLogLine parent, string defaultValue)
121+
public static Column[] CreateColumns (int count, IColumnizedLogLineMemory parent, string defaultValue)
108122
{
109123
var output = new Column[count];
110124

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
namespace ColumnizerLib;
22

3-
public class ColumnizedLogLine : IColumnizedLogLine
3+
public class ColumnizedLogLine : IColumnizedLogLineMemory
44
{
55
#region Properties
66

77
public ILogLine LogLine { get; set; }
88

99
public IColumn[] ColumnValues { get; set; }
1010

11+
public ILogLineMemory LogLineMemory { get; set; }
12+
13+
public IColumnMemory[] ColumnMemoryValues { get; set; }
14+
1115
#endregion
1216
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace ColumnizerLib;
2+
3+
public interface IAutoLogLineMemoryColumnizerCallback : IAutoLogLineColumnizerCallback
4+
{
5+
/// <summary>
6+
/// Returns the log line with the given index (zero-based).
7+
/// </summary>
8+
/// <param name="lineNum">Number of the line to be retrieved</param>
9+
/// <returns>A string with line content or null if line number is out of range</returns>
10+
ILogLineMemory GetLogLineMemory (int lineNum);
11+
}

src/ColumnizerLib/IColumn.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
61
namespace ColumnizerLib;
72

83
public interface IColumn : ITextValue

src/ColumnizerLib/IColumnMemory.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace ColumnizerLib;
2+
3+
public interface IColumnMemory : IColumn, ITextValueMemory
4+
{
5+
#region Properties
6+
7+
IColumnizedLogLineMemory ParentMemory { get; }
8+
9+
ReadOnlyMemory<char> FullValueMemory { get; }
10+
11+
ReadOnlyMemory<char> DisplayValueMemory { get; }
12+
13+
#endregion
14+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace ColumnizerLib;
2+
3+
public interface IColumnizedLogLineMemory : IColumnizedLogLine
4+
{
5+
#region Properties
6+
7+
ILogLineMemory LogLineMemory { get; }
8+
9+
IColumnMemory[] ColumnMemoryValues { get; }
10+
11+
#endregion
12+
}

src/ColumnizerLib/IColumnizerPriority.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
namespace ColumnizerLib;
22

3+
/// <summary>
4+
/// Defines a method that determines the priority of a columnizer for a given file and sample log lines.
5+
/// </summary>
6+
/// <remarks>Implementations use the provided file name and sample log lines to assess how suitable the columnizer
7+
/// is for processing the file. Higher priority values indicate a better fit. This interface is typically used to select
8+
/// the most appropriate columnizer when multiple options are available.</remarks>
39
public interface IColumnizerPriority
410
{
511
/// <summary>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
namespace ColumnizerLib;
2+
3+
/// <summary>
4+
/// Defines a contract for determining the priority level of a file based on log line memory samples.
5+
/// </summary>
6+
/// <remarks>Implementations use the provided file name and sample log lines to assess how suitable the columnizer
7+
/// is for processing the file. Higher priority values indicate a better fit. This interface is typically used to select
8+
/// the most appropriate columnizer when multiple options are available.</remarks>
9+
public interface IColumnizerPriorityMemory : IColumnizerPriority
10+
{
11+
/// <summary>
12+
/// Determines the priority level for the specified file based on the provided log line samples.
13+
/// </summary>
14+
/// <param name="fileName">The name of the file for which to determine the priority. Cannot be null or empty.</param>
15+
/// <param name="samples">A collection of log line memory samples used to assess the file's priority. Cannot be null.</param>
16+
/// <returns>A value of the Priority enumeration that represents the determined priority for the specified file.</returns>
17+
Priority GetPriority (string fileName, IEnumerable<ILogLineMemory> samples);
18+
}

src/ColumnizerLib/IContextMenuEntry.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public interface IContextMenuEntry
3232
/// <li>null: No menu entry is displayed.</li>
3333
/// </ul>
3434
/// </returns>
35-
string GetMenuText (IList<int> loglines, ILogLineColumnizer columnizer, ILogExpertCallback callback);
35+
string GetMenuText (IList<int> loglines, ILogLineMemoryColumnizer columnizer, ILogExpertCallback callback);
3636

37-
string GetMenuText (int linesCount, ILogLineColumnizer columnizer, ILogLine logline);
37+
string GetMenuText (int linesCount, ILogLineMemoryColumnizer columnizer, ILogLine logline);
3838

3939

4040
/// <summary>
@@ -46,9 +46,9 @@ public interface IContextMenuEntry
4646
/// if necessary.</param>
4747
/// <param name="callback">The callback interface implemented by LogExpert. You can use the functions
4848
/// for retrieving log lines or pass it along to functions of the Columnizer if needed.</param>
49-
void MenuSelected (IList<int> loglines, ILogLineColumnizer columnizer, ILogExpertCallback callback);
49+
void MenuSelected (IList<int> loglines, ILogLineMemoryColumnizer columnizer, ILogExpertCallback callback);
5050

51-
void MenuSelected (int linesCount, ILogLineColumnizer columnizer, ILogLine logline);
51+
void MenuSelected (int linesCount, ILogLineMemoryColumnizer columnizer, ILogLine logline);
5252

5353
#endregion
5454
}

0 commit comments

Comments
 (0)