Skip to content

Commit

Permalink
Replace boost fixed width integer types with std equivalents
Browse files Browse the repository at this point in the history
  • Loading branch information
Pim Schellart authored and Pim Schellart committed May 31, 2016
1 parent 7bbcb36 commit 38cec12
Show file tree
Hide file tree
Showing 61 changed files with 313 additions and 252 deletions.
12 changes: 6 additions & 6 deletions include/lsst/afw/detection/Footprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <list>
#include <set>
#include <cmath>
#include <boost/cstdint.hpp>
#include <cstdint>
#include <memory>
#include "ndarray.h"
#include "lsst/base.h"
Expand Down Expand Up @@ -252,7 +252,7 @@ class Footprint : public lsst::daf::base::Citizen,
*/
template<typename PixelT>
void insertIntoImage(typename lsst::afw::image::Image<PixelT>& idImage,
boost::uint64_t const id,
std::uint64_t const id,
geom::Box2I const& region=geom::Box2I()
) const;

Expand All @@ -271,9 +271,9 @@ class Footprint : public lsst::daf::base::Citizen,
*/
template<typename PixelT>
void insertIntoImage(typename lsst::afw::image::Image<PixelT>& idImage,
boost::uint64_t const id,
std::uint64_t const id,
bool const overwriteId, long const idMask,
typename std::set<boost::uint64_t> *oldIds,
typename std::set<std::uint64_t> *oldIds,
geom::Box2I const& region=geom::Box2I()
) const;

Expand Down Expand Up @@ -381,8 +381,8 @@ class Footprint : public lsst::daf::base::Citizen,
footprint 0, and its distance is 2.
*/
void nearestFootprint(std::vector<PTR(Footprint)> const& foots,
lsst::afw::image::Image<boost::uint16_t>::Ptr argmin,
lsst::afw::image::Image<boost::uint16_t>::Ptr dist);
lsst::afw::image::Image<std::uint16_t>::Ptr argmin,
lsst::afw::image::Image<std::uint16_t>::Ptr dist);

/**
Merges two Footprints -- appends their peaks, and unions their
Expand Down
8 changes: 5 additions & 3 deletions include/lsst/afw/detection/FootprintSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* \file
* \brief Represent a collections of footprints associated with image data
*/
#include <cstdint>

