Skip to content

Commit

Permalink
Many small changes to make sure there is consistent use of vector siz…
Browse files Browse the repository at this point in the history
…e type (size_t) throughout the code. This removes nearly all compiler warnings under Visual C++. Code now compiles on Windows.
  • Loading branch information
tskisner committed Oct 25, 2019
1 parent 055c211 commit 5213881
Show file tree
Hide file tree
Showing 35 changed files with 2,115 additions and 2,025 deletions.
4 changes: 4 additions & 0 deletions src/libaatm/include/ATMAngle.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ class Angle
Angle operator*(int scf) { return Angle(valueIS_*(double)scf); } // rhs scale factor
/** Operator "multiplication of a angle by an unsigned int" */
Angle operator*(unsigned int scf) { return Angle(valueIS_*(double)scf); } // rhs scale factor
/** Operator "multiplication of a angle by an size_t" */
Angle operator*(size_t scf) { return Angle(valueIS_*(double)scf); } // rhs scale factor
/** Operator "division of a angle by a double" */
Angle operator/(double scf) { return Angle(valueIS_/scf); }
/** Operator "division of a angle by a float" */
Expand All @@ -84,6 +86,8 @@ class Angle
Angle operator/(int scf) { return Angle(valueIS_/(double)scf); }
/** Operator "division of a angle by an unsigned int" */
Angle operator/(unsigned int scf) { return Angle(valueIS_/(double)scf); }
/** Operator "division of a angle by an size_t" */
Angle operator/(size_t scf) { return Angle(valueIS_/(double)scf); }
/** Operator "comparator < for two angles" */
bool operator<(const Angle & rhs) const { return (valueIS_<rhs.get()); }
/** Operator "comparator > for two angles" */
Expand Down
4 changes: 2 additions & 2 deletions src/libaatm/include/ATMException.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#error "This is a C++ include file and cannot be used from plain C"
#endif

#include "ATMCommon.h"
#include "ATMCommon.h"
#include <exception>
#include <string>

Expand Down Expand Up @@ -221,6 +221,6 @@ ATM_NAMESPACE_END
* atm::AtmException(ATM_EXCEPTION_ARGS("An exception message..."));
* @endcode
*/
#define ATM_EXCEPTION_ARGS(msg) __FILE__, __PRETTY_FUNCTION__, __LINE__, msg
#define ATM_EXCEPTION_ARGS(msg) __FILE__, __FUNCTION__, __LINE__, msg

#endif /*!_ATM_EXCEPTIONS_H*/
5 changes: 4 additions & 1 deletion src/libaatm/include/ATMFrequency.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class Frequency
inline Frequency operator*(int scf) { return Frequency(valueIS_ * (double) scf); }
/** Operator "multiplication of a frequency by an unsigned int" */
inline Frequency operator*(unsigned int scf) { return Frequency(valueIS_ * (double) scf); }
/** Operator "multiplication of a frequency by an size_t" */
inline Frequency operator*(size_t scf) { return Frequency(valueIS_ * (double) scf); }
/** Operator "division of a frequency by a double" */
inline Frequency operator/(double scf) { return Frequency(valueIS_ / scf); }
/** Operator "division of a frequency by a float" */
Expand All @@ -91,6 +93,8 @@ class Frequency
inline Frequency operator/(int scf) { return Frequency(valueIS_ / (double) scf); }
/** Operator "division of a frequency by an unsigned int" */
inline Frequency operator/(unsigned int scf) { return Frequency(valueIS_ / (double) scf); }
/** Operator "division of a frequency by an size_t" */
inline Frequency operator/(size_t scf) { return Frequency(valueIS_ / (double) scf); }
/** Operator "comparator < for two frequencies" */
inline bool operator<(const Frequency &rhs) const {return (valueIS_ < rhs.get()); }
/** Operator "comparator > for two frequencies" */
Expand All @@ -115,4 +119,3 @@ class Frequency
ATM_NAMESPACE_END

#endif /*!_ATM_FREQUENCY_H*/

