LibrePCB Developers Documentation
boarddesignrules.h
Go to the documentation of this file.
1 /*
2  * LibrePCB - Professional EDA for everyone!
3  * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4  * https://librepcb.org/
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef LIBREPCB_CORE_BOARDDESIGNRULES_H
21 #define LIBREPCB_CORE_BOARDDESIGNRULES_H
22 
23 /*******************************************************************************
24  * Includes
25  ******************************************************************************/
26 #include "../../types/boundedunsignedratio.h"
27 #include "../../types/length.h"
28 
29 #include <QtCore>
30 
31 /*******************************************************************************
32  * Namespace / Forward Declarations
33  ******************************************************************************/
34 namespace librepcb {
35 
36 class SExpression;
37 
38 /*******************************************************************************
39  * Class BoardDesignRules
40  ******************************************************************************/
41 
45 class BoardDesignRules final {
46  Q_DECLARE_TR_FUNCTIONS(BoardDesignRules)
47 
48 public:
49  // Constructors / Destructor
50  BoardDesignRules() noexcept;
51  BoardDesignRules(const BoardDesignRules& other);
52  explicit BoardDesignRules(const SExpression& node);
53  ~BoardDesignRules() noexcept;
54 
55  // Getters: Stop Mask
56  const UnsignedLength& getStopMaskMaxViaDiameter() const noexcept {
58  }
59  const BoundedUnsignedRatio& getStopMaskClearance() const noexcept {
60  return mStopMaskClearance;
61  }
62 
63  // Getters: Solder Paste
65  return mSolderPasteClearance;
66  }
67 
68  // Getters: Pad Annular Ring
69  bool getPadCmpSideAutoAnnularRing() const noexcept {
71  }
72  bool getPadInnerAutoAnnularRing() const noexcept {
74  }
75  const BoundedUnsignedRatio& getPadAnnularRing() const noexcept {
76  return mPadAnnularRing;
77  }
78 
79  // Getters: Via Annular Ring
80  const BoundedUnsignedRatio& getViaAnnularRing() const noexcept {
81  return mViaAnnularRing;
82  }
83 
84  // Setters
85  void setStopMaskMaxViaDiameter(const UnsignedLength& dia) noexcept {
87  }
88  void setStopMaskClearance(const BoundedUnsignedRatio& value) noexcept {
89  mStopMaskClearance = value;
90  }
91  void setSolderPasteClearance(const BoundedUnsignedRatio& value) noexcept {
92  mSolderPasteClearance = value;
93  }
94  void setPadCmpSideAutoAnnularRing(bool enabled) noexcept {
96  }
97  void setPadInnerAutoAnnularRing(bool enabled) noexcept {
98  mPadInnerAutoAnnularRing = enabled;
99  }
101  mPadAnnularRing = value;
102  }
104  mViaAnnularRing = value;
105  }
106 
107  // General Methods
108  void restoreDefaults() noexcept;
109 
115  void serialize(SExpression& root) const;
116 
117  // Helper Methods
118  bool doesViaRequireStopMaskOpening(const Length& drillDia) const noexcept;
119 
120  // Operator Overloadings
121  BoardDesignRules& operator=(const BoardDesignRules& rhs) noexcept;
122  bool operator==(const BoardDesignRules& rhs) const noexcept;
123  bool operator!=(const BoardDesignRules& rhs) const noexcept {
124  return !(*this == rhs);
125  }
126 
127 private: // Methods
128  static bool parsePadAutoAnnular(const SExpression& node);
129 
130 private: // Data
131  // Stop Mask
134 
135  // Solder Paste
137 
138  // Pad Annular Ring
142 
143  // Via Annular Ring
145 };
146 
147 /*******************************************************************************
148  * End of File
149  ******************************************************************************/
150 
151 } // namespace librepcb
152 
153 #endif
bool doesViaRequireStopMaskOpening(const Length &drillDia) const noexcept
Definition: boarddesignrules.cpp:130
const UnsignedLength & getStopMaskMaxViaDiameter() const noexcept
Definition: boarddesignrules.h:56
bool mPadCmpSideAutoAnnularRing
Definition: boarddesignrules.h:139
bool mPadInnerAutoAnnularRing
Definition: boarddesignrules.h:140
BoundedUnsignedRatio mStopMaskClearance
Definition: boarddesignrules.h:133
void setSolderPasteClearance(const BoundedUnsignedRatio &value) noexcept
Definition: boarddesignrules.h:91
bool getPadInnerAutoAnnularRing() const noexcept
Definition: boarddesignrules.h:72
const BoundedUnsignedRatio & getViaAnnularRing() const noexcept
Definition: boarddesignrules.h:80
Definition: occmodel.cpp:76
void setPadAnnularRing(const BoundedUnsignedRatio &value)
Definition: boarddesignrules.h:100
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: boarddesignrules.cpp:94
The BoardDesignRules class.
Definition: boarddesignrules.h:45
BoardDesignRules & operator=(const BoardDesignRules &rhs) noexcept
Definition: boarddesignrules.cpp:139
const BoundedUnsignedRatio & getPadAnnularRing() const noexcept
Definition: boarddesignrules.h:75
BoundedUnsignedRatio mSolderPasteClearance
Definition: boarddesignrules.h:136
UnsignedLength mStopMaskMaxViaDrillDiameter
Definition: boarddesignrules.h:132
bool getPadCmpSideAutoAnnularRing() const noexcept
Definition: boarddesignrules.h:69
bool operator!=(const BoardDesignRules &rhs) const noexcept
Definition: boarddesignrules.h:123
const BoundedUnsignedRatio & getStopMaskClearance() const noexcept
Definition: boarddesignrules.h:59
bool operator==(const BoardDesignRules &rhs) const noexcept
Definition: boarddesignrules.cpp:155
void setPadCmpSideAutoAnnularRing(bool enabled) noexcept
Definition: boarddesignrules.h:94
void setStopMaskClearance(const BoundedUnsignedRatio &value) noexcept
Definition: boarddesignrules.h:88
BoundedUnsignedRatio mViaAnnularRing
Percentage of the drill diameter.
Definition: boarddesignrules.h:144
const BoundedUnsignedRatio & getSolderPasteClearance() const noexcept
Definition: boarddesignrules.h:64
~BoardDesignRules() noexcept
Definition: boarddesignrules.cpp:83
BoundedUnsignedRatio mPadAnnularRing
Definition: boarddesignrules.h:141
void restoreDefaults() noexcept
Definition: boarddesignrules.cpp:90
void setViaAnnularRing(const BoundedUnsignedRatio &value)
Definition: boarddesignrules.h:103
The Length class is used to represent a length (for example 12.75 millimeters)
Definition: length.h:82
static bool parsePadAutoAnnular(const SExpression &node)
Definition: boarddesignrules.cpp:176
void setStopMaskMaxViaDiameter(const UnsignedLength &dia) noexcept
Definition: boarddesignrules.h:85
void setPadInnerAutoAnnularRing(bool enabled) noexcept
Definition: boarddesignrules.h:97
The SExpression class.
Definition: sexpression.h:66
The BoundedUnsignedRatio class represents a ratio limited to a range specified by min/max values...
Definition: boundedunsignedratio.h:46
type_safe::constrained_type< Length, UnsignedLengthConstraint, UnsignedLengthVerifier > UnsignedLength
Definition: length.h:670
BoardDesignRules() noexcept
Definition: boarddesignrules.cpp:38