NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Config.Syntax.LogSyntaxNode Class Reference
Inheritance diagram for Ntp.Analyzer.Config.Syntax.LogSyntaxNode:
Collaboration diagram for Ntp.Analyzer.Config.Syntax.LogSyntaxNode:

Public Member Functions

 LogSyntaxNode (string name, int line)
 
- Public Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >
void Add (ISyntaxNode node)
 
void Assemble (ISyntaxNode node)
 
Compile ()
 
void CompileNode ()
 
IEnumerator< ISyntaxNodeGetEnumerator ()
 
void Resolve (SymbolTable table)
 
void Validate (SymbolTable table)
 

Protected Member Functions

override LogConfiguration InternalCompile ()
 
override void ValidateMandatories ()
 Override to validates the mandatory types in this syntax node. More...
 
override void ValidateTypes ()
 Override to validates the types in this syntax node. More...
 
- Protected Member Functions inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >
 SyntaxNode (Symbol symbol, string name, int line, bool requirePath=false)
 
void AddError (string message)
 
void AddReferenceNameError (ISyntaxNode node, string keyword, string name)
 
void AddReferenceTypeError (ISyntaxNode node, string keyword, string section, string name)
 
void CheckAllIsPresent (IEnumerable< Symbol > list)
 
void CheckIsUnique (IEnumerable< Symbol > list)
 
Uri CheckLink (string link, string keyword)
 
void CheckOneIsPresent (IEnumerable< Symbol > list)
 
void CheckOnlyOneIsPresent (IEnumerable< Symbol > list)
 
void CheckTypeIs< TU > (Symbol symbol)
 
void CheckTypeIs< TU, TV > (Symbol symbol)
 
virtual void InternalResolve (SymbolTable table)
 Override to resolve references to other syntax nodes from this syntax node. More...
 
virtual void ValidateReferences (SymbolTable table)
 Override to validates the references in this syntax node. More...
 

Additional Inherited Members

- Public Attributes inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >
ConfigurationNode CompiledNode
 
IEnumerable< string > Errors
 
bool HasErrors
 
- Properties inherited from Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >
int Line [get]
 
string Name [get]
 
List< ISyntaxNodeNodes [get]
 
bool RequirePath [get]
 
Symbol Symbol [get]
 

Detailed Description

Definition at line 32 of file LogSyntaxNode.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Config.Syntax.LogSyntaxNode.LogSyntaxNode ( string  name,
int  line 
)
inline

Definition at line 34 of file LogSyntaxNode.cs.

References Ntp.Analyzer.Config.Table.KeywordLog.

35  : base(Symbol.KeywordLog, name, line)
36  {
37  }

Member Function Documentation

override LogConfiguration Ntp.Analyzer.Config.Syntax.LogSyntaxNode.InternalCompile ( )
inlineprotectedvirtual

Implements Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >.

Definition at line 39 of file LogSyntaxNode.cs.

40  {
41  var logType = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordType) as LogTypeNode;
42  var threshold = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordSeverity) as SeverityNode;
43  var showTime = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordShowTimestamp) as BooleanSettingNode;
44  var showSeverity = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordShowSeverity) as BooleanSettingNode;
45  var timeFormat = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordTimeFormat) as StringSettingNode;
46  var file = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFile) as StringSettingNode;
47 
48  return new LogConfiguration(
49  Name,
50  logType?.LogType,
51  threshold?.Severity,
52  showTime?.Value,
53  showSeverity?.Value,
54  timeFormat?.Value,
55  file?.Value
56  );
57  }
override void Ntp.Analyzer.Config.Syntax.LogSyntaxNode.ValidateMandatories ( )
inlineprotectedvirtual

Override to validates the mandatory types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >.

Definition at line 59 of file LogSyntaxNode.cs.

60  {
61  CheckIsUnique(new List<Symbol>
62  {
63  Symbol.KeywordType,
64  Symbol.KeywordSeverity,
65  Symbol.KeywordShowSeverity,
66  Symbol.KeywordShowTimestamp,
67  Symbol.KeywordTimeFormat,
68  Symbol.KeywordFile
69  });
70 
71  var type = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordType) as LogTypeNode;
72  var fileName = Nodes.SingleOrDefault(n => n.Symbol == Symbol.KeywordFile) as StringSettingNode;
73 
74  if ((type == null || type.LogType == LogType.File) && fileName == null)
75  {
76  AddError("Log file name is missing.");
77  }
78  }
override void Ntp.Analyzer.Config.Syntax.LogSyntaxNode.ValidateTypes ( )
inlineprotectedvirtual

Override to validates the types in this syntax node.

When overriding this method do not call the base method.

Reimplemented from Ntp.Analyzer.Config.Syntax.SyntaxNode< LogConfiguration >.

Definition at line 80 of file LogSyntaxNode.cs.

81  {
82  CheckTypeIs<StringSettingNode>(Symbol.KeywordTimeFormat);
83  CheckTypeIs<StringSettingNode>(Symbol.KeywordFile);
84  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordShowTimestamp);
85  CheckTypeIs<BooleanSettingNode>(Symbol.KeywordShowSeverity);
86  }

The documentation for this class was generated from the following file: