KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ranged_num.h
Go to the documentation of this file.
1
/*
2
* KiRouter - a push-and-(sometimes-)shove PCB router
3
*
4
* Copyright (C) 2013-2015 CERN
5
* Author: Tomasz Wlostowski <
[email protected]
>
6
*
7
* This program is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation, either version 3 of the License, or (at your
10
* option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License along
18
* with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#ifndef __RANGED_NUM_H
22
#define __RANGED_NUM_H
23
24
template
<
class
T>
class
RANGED_NUM
{
25
public
:
26
RANGED_NUM
( T aValue = 0, T aTolerancePlus = 0, T aToleranceMinus = 0 ) :
27
m_value
( aValue ),
28
m_tolerancePlus
( aTolerancePlus ),
29
m_toleranceMinus
( aToleranceMinus )
30
{}
31
32
operator
T()
33
{
34
return
m_value
;
35
}
36
37
RANGED_NUM
&
operator=
(
const
T aValue )
38
{
39
m_value
= aValue;
40
return
*
this
;
41
}
42
43
bool
Matches
(
const
T& aOther )
const
44
{
45
return
( aOther >=
m_value
-
m_toleranceMinus
&& aOther <=
m_value
+
m_tolerancePlus
);
46
}
47
48
private
:
49
T
m_value
,
m_tolerancePlus
,
m_toleranceMinus
;
50
};
51
52
#endif
RANGED_NUM
Definition:
ranged_num.h:24
RANGED_NUM::m_toleranceMinus
T m_toleranceMinus
Definition:
ranged_num.h:49
RANGED_NUM::m_value
T m_value
Definition:
ranged_num.h:49
RANGED_NUM::m_tolerancePlus
T m_tolerancePlus
Definition:
ranged_num.h:49
RANGED_NUM::RANGED_NUM
RANGED_NUM(T aValue=0, T aTolerancePlus=0, T aToleranceMinus=0)
Definition:
ranged_num.h:26
RANGED_NUM::Matches
bool Matches(const T &aOther) const
Definition:
ranged_num.h:43
RANGED_NUM::operator=
RANGED_NUM & operator=(const T aValue)
Definition:
ranged_num.h:37
src
pcbnew
router
ranged_num.h
Generated on Thu Nov 21 2024 00:06:49 for KiCad PCB EDA Suite by
1.9.6