4 changes: 4 additions & 0 deletions src/libaatm/include/ATMInverseLength.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class InverseLength
inline InverseLength operator*(int scf) { return InverseLength(valueIS_ * (double) scf); }
/** Operator "multiplication of a inverse length by an unsigned int" */
inline InverseLength operator*(unsigned int scf) { return InverseLength(valueIS_ * (double) scf); }
/** Operator "multiplication of a inverse length by an size_t" */
inline InverseLength operator*(size_t scf) { return InverseLength(valueIS_ * (double) scf); }
/** Operator "division of a inverse length by a double" */
inline InverseLength operator/(double scf) { return InverseLength(valueIS_ / scf); }
/** Operator "division of a inverse length by a float" */
Expand All @@ -85,6 +87,8 @@ class InverseLength
inline InverseLength operator/(int scf) { return InverseLength(valueIS_ / (double) scf); }
/** Operator "division of a inverse length by an unsigned int" */
inline InverseLength operator/(unsigned int scf) { return InverseLength(valueIS_ / (double) scf); }
/** Operator "division of a inverse length by an size_t" */
inline InverseLength operator/(size_t scf) { return InverseLength(valueIS_ / (double) scf); }
/** Operator "comparator < for two inverse lengths" */
inline bool operator<(const InverseLength & rhs) const { return (valueIS_ < rhs.get()); }
/** Operator "comparator > for two inverse lengths" */
Expand Down
4 changes: 4 additions & 0 deletions src/libaatm/include/ATMLength.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class Length
inline Length operator*(int scf) { return Length(valueIS_ * (double) scf); }
/** Operator "multiplication of a length by an unsigned int" */
inline Length operator*(unsigned int scf) { return Length(valueIS_ * (double) scf); }
/** Operator "multiplication of a length by an size_t" */
inline Length operator*(size_t scf) { return Length(valueIS_ * (double) scf); }
/** Operator "division of a length by a double" */
inline Length operator/(double scf) { return Length(valueIS_ / scf); }
/** Operator "division of a length by a float" */
Expand All @@ -90,6 +92,8 @@ class Length
inline Length operator/(int scf) { return Length(valueIS_ / (double) scf); }
/** Operator "division of a length by an unsigned int" */
inline Length operator/(unsigned int scf) { return Length(valueIS_ / (double) scf); }
/** Operator "division of a length by an size_t" */
inline Length operator/(size_t scf) { return Length(valueIS_ / (double) scf); }
/** Operator "comparator < for two lengths" */
inline bool operator<(const Length &rhs) const { return (valueIS_ < rhs.get()); }
/** Operator "comparator > for two lengths" */
Expand Down
2 changes: 2 additions & 0 deletions src/libaatm/include/ATMMassDensity.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ class MassDensity
MassDensity operator*(float scf) { return MassDensity(valueIS_ * (double) scf); }
MassDensity operator*(int scf) { return MassDensity(valueIS_ * (double) scf); }
MassDensity operator*(unsigned int scf) { return MassDensity(valueIS_ * (double) scf); }
MassDensity operator*(size_t scf) { return MassDensity(valueIS_ * (double) scf); }
MassDensity operator/(double scf) { return MassDensity(valueIS_ / scf); }
MassDensity operator/(float scf) { return MassDensity(valueIS_ / (double) scf); }
MassDensity operator/(int scf) { return MassDensity(valueIS_ / (double) scf); }
MassDensity operator/(unsigned int scf) { return MassDensity(valueIS_ / (double) scf); }
MassDensity operator/(size_t scf) { return MassDensity(valueIS_ / (double) scf); }
bool operator<(const MassDensity & rhs) const { return (valueIS_ < rhs.get()); }
bool operator>(const MassDensity & rhs) const { return (valueIS_ > rhs.get()); }
bool operator<=(const MassDensity & rhs) const { return (valueIS_ <= rhs.get()); }
Expand Down
4 changes: 2 additions & 2 deletions src/libaatm/include/ATMNumberDensity.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,12 @@ class NumberDensity
NumberDensity operator*(float scf) { return NumberDensity(valueIS_ * (double) scf); }
NumberDensity operator*(int scf) { return NumberDensity(valueIS_ * (double) scf); }
NumberDensity operator*(unsigned int scf) { return NumberDensity(valueIS_ * (double) scf); }
NumberDensity operator*(size_t scf) { return NumberDensity(valueIS_ * (double) scf); }
NumberDensity operator/(double scf) { return NumberDensity(valueIS_ / scf); }
NumberDensity operator/(float scf) { return NumberDensity(valueIS_ / (double) scf); }
NumberDensity operator/(int scf) { return NumberDensity(valueIS_ / (double) scf); }
NumberDensity operator/(unsigned int scf) { return NumberDensity(valueIS_ / (double) scf); }
NumberDensity operator/(size_t scf) { return NumberDensity(valueIS_ / (double) scf); }
bool operator<(const NumberDensity &rhs) const { return (valueIS_ < rhs.get()); }
bool operator>(const NumberDensity &rhs) const { return (valueIS_ > rhs.get()); }
bool operator<=(const NumberDensity &rhs) const { return (valueIS_ <= rhs.get()); }
Expand All @@ -87,5 +89,3 @@ class NumberDensity
ATM_NAMESPACE_END

#endif /*!_ATM_NUMBERDENSITY_H*/


