AnalyzerConfiguratorInterface.h 3.36 KB
Newer Older
Alessio Netti's avatar
Alessio Netti committed
1
2
3
4
5
6
7
8
9
10
11
12
//
// Created by Netti, Alessio on 10.12.18.
//

#ifndef PROJECT_ANALYZERCONFIGURATORINTERFACE_H
#define PROJECT_ANALYZERCONFIGURATORINTERFACE_H

#include <string>
#include <vector>

#include "QueryEngine.h"
#include "AnalyzerInterface.h"
Alessio Netti's avatar
Alessio Netti committed
13
#include "globalconfiguration.h"
Alessio Netti's avatar
Alessio Netti committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

/**
 * Interface to configurators for data analyzer plugins
 *
 * This interface is the one exposed outside of the .dll library containing a plugin. Classes implementing this
 * interface must perform configuration and instantiation of Analyzers objects, which are made accessible externally.
 *
 */
class AnalyzerConfiguratorInterface {

public:

    /**
    * @brief            Class constructor
    */
    AnalyzerConfiguratorInterface() {}

    /**
    * @brief            Class destructor
    */
    virtual ~AnalyzerConfiguratorInterface() {}

    /**
    * @brief            Reads a config file and instantiates analyzers
    *
    *                   This method will read the config file to which the input path points, and instantiate analyzer
    *                   objects accordingly. This method must be implemented in derived classes.
    *
    * @param cfgPath    Path of the input config file
    * @return           True if successful, false otherwise
    */
    virtual bool	readConfig(std::string cfgPath)	= 0;

    /**
    * @brief            Repeats the configuration of the plugin
    *
    *                   This method will stop and clear all analyzers that were created, and repeats the configuration,
    *                   by reading the file once again. This method must be implemented in derived classes.
    *
    * @return           True if successful, false otherwise
    */
    virtual bool	reReadConfig() 					= 0;

Alessio Netti's avatar
Alessio Netti committed
57
58
59
60
61
62
63
64
65
    /**
    * @brief            Clears the plugin configuration
    *
    *                   This method will stop and clear all analyzers that were created, returning the plugin to its
    *                   uninitialized state.
    *
    */
    virtual void	clearConfig() 					= 0;

Alessio Netti's avatar
Alessio Netti committed
66
67
68
69
70
    /**
    * @brief                    Sets a structure containing global settings to be used during analyzer creation This
    *                           method must be implemented in derived classes.
    *
    *
Alessio Netti's avatar
Alessio Netti committed
71
    * @param pluginSettings     A structure of plugin settings (see pluginsettings.h)
Alessio Netti's avatar
Alessio Netti committed
72
73
74
75
76
77
78
79
80
81
82
83
84
    */
    virtual void	setGlobalSettings(const pluginSettings_t& pluginSettings) = 0;

    /**
    * @brief            Returns a vector of analyzers
    *
    *                   This method will return the internal vector of AnalyzerInterface objects, granting access
    *                   to their units and output sensors. This method must be implemented in derived classes.
    *
    * @return           a vector of pointers to AnalyzerInterface objects
    */
    virtual std::vector<AnalyzerPtr>& getAnalyzers()	= 0;

85
86
87
88
89
90
91
    /**
    * @brief            Prints the current plugin configuration
    *
    * @param ll         Logging level at which the configuration is printed
    */
    virtual void printConfig(LOG_LEVEL ll)       = 0;

Alessio Netti's avatar
Alessio Netti committed
92
93
94
95
96
97
98
99
100
101
102
103
104
protected:

    // Logger object
    boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg;
};

// Typedefs for readable usage of create() and destroy() methods, required for dynamic libraries
typedef AnalyzerConfiguratorInterface* an_create_t();
typedef void an_destroy_t(AnalyzerConfiguratorInterface*);

#endif //PROJECT_ANALYZERCONFIGURATORINTERFACE_H