#include "lsst/afw/geom.h"
#include "lsst/afw/detection/Threshold.h"
#include "lsst/afw/detection/Footprint.h"
Expand All @@ -43,7 +45,7 @@ namespace detection {
/// This is independent of the template parameters for FootprintSet, and
/// including it within FootprintSet makes it difficult for SWIG to interpret
/// the type.
typedef boost::uint64_t FootprintIdPixel;
typedef std::uint64_t FootprintIdPixel;

/************************************************************************************************************/
/*!
Expand Down Expand Up @@ -83,10 +85,10 @@ class FootprintSet : public lsst::daf::base::Citizen {
Threshold const& threshold,
int const npixMin=1);

FootprintSet(image::Image<boost::uint16_t> const& img,
FootprintSet(image::Image<std::uint16_t> const& img,
Threshold const& threshold,
int const npixMin=1, bool const setPeaks=true);
FootprintSet(image::MaskedImage<boost::uint16_t, image::MaskPixel> const& img,
FootprintSet(image::MaskedImage<std::uint16_t, image::MaskPixel> const& img,
Threshold const& threshold,
std::string const& planeName = "",
int const npixMin=1, bool const setPeaks=true);
Expand Down
1 change: 0 additions & 1 deletion include/lsst/afw/detection/HeavyFootprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <algorithm>
#include <list>
#include <cmath>
#include <boost/cstdint.hpp>
#include <memory>
#include "lsst/afw/detection/Footprint.h"

Expand Down
2 changes: 0 additions & 2 deletions include/lsst/afw/image/Exposure.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

#include <memory>

#include "boost/cstdint.hpp"

#include "lsst/base.h"
#include "lsst/daf/base.h"
#include "lsst/afw/image/MaskedImage.h"
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/afw/image/LsstImageTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#if !defined(LSST_AFW_LSST_IMAGE_TYPE_H)
#define LSST_AFW_LSST_IMAGE_TYPE_H 1

#include "boost/cstdint.hpp"
#include <cstdint>

namespace lsst { namespace afw { namespace image {
typedef boost::uint16_t MaskPixel; ///! default type for Masks and MaskedImage Masks
typedef std::uint16_t MaskPixel; ///! default type for Masks and MaskedImage Masks
typedef float VariancePixel; ///! default type for MaskedImage variance images
}}}
#endif
1 change: 0 additions & 1 deletion include/lsst/afw/image/Mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <map>
#include <string>

#include "boost/cstdint.hpp"
#include <memory>

#include "lsst/base.h"
Expand Down
8 changes: 5 additions & 3 deletions include/lsst/afw/image/lsstGil.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* Tell doxygen to (usually) ignore this file \cond GIL_IMAGE_INTERNALS
*/

#include <cstdint>

#if !defined(GIL_LSST_H)
#define GIL_LSST_H 1
/*
Expand Down Expand Up @@ -313,13 +315,13 @@ namespace lsst { namespace afw { namespace image { namespace detail {
struct unknown {}; // two unused and unimplemented types
struct unknown_u {};
/*
* Return long long type (as type) if it's a synonym for boost::int64_t
* Return long long type (as type) if it's a synonym for std::int64_t
* We also need unsigned long long (as type_u), because "unsigned unknown" won't compile
*/
struct CheckBoost64 {
typedef boost::mpl::if_<std::is_same<long long, boost::int64_t>,
typedef boost::mpl::if_<std::is_same<long long, std::int64_t>,
long long, struct unknown>::type type;
typedef boost::mpl::if_<std::is_same<long long, boost::int64_t>,
typedef boost::mpl::if_<std::is_same<long long, std::int64_t>,
unsigned long long, struct unknown_u>::type type_u;
};
}
Expand Down
4 changes: 3 additions & 1 deletion include/lsst/afw/table/BaseColumnView.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#ifndef AFW_TABLE_BaseColumnView_h_INCLUDED
#define AFW_TABLE_BaseColumnView_h_INCLUDED

#include <cstdint>

#include "lsst/afw/table/BaseTable.h"