4 changes: 4 additions & 0 deletions src/libaatm/include/ATMOpacity.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class Opacity
inline Opacity operator*(int scf) { return Opacity(valueIS_ * (double) scf); }
/** Operator "multiplication of an opacity by an unsigned int" */
inline Opacity operator*(unsigned int scf) { return Opacity(valueIS_ * (double) scf); }
/** Operator "multiplication of an opacity by a size_t" */
inline Opacity operator*(size_t scf) { return Opacity(valueIS_ * (double) scf); }
/** Operator "division of a opacity by an int" */
inline Opacity operator/(double scf) { return Opacity(valueIS_ / scf); }
/** Operator "division of a opacity by a float" */
Expand All @@ -86,6 +88,8 @@ class Opacity
inline Opacity operator/(int scf) { return Opacity(valueIS_ / (double) scf); }
/** Operator "division of a opacity by an unsigned int" */
inline Opacity operator/(unsigned int scf) { return Opacity(valueIS_ / (double) scf); }
/** Operator "division of a opacity by a size_t" */
inline Opacity operator/(size_t scf) { return Opacity(valueIS_ / (double) scf); }
/** Operator "comparator < for two opacities" */
inline bool operator<(const Opacity &rhs) const { return (valueIS_ < rhs.get()); }
/** Operator "comparator > for two opacities" */
Expand Down
16 changes: 9 additions & 7 deletions src/libaatm/include/ATMPercent.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#define _ATM_PERCENT_H
/*******************************************************************************
* ALMA - Atacama Large Millimiter Array
* (c) Instituto de Estructura de la Materia, 2009
*
* (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
Expand Down Expand Up @@ -76,6 +76,8 @@ class Percent
inline Percent operator*(int scf) { return Percent(valueIS_ * (double) scf); }
/** Operator "multiplication of a percent by an unsigned int" */
inline Percent operator*(unsigned int scf) { return Percent(valueIS_ * (double) scf); }
/** Operator "multiplication of a percent by an size_t" */
inline Percent operator*(size_t scf) { return Percent(valueIS_ * (double) scf); }
/** Operator "division of a percent by a double" */
inline Percent operator/(double scf) { return Percent(valueIS_ / scf); }
/** Operator "division of a percent by a float" */
Expand All @@ -84,6 +86,8 @@ class Percent
inline Percent operator/(int scf) { return Percent(valueIS_ / (double) scf); }
/** Operator "division of a percent by an unsigned int" */
inline Percent operator/(unsigned int scf) { return Percent(valueIS_ / (double) scf); }
/** Operator "division of a percent by an size_t" */
inline Percent operator/(size_t scf) { return Percent(valueIS_ / (double) scf); }
/** Operator "comparator < for two percentages" */
inline bool operator<(const Percent &rhs) const { return (valueIS_ < rhs.get()); }
/** Operator "comparator > for two percentages" */
Expand All @@ -96,13 +100,11 @@ class Percent
inline bool operator==(const Percent &rhs) const { return (valueIS_ == rhs.get()); }
/** Operator "comparator != for two percentages" */
inline bool operator!=(const Percent &rhs) const { return (valueIS_ != rhs.get()); }

private:
double valueIS_;
}; // class Percent

ATM_NAMESPACE_END

#endif /*!_ATM_PERCENT_H*/


3 changes: 2 additions & 1 deletion src/libaatm/include/ATMPressure.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ class Pressure
Pressure operator*(float scf) { return Pressure(valueIS_ * (double) scf); }
Pressure operator*(int scf) { return Pressure(valueIS_ * (double) scf); }
Pressure operator*(unsigned int scf) { return Pressure(valueIS_ * (double) scf); }
Pressure operator*(size_t scf) { return Pressure(valueIS_ * (double) scf); }
Pressure operator/(double scf) { return Pressure(valueIS_ / scf); }
Pressure operator/(float scf) { return Pressure(valueIS_ / (double) scf); }
Pressure operator/(int scf) { return Pressure(valueIS_ / (double) scf); }
Pressure operator/(unsigned int scf) { return Pressure(valueIS_ / (double) scf); }
Pressure operator/(size_t scf) { return Pressure(valueIS_ / (double) scf); }
bool operator<(const Pressure &rhs) const { return (valueIS_ < rhs.get()); }
bool operator>(const Pressure &rhs) const { return (valueIS_ > rhs.get()); }
bool operator<=(const Pressure &rhs) const { return (valueIS_ <= rhs.get()); }
Expand All @@ -86,4 +88,3 @@ class Pressure
ATM_NAMESPACE_END

#endif /*!_ATM_PRESSURE_H*/

Loading

0 comments on commit 5213881

Please sign in to comment.