Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-5879 Remove use of Boost smart pointers throughout the Science Pipelines #25

Merged
merged 3 commits into from
May 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/lsst/meas/algorithms/BinnedWcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef LSST_MEAS_ALGORITHMS_BINNEDWCS_H
#define LSST_MEAS_ALGORITHMS_BINNEDWCS_H

#include <boost/enable_shared_from_this.hpp>
#include <memory>

#include "lsst/pex/exceptions.h"
#include "lsst/afw/image/Wcs.h"
Expand All @@ -38,7 +38,7 @@ namespace lsst { namespace meas { namespace algorithms {
LSST_EXCEPTION_TYPE(NotImplementedException, lsst::pex::exceptions::RuntimeError,
lsst::meas::algorithms::NotImplementedException);

class BinnedWcs : public afw::image::Wcs, public boost::enable_shared_from_this<BinnedWcs> {
class BinnedWcs : public afw::image::Wcs, public std::enable_shared_from_this<BinnedWcs> {
public:
BinnedWcs(PTR(afw::image::Wcs) parent, unsigned int xBin, unsigned int yBin, afw::geom::Point2I xy0);
virtual ~BinnedWcs() {}
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/meas/algorithms/CR.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace meas {
namespace algorithms {

template <typename MaskedImageT>
std::vector<boost::shared_ptr<lsst::afw::detection::Footprint> >
std::vector<std::shared_ptr<lsst::afw::detection::Footprint> >
findCosmicRays(MaskedImageT& image,
lsst::afw::detection::Psf const &psf,
double const bkgd,
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/meas/algorithms/CoaddPsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#if !defined(LSST_MEAS_ALGORITHMS_COADDPSF_H)
#define LSST_MEAS_ALGORITHMS_COADDPSF_H

#include <boost/make_shared.hpp>
#include <memory>
#include "lsst/base.h"
#include "lsst/meas/algorithms/ImagePsf.h"
#include "lsst/afw/image/Wcs.h"
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/meas/algorithms/ExposurePatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ PTR(ExposurePatch<ExposureT>) makeExposurePatch(
CONST_PTR(afw::detection::Footprint) foot,
afw::geom::Point2D const& center
) {
return boost::make_shared<ExposurePatch<ExposureT> >(exp, foot, center);
return std::make_shared<ExposurePatch<ExposureT> >(exp, foot, center);
}
template<typename ExposureT>
PTR(ExposurePatch<ExposureT>) makeExposurePatch(
Expand All @@ -97,7 +97,7 @@ PTR(ExposurePatch<ExposureT>) makeExposurePatch(
afw::geom::Point2D const& standardCenter,
afw::image::Wcs const& standardWcs
) {
return boost::make_shared<ExposurePatch<ExposureT> >(exp, standardFoot, standardCenter, standardWcs);
return std::make_shared<ExposurePatch<ExposureT> >(exp, standardFoot, standardCenter, standardWcs);
}

}}} // namespace
Expand Down
3 changes: 1 addition & 2 deletions include/lsst/meas/algorithms/ImagePca.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
*
* @ingroup algorithms
*/
#include <memory>
#include <utility>
#include <vector>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove blank line

#include "boost/shared_ptr.hpp"

#include "lsst/afw.h"

namespace lsst {
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/meas/algorithms/Interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace interp {
*/
class Defect : public lsst::afw::image::DefectBase {
public:
typedef boost::shared_ptr<Defect> Ptr; //!< shared pointer to Defect
typedef std::shared_ptr<Defect> Ptr; //!< shared pointer to Defect

enum DefectPosition {
LEFT = 1, //!< defect is at left boundary
Expand Down
11 changes: 5 additions & 6 deletions include/lsst/meas/algorithms/PsfCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@
*
* @ingroup algorithms
*/
#include <memory>
#include <vector>

#include "boost/make_shared.hpp"

#include "lsst/pex/policy.h"

#include "lsst/afw/image/Exposure.h"
Expand Down Expand Up @@ -62,8 +61,8 @@ namespace algorithms {
using lsst::afw::math::SpatialCellMaskedImageCandidate<PixelT>::getWidth;
using lsst::afw::math::SpatialCellMaskedImageCandidate<PixelT>::getHeight;

typedef boost::shared_ptr<PsfCandidate<PixelT> > Ptr;
typedef boost::shared_ptr<const PsfCandidate<PixelT> > ConstPtr;
typedef std::shared_ptr<PsfCandidate<PixelT> > Ptr;
typedef std::shared_ptr<const PsfCandidate<PixelT> > ConstPtr;
typedef std::vector<Ptr > PtrList;

typedef lsst::afw::image::MaskedImage<PixelT> MaskedImageT;
Expand Down Expand Up @@ -184,12 +183,12 @@ namespace algorithms {
* Cf. std::make_pair
*/
template <typename PixelT>
boost::shared_ptr<PsfCandidate<PixelT> >
std::shared_ptr<PsfCandidate<PixelT> >
makePsfCandidate(PTR(afw::table::SourceRecord) const& source, ///< The detected Source
PTR(afw::image::Exposure<PixelT>) image ///< The image wherein lies the object
)
{
return boost::make_shared< PsfCandidate<PixelT> >(source, image);
return std::make_shared< PsfCandidate<PixelT> >(source, image);
}

}}}
Expand Down
8 changes: 4 additions & 4 deletions include/lsst/meas/algorithms/Shapelet.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* @author Mike Jarvis
*/
#include <complex>
#include <memory>

#include "boost/shared_ptr.hpp"
#include "Eigen/Core"

#include "lsst/afw/table/Source.h"
Expand Down Expand Up @@ -91,8 +91,8 @@ namespace algorithms {

public:
typedef float PixelT;
typedef boost::shared_ptr<Shapelet> Ptr;
typedef boost::shared_ptr<const Shapelet> ConstPtr;
typedef std::shared_ptr<Shapelet> Ptr;
typedef std::shared_ptr<const Shapelet> ConstPtr;

typedef Eigen::VectorXd ShapeletVector;
typedef Eigen::MatrixXd ShapeletCovariance;
Expand Down Expand Up @@ -204,7 +204,7 @@ namespace algorithms {
/*!
* @brief get the covariance matrix
*/
boost::shared_ptr<const ShapeletCovariance> getCovariance() const;
std::shared_ptr<const ShapeletCovariance> getCovariance() const;

/*!
* @brief set a new value of sigma
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/meas/algorithms/ShapeletInterpolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
* @author Mike Jarvis
*/
#include <complex>
#include <memory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shift up one line


#include "boost/shared_ptr.hpp"
#include "Eigen/Core"

#include "lsst/pex/policy/Policy.h"
Expand Down Expand Up @@ -69,8 +69,8 @@ namespace algorithms {
*/
public:

typedef boost::shared_ptr<ShapeletInterpolation> Ptr;
typedef boost::shared_ptr<const ShapeletInterpolation> ConstPtr;
typedef std::shared_ptr<ShapeletInterpolation> Ptr;
typedef std::shared_ptr<const ShapeletInterpolation> ConstPtr;

typedef float PixelT;
typedef lsst::pex::policy::Policy Policy;
Expand Down
10 changes: 5 additions & 5 deletions include/lsst/meas/algorithms/ShapeletKernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*
* @author Mike Jarvis
*/
#include "boost/shared_ptr.hpp"
#include <memory>

#include "lsst/afw/math/Kernel.h"
#include "lsst/afw/image/Image.h"
Expand Down Expand Up @@ -87,8 +87,8 @@ namespace algorithms {
*/

public :
typedef boost::shared_ptr<LocalShapeletKernel> Ptr;
typedef boost::shared_ptr<const LocalShapeletKernel> ConstPtr;
typedef std::shared_ptr<LocalShapeletKernel> Ptr;
typedef std::shared_ptr<const LocalShapeletKernel> ConstPtr;

typedef lsst::afw::math::AnalyticKernel base;
typedef lsst::afw::geom::Point2D Point;
Expand Down Expand Up @@ -166,8 +166,8 @@ namespace algorithms {
* rather than one component at a time.
*/
public :
typedef boost::shared_ptr<ShapeletKernel> Ptr;
typedef boost::shared_ptr<const ShapeletKernel> ConstPtr;
typedef std::shared_ptr<ShapeletKernel> Ptr;
typedef std::shared_ptr<const ShapeletKernel> ConstPtr;

typedef lsst::afw::math::AnalyticKernel base;
typedef lsst::afw::geom::Point2D Point;
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/meas/algorithms/ShapeletPsfCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include "lsst/afw/math/SpatialCell.h"
#include "lsst/afw/table/Source.h"
#include "boost/shared_ptr.hpp"
#include <memory>

namespace lsst {
namespace meas {
Expand All @@ -46,8 +46,8 @@ namespace algorithms {
typedef lsst::afw::math::SpatialCellCandidate base;
typedef lsst::afw::table::SourceRecord Source;

typedef boost::shared_ptr<ShapeletPsfCandidate> Ptr;
typedef boost::shared_ptr<const ShapeletPsfCandidate> ConstPtr;
typedef std::shared_ptr<ShapeletPsfCandidate> Ptr;
typedef std::shared_ptr<const ShapeletPsfCandidate> ConstPtr;

/*!
* @brief Constructor takes position, size, and original source
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/meas/algorithms/SizeMagnitudeStarSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* @author Mike Jarvis
*/
#include "boost/shared_ptr.hpp"
#include <memory>

#include "lsst/afw/table/Source.h"
#include "lsst/afw/table/Match.h" // because we can't forward-declare a typedef
Expand Down Expand Up @@ -123,7 +123,7 @@ namespace algorithms {
SizeMagnitudeStarSelector(const SizeMagnitudeStarSelector& rhs);
void operator=(const SizeMagnitudeStarSelector& rhs);

boost::shared_ptr<SizeMagnitudeStarSelectorImpl> pImpl;
std::shared_ptr<SizeMagnitudeStarSelectorImpl> pImpl;
};

}}}
Expand Down
3 changes: 1 addition & 2 deletions include/lsst/meas/algorithms/SpatialModelPsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
*
* @ingroup algorithms
*/
#include <memory>
#include <utility>
#include <vector>

#include "boost/shared_ptr.hpp"

#include "lsst/afw.h"
#include "lsst/pex/policy.h"
#include "lsst/afw/detection/Psf.h"
Expand Down
8 changes: 4 additions & 4 deletions include/lsst/meas/algorithms/shapelet/Pixel.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifdef __INTEL_COMPILER
#pragma warning (disable : 1418)
#endif
#include "boost/shared_ptr.hpp"
#include <memory>
#ifdef __INTEL_COMPILER
#pragma warning (default : 1418)
#endif
Expand Down Expand Up @@ -95,12 +95,12 @@ namespace shapelet {
private :

bool _shouldUsePool;
boost::shared_ptr<std::vector<Pixel> > _v1;
std::shared_ptr<std::vector<Pixel> > _v1;
#ifdef PIXELLIST_USE_POOL
typedef PoolAllocator<Pixel,PIXELLIST_BLOCK> PoolAllocPixel;
boost::shared_ptr<std::vector<Pixel,PoolAllocPixel> > _v2;
std::shared_ptr<std::vector<Pixel,PoolAllocPixel> > _v2;
#else
boost::shared_ptr<std::vector<Pixel> > _v2;
std::shared_ptr<std::vector<Pixel> > _v2;
#endif

};
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/meas/algorithms/algorithmsLib.i
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Python bindings for meas/algorithms module
# include <list>
# include <map>
# include <boost/cstdint.hpp>
# include <boost/shared_ptr.hpp>
# include <memory>
# include "lsst/pex/logging.h"
# include "lsst/pex/logging/BlockTimingLog.h"
# include "lsst/pex/logging/DualLog.h"
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/meas/algorithms/psf.i
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lsst::afw::image::MaskedImage<PIXTYPE, lsst::afw::image::MaskPixel, lsst::afw::i
%inline %{
PTR(lsst::meas::algorithms::PsfCandidate<TYPE>)
cast_PsfCandidate##NAME(PTR(lsst::afw::math::SpatialCellCandidate) candidate) {
return boost::dynamic_pointer_cast<lsst::meas::algorithms::PsfCandidate<TYPE> >(candidate);
return std::dynamic_pointer_cast<lsst::meas::algorithms::PsfCandidate<TYPE> >(candidate);
}
%}
//----------------------------------------------------------------------------
Expand Down Expand Up @@ -91,7 +91,7 @@ lsst::afw::image::MaskedImage<PIXTYPE, lsst::afw::image::MaskPixel, lsst::afw::i
%template(fitKernelToImage) lsst::meas::algorithms::fitKernelToImage<%MASKEDIMAGE(float)>;

%{
#include "boost/shared_ptr.hpp"
#include <memory>
#include "lsst/meas/algorithms/SingleGaussianPsf.h"
#include "lsst/meas/algorithms/PcaPsf.h"
%}
Expand Down
6 changes: 3 additions & 3 deletions src/CR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ namespace detection {
*/
class IdSpan {
public:
typedef boost::shared_ptr<IdSpan> Ptr;
typedef boost::shared_ptr<const IdSpan> ConstPtr;
typedef std::shared_ptr<IdSpan> Ptr;
typedef std::shared_ptr<const IdSpan> ConstPtr;

explicit IdSpan(int id, int y, int x0, int x1) : id(id), y(y), x0(x0), x1(x1) {}
int id; /* ID for object */
Expand Down Expand Up @@ -138,7 +138,7 @@ bool condition_3(ImageT *estimate, double const peak,
// A class to hold a detected pixel
template<typename ImageT>
struct CRPixel {
typedef typename boost::shared_ptr<CRPixel> Ptr;
typedef typename std::shared_ptr<CRPixel> Ptr;

CRPixel(int _col, int _row, ImageT _val, int _id = -1) :
id(_id), col(_col), row(_row), val(_val) {
Expand Down
2 changes: 1 addition & 1 deletion src/CoaddBoundedField.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class CoaddBoundedField::Factory : public tbl::io::PersistableFactory {
)
);
}
return boost::make_shared<CoaddBoundedField>(
return std::make_shared<CoaddBoundedField>(
afw::geom::Box2I(record1.get(keys1.bboxMin), record1.get(keys1.bboxMax)),
archive.get<afw::image::Wcs>(record1.get(keys1.coaddWcs)),
elements,
Expand Down
6 changes: 3 additions & 3 deletions src/CoaddPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ CoaddPsf::CoaddPsf(
) :
_coaddWcs(coaddWcs.clone()),
_warpingKernelName(warpingKernelName),
_warpingControl(boost::make_shared<afw::math::WarpingControl>(warpingKernelName, "", cacheSize))
_warpingControl(std::make_shared<afw::math::WarpingControl>(warpingKernelName, "", cacheSize))
{
afw::table::SchemaMapper mapper(catalog.getSchema());
mapper.addMinimalSchema(afw::table::ExposureTable::makeMinimalSchema(), true);
Expand All @@ -174,7 +174,7 @@ CoaddPsf::CoaddPsf(
}

PTR(afw::detection::Psf) CoaddPsf::clone() const {
return boost::make_shared<CoaddPsf>(*this);
return std::make_shared<CoaddPsf>(*this);
}


Expand Down Expand Up @@ -256,7 +256,7 @@ PTR(afw::detection::Psf::Image) CoaddPsf::doComputeKernelImage(
afw::geom::Box2I bbox = getOverallBBox(imgVector);

// create a zero image of the right size to sum into
PTR(afw::detection::Psf::Image) image = boost::make_shared<afw::detection::Psf::Image>(bbox);
PTR(afw::detection::Psf::Image) image = std::make_shared<afw::detection::Psf::Image>(bbox);
*image = 0.0;
addToImage(image, imgVector, weightVector);
*image /= weightSum;
Expand Down
4 changes: 2 additions & 2 deletions src/DoubleGaussianPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class DoubleGaussianPsfFactory : public afw::table::io::PersistableFactory {
LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
afw::table::BaseRecord const & record = catalogs.front().front();
LSST_ARCHIVE_ASSERT(record.getSchema() == keys.schema);
return boost::make_shared<DoubleGaussianPsf>(
return std::make_shared<DoubleGaussianPsf>(
record.get(keys.dimensions.getX()),
record.get(keys.dimensions.getY()),
record.get(keys.sigma1),
Expand Down Expand Up @@ -118,7 +118,7 @@ DoubleGaussianPsf::DoubleGaussianPsf(int width, int height, double sigma1, doubl
{}

PTR(afw::detection::Psf) DoubleGaussianPsf::clone() const {
return boost::make_shared<DoubleGaussianPsf>(
return std::make_shared<DoubleGaussianPsf>(
getKernel()->getWidth(),
getKernel()->getHeight(),
_sigma1, _sigma2, _b
Expand Down
4 changes: 2 additions & 2 deletions src/KernelPsf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace lsst { namespace meas { namespace algorithms {
PTR(afw::detection::Psf::Image) KernelPsf::doComputeKernelImage(
afw::geom::Point2D const & position, afw::image::Color const& color
) const {
PTR(Psf::Image) im = boost::make_shared<Psf::Image>(_kernel->getDimensions());
PTR(Psf::Image) im = std::make_shared<Psf::Image>(_kernel->getDimensions());
_kernel->computeImage(*im, true, position.getX(), position.getY());
return im;
}
Expand All @@ -19,7 +19,7 @@ KernelPsf::KernelPsf(afw::math::Kernel const & kernel, afw::geom::Point2D const
KernelPsf::KernelPsf(PTR(afw::math::Kernel) kernel, afw::geom::Point2D const & averagePosition) :
ImagePsf(!kernel->isSpatiallyVarying()), _kernel(kernel), _averagePosition(averagePosition) {}

PTR(afw::detection::Psf) KernelPsf::clone() const { return boost::make_shared<KernelPsf>(*this); }
PTR(afw::detection::Psf) KernelPsf::clone() const { return std::make_shared<KernelPsf>(*this); }

afw::geom::Point2D KernelPsf::getAveragePosition() const { return _averagePosition; }

Expand Down