namespace lsst { namespace afw { namespace table {
Expand Down Expand Up @@ -38,7 +40,7 @@ class BaseColumnView;
class BitsColumn {
public:

typedef boost::int64_t IntT;
typedef std::int64_t IntT;

ndarray::Array<IntT,1,1> getArray() const { return _array; }

Expand Down
4 changes: 3 additions & 1 deletion include/lsst/afw/table/Flag.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#ifndef LSST_AFW_TABLE_Flag_h_INCLUDED
#define LSST_AFW_TABLE_Flag_h_INCLUDED

#include <cstdint>

#include "lsst/afw/table/misc.h"
#include "lsst/afw/table/FieldBase.h"
#include "lsst/afw/table/KeyBase.h"
Expand All @@ -27,7 +29,7 @@ template <>
struct FieldBase<Flag> {

typedef bool Value; ///< @brief the type returned by BaseRecord::get
typedef boost::int64_t Element; ///< @brief the actual storage type (shared by multiple flag fields)
typedef std::int64_t Element; ///< @brief the actual storage type (shared by multiple flag fields)

/// @brief Return the number of subfield elements (always one for scalars).
int getElementCount() const { return 1; }
Expand Down
5 changes: 3 additions & 2 deletions include/lsst/afw/table/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
#ifndef AFW_TABLE_misc_h_INCLUDED
#define AFW_TABLE_misc_h_INCLUDED

#include "boost/cstdint.hpp"
#include <cstdint>

#include "boost/mpl/if.hpp"

#include "lsst/afw/geom/Angle.h"
Expand All @@ -16,7 +17,7 @@ namespace lsst { namespace afw { namespace table {
* FITS isn't fond of uint64, so we can save a lot of pain by using signed ints here unless
* we really need unsigned.
*/
typedef boost::int64_t RecordId;
typedef std::int64_t RecordId;

enum class CoordinateType {
PIXEL,
Expand Down
7 changes: 4 additions & 3 deletions include/lsst/afw/table/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#ifndef AFW_TABLE_types_h_INCLUDED
#define AFW_TABLE_types_h_INCLUDED

#include <cstdint>
#include <cstring>
#include <iostream>

Expand All @@ -28,21 +29,21 @@
// Scalar types: those that can serve as elements for other types, and use the default FieldBase template.
#define AFW_TABLE_SCALAR_FIELD_TYPE_N 6
#define AFW_TABLE_SCALAR_FIELD_TYPES \
RecordId, boost::uint16_t, boost::int32_t, float, double, Angle
RecordId, std::uint16_t, std::int32_t, float, double, Angle
#define AFW_TABLE_SCALAR_FIELD_TYPE_TUPLE BOOST_PP_LPAREN() AFW_TABLE_SCALAR_FIELD_TYPES BOOST_PP_RPAREN()

// Arrays types: the types we allow for Array fields.
#define AFW_TABLE_ARRAY_FIELD_TYPE_N 4
#define AFW_TABLE_ARRAY_FIELD_TYPES \
boost::uint16_t, int, float, double
std::uint16_t, int, float, double
#define AFW_TABLE_ARRAY_FIELD_TYPE_TUPLE BOOST_PP_LPAREN() AFW_TABLE_ARRAY_FIELD_TYPES BOOST_PP_RPAREN()

// Field types: all the types we allow for fields.
#define AFW_TABLE_FIELD_TYPE_N 12
#define AFW_TABLE_FIELD_TYPES \
AFW_TABLE_SCALAR_FIELD_TYPES, \
Flag, std::string, \
Array<boost::uint16_t>, Array<int>, Array<float>, Array<double>
Array<std::uint16_t>, Array<int>, Array<float>, Array<double>

#define AFW_TABLE_FIELD_TYPE_TUPLE BOOST_PP_LPAREN() AFW_TABLE_FIELD_TYPES BOOST_PP_RPAREN()

Expand Down
11 changes: 6 additions & 5 deletions python/lsst/afw/detection/footprints.i
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

%{
#include <cstdint>
#include <memory>
#include "lsst/afw/detection/Threshold.h"
#include "lsst/afw/detection/Footprint.h"
Expand Down Expand Up @@ -95,7 +96,7 @@ typedef lsst::afw::geom::Span Span;
%template(intersectMask) intersectMask<lsst::afw::image::MaskPixel>;
%footprintOperations(unsigned short)
%footprintOperations(int)
%footprintOperations(boost::uint64_t)
%footprintOperations(std::uint64_t)
}

%define %heavyFootprints(NAME, PIXEL_TYPE, MASK_TYPE, VAR_TYPE)
Expand Down Expand Up @@ -179,11 +180,11 @@ typedef lsst::afw::geom::Span Span;
%thresholdOperations(lsst::afw::image::MaskedImage);
%imageOperations(F, float);
%imageOperations(D, double);
%footprintImageOperations(boost::uint16_t);
%footprintImageOperations(std::uint16_t);
%footprintImageOperations(int);
%footprintImageOperations(boost::uint64_t);
%footprintImageOperations(std::uint64_t);
%maskOperations(lsst::afw::image::MaskPixel);
%template(FootprintFunctorMaskU) lsst::afw::detection::FootprintFunctor<lsst::afw::image::Mask<boost::uint16_t> >;
%template(FootprintFunctorMaskU) lsst::afw::detection::FootprintFunctor<lsst::afw::image::Mask<std::uint16_t> >;

// because stupid SWIG's %template doesn't work on these functions
%define %footprintArrayTemplates(T)
Expand Down Expand Up @@ -255,7 +256,7 @@ typedef lsst::afw::geom::Span Span;
%}
%enddef

%footprintArrayTemplates(boost::uint16_t);
%footprintArrayTemplates(std::uint16_t);
%footprintArrayTemplates(int);
%footprintArrayTemplates(float);
%footprintArrayTemplates(double);
Expand Down
4 changes: 3 additions & 1 deletion python/lsst/afw/detection/footprintset.i
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@


%{
#include <cstdint>

#include "lsst/afw/detection/FootprintSet.h"
#include "lsst/afw/table/Source.h"
%}
Expand All @@ -21,7 +23,7 @@
%enddef

%extend lsst::afw::detection::FootprintSet {
%footprintSetOperations(boost::uint16_t)
%footprintSetOperations(std::uint16_t)
%footprintSetOperations(int)
%footprintSetOperations(float)
%footprintSetOperations(double)
Expand Down
10 changes: 6 additions & 4 deletions python/lsst/afw/display/displayLib.i
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Basic routines to talk to ds9
%module(package="lsst.afw.display", docstring=displayLib_DOCSTRING) displayLib

%{
#include <cstdint>

# include "lsst/daf/base.h"
# include "lsst/daf/persistence.h"
# include "lsst/pex/policy.h"
Expand All @@ -52,17 +54,17 @@ Basic routines to talk to ds9

%include "simpleFits.h"

%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<boost::uint16_t> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<boost::uint64_t> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<std::uint16_t> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<std::uint64_t> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<int> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<float> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Image<double> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Mask<boost::uint16_t> >;
%template(writeFitsImage) lsst::afw::display::writeBasicFits<lsst::afw::image::Mask<std::uint16_t> >;

%include "Rgb.h"

%template(replaceSaturatedPixels)
lsst::afw::display::replaceSaturatedPixels<lsst::afw::image::MaskedImage<float> >;

%template(getZScale) lsst::afw::display::getZScale<boost::uint16_t>;
%template(getZScale) lsst::afw::display::getZScale<std::uint16_t>;
%template(getZScale) lsst::afw::display::getZScale<float>;
3 changes: 2 additions & 1 deletion python/lsst/afw/display/scaling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Calculate some scalings. Legacy code from NAOJ, which could probably be rewritten in python
* if the need arose. It could certainly use more LSST primitives (e.g. line fitting)
*/
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <cstdio>
Expand Down Expand Up @@ -242,6 +243,6 @@ getZScale(image::Image<T> const& image,
template std::pair<double, double> \
getZScale(image::Image<T> const& image, int const nSamples, double const contrast)

INSTANTIATE_GETZSCALE(boost::uint16_t);
INSTANTIATE_GETZSCALE(std::uint16_t);
INSTANTIATE_GETZSCALE(float);
}}}
7 changes: 4 additions & 3 deletions python/lsst/afw/display/simpleFits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace posix { // here so no-one includes them first ou
}
#endif //!DOXYGEN
using namespace posix;
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
Expand Down Expand Up @@ -513,13 +514,13 @@ void writeBasicFits(std::string const& filename, // file to writ
#define INSTANTIATE_IMAGE(T) INSTANTIATE(lsst::afw::image::Image<T>)
#define INSTANTIATE_MASK(T) INSTANTIATE(lsst::afw::image::Mask<T>)

INSTANTIATE_IMAGE(boost::uint16_t);
INSTANTIATE_IMAGE(std::uint16_t);
INSTANTIATE_IMAGE(int);
INSTANTIATE_IMAGE(float);
INSTANTIATE_IMAGE(double);
INSTANTIATE_IMAGE(boost::uint64_t);
INSTANTIATE_IMAGE(std::uint64_t);

INSTANTIATE_MASK(boost::uint16_t);
INSTANTIATE_MASK(std::uint16_t);
/// \endcond

}}}

0 comments on commit 38cec12

Please sign in to comment.