From aa35045840b78d3f48212db45da59a2e5c69b223 Mon Sep 17 00:00:00 2001 From: saurabhb17 Date: Wed, 26 Feb 2020 15:57:49 +0530 Subject: Added main execs --- pcbnew/router/ranged_num.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pcbnew/router/ranged_num.h (limited to 'pcbnew/router/ranged_num.h') diff --git a/pcbnew/router/ranged_num.h b/pcbnew/router/ranged_num.h new file mode 100644 index 0000000..5eadaf6 --- /dev/null +++ b/pcbnew/router/ranged_num.h @@ -0,0 +1,52 @@ +/* + * KiRouter - a push-and-(sometimes-)shove PCB router + * + * Copyright (C) 2013-2015 CERN + * Author: Tomasz Wlostowski + * + * 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 3 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, see . + */ + +#ifndef __RANGED_NUM_H +#define __RANGED_NUM_H + +template class RANGED_NUM { + public: + RANGED_NUM( T aValue = 0, T aTolerancePlus = 0, T aToleranceMinus = 0 ) : + m_value( aValue ), + m_tolerancePlus( aTolerancePlus ), + m_toleranceMinus( aToleranceMinus ) + {} + + operator T() + { + return m_value; + } + + RANGED_NUM& operator=( const T aValue ) + { + m_value = aValue; + return *this; + } + + bool Matches( const T& aOther ) const + { + return ( aOther >= m_value - m_toleranceMinus && aOther <= m_value + m_tolerancePlus ); + } + + private: + T m_value, m_tolerancePlus, m_toleranceMinus; +}; + +#endif -- cgit