Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

s7plcSensorBase.h 4.05 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//================================================================================
// Name        : s7plcSensorBase.h
// Author      : Michael Ott
// Contact     :
// Copyright   : 
// Description : Sensor base class for s7plc plugin.
//================================================================================

//================================================================================
// This file is part of DCDB (DataCenter DataBase)
// Copyright (C) 2020 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.
//
// 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.
//
// 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.
//================================================================================

/**
 * @defgroup s7plc s7plc plugin
 * @ingroup  pusherplugins
 *
 * @brief Describe your plugin in one sentence
 */

#ifndef S7PLC_S7PLCSENSORBASE_H_
#define S7PLC_S7PLCSENSORBASE_H_

#include "sensorbase.h"
#include "s7plcController.h"

/* 
 * TODO
 * Add plugin specific includes
 */

/**
 * @brief SensorBase specialization for this plugin.
 *
 * @ingroup s7plc
 */
class s7plcSensorBase : public SensorBase {
public:
    s7plcSensorBase(const std::string& name) :
        SensorBase(name) {
	    _db = 0;
	    _offset = 0;
	    _type = sensorType::undefined;
    }

    s7plcSensorBase(const s7plcSensorBase& other) :
        SensorBase(other) {
        /*
         * TODO
         * Copy construct plugin specific attributes
         */
    }

    virtual ~s7plcSensorBase() {
        /*
         * TODO
         * If necessary, deconstruct plugin specific attributes
         */
    }

    s7plcSensorBase& operator=(const s7plcSensorBase& other) {
        SensorBase::operator=(other);
        /*
         * TODO
         * Implement assignment operator for plugin specific attributes
         */
         
        return *this;
    }

    enum sensorType {
	undefined = 0,
	BIT,
	BYTE,
	INT,
	DINT,
	WORD,
	DWORD,
	REAL
    };
    
    void setDB(const std::string &db) { _db = stoi(db); }
    void setOffset(const std::string &offset) { _offset = stoi(offset); }
    void setType(const std::string &type) {
	if (boost::iequals(type, "BIT")) {
	    _type = BIT;
	} else if (boost::iequals(type, "BYTE")) {
	    _type = BYTE;
	} else if (boost::iequals(type, "INT")) {
	    _type = INT;
	} else if (boost::iequals(type, "DINT")) {
	    _type = DINT;
	} else if (boost::iequals(type, "WORD")) {
	    _type = WORD;
	} else if (boost::iequals(type, "DWORD")) {
	    _type = DWORD;
	} else if (boost::iequals(type, "REAL")) {
	    _type = REAL;
	} else {
	    _type = undefined;
	}
    }
    
    int getDB() { return _db; }
    int getOffset() { return _offset; }
    sensorType getType() { return _type; }
    std::string getTypeString() const {
	switch (_type) {
	    case BIT:
		return std::string("BIT");
	    case BYTE:
		return std::string("BYTE");
	    case INT:
		return std::string("INT");
	    case DINT:
		return std::string("DINT");
	    case WORD:
		return std::string("WORD");
	    case DWORD:
		return std::string("DWORD");
	    case REAL:
		return std::string("REAL");
	    default:
		return std::string("undefined");
	}
    }

    void printConfig(LOG_LEVEL ll, LOGGER& lg, unsigned leadingSpaces = 16) {
	std::string leading(leadingSpaces+4, ' ');
	LOG_VAR(ll) << leading<< "DB:     " << _db;
        LOG_VAR(ll) << leading<< "Offset: " << _offset;
	LOG_VAR(ll) << leading<< "Type:   " << getTypeString();
    }

protected:
    int _db;
    int _offset;
    sensorType _type;
};

#endif /* S7PLC_S7PLCSENSORBASE_H_ */