Source
inline Percent& operator=(const Percent &rhs) { if(&rhs != this) valueIS_ = rhs.valueIS_; return *this; }
/*******************************************************************************
* ALMA - Atacama Large Millimiter Array
* (c) Instituto de Estructura de la Materia, 2009
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* "@(#) $Id: ATMPercent.h Exp $"
*
* who when what
* -------- -------- ----------------------------------------------
* pardo 2009-03-24 created
*/
ATM_NAMESPACE_BEGIN
/*! \brief Defines a class for quantities that may be expressed in percent.
*
* This class is aimed at quantities that may be defined in percent. Default is proposed with no units
* (relative to one), and an alternative is considered for units in %.
*/
class Percent
{
public:
enum Units {
UnitPercent,
NumPercentUnits
};
/** Default constructor */
Percent();
/** A full constructor: Amount in default units (relative to 1) */
Percent(double percent);
/** A full constructor: Amount + units. Valid units are: % */
Percent(double percent, const std::string &units);
Percent(double percent, Units units);
~Percent();