QElectroTech
0.200.1-dev
Loading...
Searching...
No Matches
contactusage.h
Go to the documentation of this file.
1
/*
2
Copyright 2006-2026 The QElectroTech Team
3
This file is part of QElectroTech.
4
5
QElectroTech is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 2 of the License, or
8
(at your option) any later version.
9
10
QElectroTech is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
#ifndef CONTACTUSAGE_H
19
#define CONTACTUSAGE_H
20
21
#include <algorithm>
22
46
struct
ContactUsage
47
{
55
enum
Type
56
{
57
NO
,
58
NC
,
59
SW
,
60
Other
61
};
62
63
int
no
= 0;
64
int
nc
= 0;
65
int
sw
= 0;
66
int
other
= 0;
67
68
int
total
()
const
{
return
no
+
nc
+
sw
+
other
; }
69
77
void
addSlave
(
Type
type,
int
contacts)
78
{
79
const
int
n = std::max(1, contacts);
80
81
switch
(type)
82
{
83
case
NO
:
no
+= n;
break
;
84
case
NC
:
nc
+= n;
break
;
85
case
SW
:
sw
+= n;
break
;
86
case
Other
:
other
+= n;
break
;
87
}
88
}
89
};
90
91
#endif
// CONTACTUSAGE_H
ContactUsage
The ContactUsage struct How many slave contacts a master element currently uses, broken down by conta...
Definition
contactusage.h:47
ContactUsage::Type
Type
Definition
contactusage.h:56
ContactUsage::Other
@ Other
Neither of the above.
Definition
contactusage.h:60
ContactUsage::NO
@ NO
Normally open.
Definition
contactusage.h:57
ContactUsage::NC
@ NC
Normally closed.
Definition
contactusage.h:58
ContactUsage::SW
@ SW
Changeover.
Definition
contactusage.h:59
ContactUsage::sw
int sw
Changeover.
Definition
contactusage.h:65
ContactUsage::no
int no
Normally open.
Definition
contactusage.h:63
ContactUsage::nc
int nc
Normally closed.
Definition
contactusage.h:64
ContactUsage::addSlave
void addSlave(Type type, int contacts)
Definition
contactusage.h:77
ContactUsage::other
int other
Neither of the above.
Definition
contactusage.h:66
ContactUsage::total
int total() const
Definition
contactusage.h:68
sources
contactusage.h
Generated by
1.15.0