UnitInterface.h 3.85 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//================================================================================
// Name        : UnitInterface.h
// Author      : Alessio Netti
// Copyright   : Leibniz Supercomputing Centre
// Description : Interface for Units used by Analyzers.
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2019-2019 Leibniz Supercomputing Centre
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
Alessio Netti's avatar
Alessio Netti committed
16
//
17
18
19
20
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
Alessio Netti's avatar
Alessio Netti committed
21
//
22
23
24
25
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//================================================================================
Alessio Netti's avatar
Alessio Netti committed
26
27
28
29
30

#ifndef PROJECT_UNITINTERFACE_H
#define PROJECT_UNITINTERFACE_H

#include <vector>
31
#include "sensorbase.h"
Alessio Netti's avatar
Alessio Netti committed
32

Alessio Netti's avatar
Alessio Netti committed
33
34
35
// 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
36
/**
37
 * @brief Interface for Units used by Analyzers to perform data analytics.
Alessio Netti's avatar
Alessio Netti committed
38
 *
39
40
41
42
 * @details An Unit represents a logical entity on which an Analyzer operates,
 *          and is identified by its name, inputs and outputs.
 *
 * @ingroup analyzer
Alessio Netti's avatar
Alessio Netti committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 */
class UnitInterface {

public:

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

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

Alessio Netti's avatar
Alessio Netti committed
58
59
60
61
62
63
64
    /**
    * @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
65
66
67
68
69
70
71
72
73
    /**
    * @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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103

    /**
    * @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;

104
105
106
107
108
109
110
111
    /**
    * @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
112
113
114
115
116
117
};

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

#endif //PROJECT_UNITINTERFACE_H