-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Parser interface names. (#18)
* Renamed ILogFile to IParser and ILogFileParser to IParserFactory PluginFramework loads factory instances at startup which improve performance. Fixed spelling of Factories * Cleaning of TestPlugin
- Loading branch information
Showing
17 changed files
with
292 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
|
||
namespace PluginFramework | ||
{ | ||
/// <summary> | ||
/// Interface for providing a log file parser. | ||
/// </summary> | ||
public interface IParserFactory | ||
{ | ||
/// <summary> | ||
/// Returns true if the specified file can be opened. | ||
/// </summary> | ||
/// Allows for further checks that just the filename, for example reading a header. | ||
/// <param name="filename">the filename to check</param> | ||
/// <returns>True if file can be loaded. False if loading is not possible.</returns> | ||
bool CanOpen(string filename); | ||
|
||
/// <summary> | ||
/// Open the specified log file using the specified settings. | ||
/// </summary> | ||
/// <param name="filename">The filename to open</param> | ||
/// <param name="settings">The setting to use when loading. Setting should be collected from user with the ShowSettings method.</param> | ||
/// <returns>The loaded log file object.</returns> | ||
IParser Open(string filename, ParserSettings settings = null); | ||
|
||
/// <summary> | ||
/// Show file load settings dialog to user | ||
/// </summary> | ||
/// <param name="filename">The filename to open</param> | ||
/// <param name="settings">Key/value collection of settings. </param> | ||
/// <returns>True if file should be loaded. False if loading should be aborted.</returns> | ||
bool ShowSettingsDialog(string filename, ref ParserSettings settings); | ||
} | ||
|
||
/// <summary> | ||
/// Parser for a log format | ||
/// </summary> | ||
public interface IParser | ||
{ | ||
/// <summary> | ||
/// List of signals provided by this parser | ||
/// </summary> | ||
SignalList Signals { get; } | ||
|
||
/// <summary> | ||
/// Read and return the provided signal | ||
/// </summary> | ||
/// <param name="signal">The signal to read</param> | ||
/// <returns>The sample data points of the signal</returns> | ||
Sample[] ReadSignal(Signal signal); | ||
|
||
/// <summary> | ||
/// The file origo time. | ||
/// </summary> | ||
DateTime Origo { get; } | ||
|
||
/// <summary> | ||
/// The duration of the data in the file | ||
/// </summary> | ||
TimeSpan Length { get; } | ||
} | ||
|
||
public struct Sample | ||
{ | ||
public DateTime Time; | ||
public double Value; | ||
} | ||
|
||
public struct Signal | ||
{ | ||
public int UID; | ||
public string Name; | ||
public string FriendlyName; | ||
public string Unit; | ||
public string Description; | ||
public string Tag; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace PluginFramework | ||
{ | ||
using System.Collections.Generic; | ||
|
||
public class SignalList:List<Signal> | ||
{ | ||
public Signal GetSignalByName(string name) | ||
{ | ||
return this.Find(p => p.Name == name); | ||
} | ||
|
||
public Signal GetSignalByUID(int uid) | ||
{ | ||
return this.Find(p => p.UID == uid); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.