EventAnalysis  1.3.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
EA::TokenizedConfigLineHandler Class Reference

Class for handling tokenized lines from configuration text files. More...

#include <TokenizedConfigLineHandler.h>

Inheritance diagram for EA::TokenizedConfigLineHandler:
EA::ConfigLineHandler

Public Member Functions

 TokenizedConfigLineHandler (AnalysisManager &manager, const CommandLineParameters &clParams)
 Constructor. More...
 
void HandleLine (const std::string &line)
 Handles a single configuration line. More...
 
- Public Member Functions inherited from EA::ConfigLineHandler
 ConfigLineHandler (AnalysisManager &manager, const CommandLineParameters &clParams)
 Constructor. More...
 
virtual ~ConfigLineHandler ()
 Destructor. More...
 

Private Types

typedef std::unordered_map< std::string, std::string > Aliases
 

Private Member Functions

bool _SetAlias (const std::string &alias, const std::string &value)
 
void _SubstituteAlias (std::string &token, std::string::size_type markerPos)
 

Private Attributes

std::unique_ptr< ConfigurationTokensHandler_tokensHandler
 
Aliases _aliases
 

Additional Inherited Members

- Protected Attributes inherited from EA::ConfigLineHandler
AnalysisManageranManager
 
const CommandLineParametersclParameters
 

Detailed Description

Class for handling tokenized lines from configuration text files.

This handler class splits the configuration line into its components (token). The actual handling of the token array is left to objects of classes derived from #ConfigTokensHandler.

Each time a tokenized command line is read by TokenizedConfigLineHandler it is passed to the current #ConfigTokensHandler. If the #ConfigTokensHandler fails to handle the command, or if no #ConfigTokensHandler exists yet, then the proper handler is created by leveraging the ConfigTokensHandler factory, and using the command name to identify the handler to be built.

Member Typedef Documentation

◆ Aliases

typedef std::unordered_map<std::string, std::string> EA::TokenizedConfigLineHandler::Aliases
private

Constructor & Destructor Documentation

◆ TokenizedConfigLineHandler()

EA::TokenizedConfigLineHandler::TokenizedConfigLineHandler ( AnalysisManager manager,
const CommandLineParameters clParams 
)
inline

Constructor.

Parameters
managerThe analysis manager to configure.

Member Function Documentation

◆ _SetAlias()

bool EA::TokenizedConfigLineHandler::_SetAlias ( const std::string &  alias,
const std::string &  value 
)
private

◆ _SubstituteAlias()

void EA::TokenizedConfigLineHandler::_SubstituteAlias ( std::string &  token,
std::string::size_type  markerPos 
)
private

◆ HandleLine()

void EA::TokenizedConfigLineHandler::HandleLine ( const std::string &  line)
virtual

Handles a single configuration line.

This routine tokenizes the configuration line and then handles it by means of #ConfigurationTokensHandler objects. The handler to be used is determined by the first token extracted by the configuration line. Throws std::runtime_error if the correct handler to be used is not found or if there is any error in processing the tokens. Some commands are handled directly by this routine:

Define <aliasName>

- Defines an alias for a given value Include <fileName> - Includes another configuration file Plugin <fileName> - Loads the specified plugin MaxMemory

<units> - Defines the maximum usable memory (approx.) MemLevels

- Defines the memory levels as percentages of MaxMemory

Aliases defined with Define can be expanded in other commands by means of the $ heading character followed by the alias name. It is not allowed to define aliases for command names.

Included files will be parsed at the moment the Include directive is encountered. All the previous Define will be valid when parsing the included file; likewise, all the Define in the included file will still be valid when resuming the parse of the original file.

The maximum usable memory is a hint for the garbage collector for limiting the used memory below the given threshold; units can be KB, MB or GB. This is not a hard limit, and it might be impossible to effectively keep the memory usage always below this limit. The memory levels are defined as percentages of the maximum usable memory that defines a memory status; the three values must be in strictly increasing order and included between 0 and 100. For example, using 70, 80 and 95 will mean that a memory usage less than 70% of max memory will give a NORMAL memory status, a usage between 70% and 80% will give a WARNING status, between 80% and 95% a CRITICAL status and over 95% an EXHAUSTED status; the worse the memory status, the more pressing the request from the garbage collector to the object producers to free the unused memory. Setting lower levels will result in worse status codes: while this can help in maintaining a low memory usage it can also impact performance since it might trigger an unneeded free of buffer memory.

Parameters
lineThe configuration line to process.

Implements EA::ConfigLineHandler.

Member Data Documentation

◆ _aliases

Aliases EA::TokenizedConfigLineHandler::_aliases
private

◆ _tokensHandler

std::unique_ptr<ConfigurationTokensHandler> EA::TokenizedConfigLineHandler::_tokensHandler
private

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