UnitInterface.h 2.54 KB
Newer Older
Alessio Netti's avatar
Alessio Netti committed
1
2
3
4
5
6
7
8
//
// Created by Netti, Alessio on 07.01.19.
//

#ifndef PROJECT_UNITINTERFACE_H
#define PROJECT_UNITINTERFACE_H

#include <vector>
9
#include "sensorbase.h"
Alessio Netti's avatar
Alessio Netti committed
10

Alessio Netti's avatar
Alessio Netti committed
11
12
13
// Defines how inputs must be constructed for the specified unit
typedef enum inputMode_t { SELECTIVE = 1, ALL = 2, ALL_RECURSIVE = 3 } inputMode_t;

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
/**
 * Interface for Units used by Analyzers to perform data analytics.
 *
 * An Unit represents a logical entity on which an Analyzer operates, and is identified by its name, inputs and outputs.
 */
class UnitInterface {

public:

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

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

Alessio Netti's avatar
Alessio Netti committed
33
34
35
36
37
38
39
    /**
    * @brief            Sets the name of this unit
    *
    * @param name       The name of this unit
    */
    virtual void setName(const std::string& name) = 0;

Alessio Netti's avatar
Alessio Netti committed
40
41
42
43
44
45
46
47
48
    /**
    * @brief            Get the name of this unit
    *
    *                   A unit's name points to the logical entity that it represents; for example, it could be
    *                   "hpcsystem1.node44", or "node44.cpu10". All the outputs of the unit are then associated to its
    *                   entity, and all of the input are related to it as well.
    *
    * @return           The unit's name
    */
Alessio Netti's avatar
Alessio Netti committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    virtual std::string& getName() = 0;

    /**
    * @brief            Sets the input mode of this unit
    *
    * @param iMode      The input mode that was used for this unit
    */
    virtual void setInputMode(const inputMode_t iMode) = 0;

    /**
    * @brief            Get the input mode of this unit
    *
    * @return           The unit's input mode
    */
    virtual inputMode_t getInputMode() = 0;
Alessio Netti's avatar
Alessio Netti committed
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

    /**
    * @brief            Get the (base) input sensors of this unit
    *
    * @return           A vector of pointers to SensorBase objects that constitute this unit's input
    */
    virtual std::vector<SBasePtr>& getBaseInputs()  = 0;

    /**
    * @brief            Get the (base) output sensors of this unit
    *
    * @return           A vector of pointers to SensorBase objects that constitute this unit's output
    */
    virtual std::vector<SBasePtr>& getBaseOutputs() = 0;

79
80
81
82
83
84
85
86
    /**
    * @brief            Prints the current unit configuration
    *
    * @param ll         Logging level at which the configuration is printed
    * @param lg         Logger object to be used
    */
    virtual void printConfig(LOG_LEVEL ll, LOGGER& lg)       = 0;

Alessio Netti's avatar
Alessio Netti committed
87
88
89
90
91
92
};

//for better readability
using UnitPtr = std::shared_ptr<UnitInterface>;

#endif //PROJECT_UNITINTERFACE_H