.TH "ContactUsage" 3 "Version 0.200.1-dev" "QElectroTech" \" -*- nroff -*-
.ad l
.nh
.SH NAME
ContactUsage \- The \fBContactUsage\fP struct How many slave contacts a master element currently uses, broken down by contact type\&.  

.SH SYNOPSIS
.br
.PP
.PP
\fR#include <contactusage\&.h>\fP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBType\fP { \fBNO\fP, \fBNC\fP, \fBSW\fP, \fBOther\fP }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "int \fBtotal\fP () const"
.br
.ti -1c
.RI "void \fBaddSlave\fP (\fBType\fP type, int contacts)"
.br
.in -1c
.SS "Public Attributes"

.in +1c
.ti -1c
.RI "int \fBno\fP = 0"
.br
.RI "Normally open\&. "
.ti -1c
.RI "int \fBnc\fP = 0"
.br
.RI "Normally closed\&. "
.ti -1c
.RI "int \fBsw\fP = 0"
.br
.RI "Changeover\&. "
.ti -1c
.RI "int \fBother\fP = 0"
.br
.RI "Neither of the above\&. "
.in -1c
.SH "Detailed Description"
.PP 
The \fBContactUsage\fP struct How many slave contacts a master element currently uses, broken down by contact type\&. 

Header-only and free of any graphics dependency so that the counting rules can be unit tested on their own\&. \fBMasterElement::contactUsage()\fP is the thin wrapper that feeds it the linked elements\&.

.PP
This counts contacts, which is what tells you how many contacts an auxiliary block must provide\&. It is deliberately not the count that \fBMasterElement::isFull()\fP uses: a master's max_slaves is a number of slots, and a slave fills exactly one slot however many contacts it carries\&.

.PP
Two rules are easy to get wrong, and both live here so that every caller gets them right:
.IP "\(bu" 2
a slave stands for as many contacts as its "number" kind information says, so a 4 pole contact counts as 4, not as 1
.IP "\(bu" 2
a changeover contact is counted once, as sw\&. \fBCrossRefItem\fP's NOElements() and NCElements() both return it, so adding those two lists together would count it twice\&. 
.PP

.SH "Member Enumeration Documentation"
.PP 
.SS "enum \fBContactUsage::Type\fP"
Contact types a slave can declare\&. Mirrors \fBElementData::SlaveState\fP, which is not used directly so that this header stays free of the element data dependencies and can be unit tested on its own\&. \fBMasterElement::contactUsage()\fP maps between the two\&. 
.PP
\fBEnumerator\fP
.in +1c
.TP
\f(BINO \fP
Normally open\&. 
.TP
\f(BINC \fP
Normally closed\&. 
.TP
\f(BISW \fP
Changeover\&. 
.TP
\f(BIOther \fP
Neither of the above\&. 
.SH "Member Function Documentation"
.PP 
.SS "void ContactUsage::addSlave (\fBType\fP type, int contacts)\fR [inline]\fP"
Add one slave element to the tally\&. 
.PP
\fBParameters\fP
.RS 4
\fItype\fP the contact type the slave declares 
.br
\fIcontacts\fP how many contacts it stands for\&. Values below 1 are treated as 1: an element which declares no contact count is still one contact\&. 
.RE
.PP

.SS "int ContactUsage::total () const\fR [inline]\fP"

.SH "Member Data Documentation"
.PP 
.SS "int ContactUsage::nc = 0"

.PP
Normally closed\&. 
.SS "int ContactUsage::no = 0"

.PP
Normally open\&. 
.SS "int ContactUsage::other = 0"

.PP
Neither of the above\&. 
.SS "int ContactUsage::sw = 0"

.PP
Changeover\&. 

.SH "Author"
.PP 
Generated automatically by Doxygen for QElectroTech from the source code\&.
