Skip to content

Commit

Permalink
Merge pull request #58 from lsst/tickets/DM-5879
Browse files Browse the repository at this point in the history
DM-5879 Remove use of Boost smart pointers throughout the Science Pipelines
  • Loading branch information
Pim Schellart authored and Pim Schellart committed May 4, 2016
2 parents 7ae35a2 + 2ab337f commit 515d520
Show file tree
Hide file tree
Showing 153 changed files with 425 additions and 430 deletions.
2 changes: 1 addition & 1 deletion examples/deltaFunctionKernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
*/

#include <iostream>
#include <memory>
#include <vector>

#include "boost/shared_ptr.hpp"
#include "boost/format.hpp"

#include "lsst/afw/math.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/fixedKernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <iostream>

#include "boost/shared_ptr.hpp"
#include <memory>
#include "boost/format.hpp"

#include "lsst/afw/image.h"
Expand Down
4 changes: 2 additions & 2 deletions examples/imageBackground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <iostream>
#include <cmath>
#include "boost/shared_ptr.hpp"
#include <memory>
#include "lsst/afw/image/Image.h"
#include "lsst/afw/math/Background.h"
#include "lsst/afw/math/Interpolate.h"
Expand Down Expand Up @@ -91,7 +91,7 @@ int main() {
PTR(math::Background) back = math::makeBackground(img, bgCtrl);

// can get an individual pixel or a whole frame.
float const MID = boost::dynamic_pointer_cast<math::BackgroundMI>(back)->getPixel(xcen, ycen);
float const MID = std::dynamic_pointer_cast<math::BackgroundMI>(back)->getPixel(xcen, ycen);
ImageF::Ptr bg = back->getImage<ImageF::Pixel>();

// create a background-subtracted image
Expand Down
8 changes: 4 additions & 4 deletions examples/imageStatistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
* see <http://www.lsstcorp.org/LegalNotices/>.
*/

#include <cmath>
#include <iostream>
#include <limits>
#include <cmath>
#include <memory>

#include "lsst/afw/image/Image.h"
#include "lsst/afw/image/MaskedImage.h"
#include "lsst/afw/math/Statistics.h"

#include "lsst/afw/math/MaskedVector.h"

#include "boost/shared_ptr.hpp"

namespace image = lsst::afw::image;
namespace math = lsst::afw::math;
namespace geom = lsst::afw::geom;
Expand Down Expand Up @@ -137,7 +137,7 @@ int main() {
++j;
}

boost::shared_ptr<std::vector<float> > vF = mv.getVector();
std::shared_ptr<std::vector<float> > vF = mv.getVector();

// make a statistics control object and override some of the default properties
math::StatisticsControl sctrl;
Expand Down
2 changes: 1 addition & 1 deletion examples/lanczosKernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <iostream>

#include "boost/shared_ptr.hpp"
#include <memory>
#include "boost/format.hpp"

#include "lsst/afw/math/FunctionLibrary.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/minimize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int main(int argc, char** argv) {
//
//
// const unsigned int polyorder = 0;
// boost::shared_ptr<lsst::afw::math::PolynomialFunction1<FuncReturn> > polyFuncPtr(
// std::shared_ptr<lsst::afw::math::PolynomialFunction1<FuncReturn> > polyFuncPtr(
// new lsst::afw::math::PolynomialFunction1<FuncReturn>(polyorder)
// );
//
Expand Down
2 changes: 1 addition & 1 deletion examples/rowColumnStats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ typedef image::Image<float> ImageF;
typedef image::ImageSlice<float> ImageSliceF;
typedef image::MaskedImage<float> MImageF;
typedef std::vector<float> VecF;
typedef boost::shared_ptr<VecF> VecFPtr;
typedef std::shared_ptr<VecF> VecFPtr;

int main(int argc, char **argv) {

Expand Down
2 changes: 1 addition & 1 deletion examples/simpleStacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace geom = lsst::afw::geom;
typedef image::Image<float> ImageF;
typedef image::MaskedImage<float> MImageF;
typedef std::vector<float> VecF;
typedef boost::shared_ptr<VecF> VecFPtr;
typedef std::shared_ptr<VecF> VecFPtr;

int main(int argc, char **argv) {

Expand Down
2 changes: 1 addition & 1 deletion examples/splineInterpolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <cmath>
#include <vector>

#include "boost/shared_ptr.hpp"
#include <memory>
#include "lsst/afw/math/Interpolate.h"

using namespace std;
Expand Down
4 changes: 2 additions & 2 deletions examples/testSpatialCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#if !defined(TESTSPATIALCELL_H)
#define TESTSPATIALCELL_H
#include "boost/shared_ptr.hpp"
#include <memory>
#include "lsst/pex/policy.h"
#include "lsst/afw/math.h"
#include "lsst/afw/geom.h"
Expand All @@ -34,7 +34,7 @@
*/
class ExampleCandidate : public lsst::afw::math::SpatialCellMaskedImageCandidate<float> {
public:
typedef boost::shared_ptr<ExampleCandidate> Ptr;
typedef std::shared_ptr<ExampleCandidate> Ptr;
typedef float PixelT;
typedef lsst::afw::image::MaskedImage<PixelT> MaskedImageT;

Expand Down
2 changes: 1 addition & 1 deletion examples/wcsTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <string>

#include "boost/format.hpp"
#include "boost/shared_ptr.hpp"
#include <memory>

#include "lsst/utils/Utils.h"
#include "lsst/pex/exceptions.h"
Expand Down
3 changes: 1 addition & 2 deletions include/lsst/afw/coord/Coord.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
#include <iostream>
#include <limits>
#include <map>

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

#include "lsst/base.h"
#include "lsst/afw/geom/Point.h"
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/detection/Footprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include <set>
#include <cmath>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include "ndarray.h"
#include "lsst/base.h"
#include "lsst/pex/policy/Policy.h"
Expand Down Expand Up @@ -64,8 +64,8 @@ class Footprint : public lsst::daf::base::Citizen,
public afw::table::io::Persistable
{
public:
typedef boost::shared_ptr<Footprint> Ptr;
typedef boost::shared_ptr<const Footprint> ConstPtr;
typedef std::shared_ptr<Footprint> Ptr;
typedef std::shared_ptr<const Footprint> ConstPtr;

/// The Footprint's Span list
typedef std::vector<Span::Ptr> SpanList;
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/afw/detection/FootprintSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class FootprintSet : public lsst::daf::base::Citizen {
HeavyFootprintCtrl const* ctrl=NULL
);
private:
boost::shared_ptr<FootprintList> _footprints; //!< the Footprints of detected objects
std::shared_ptr<FootprintList> _footprints; //!< the Footprints of detected objects
geom::Box2I _region; //!< The corners of the MaskedImage that the detections live in
};

Expand Down
4 changes: 2 additions & 2 deletions include/lsst/afw/detection/HeavyFootprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <list>
#include <cmath>
#include <boost/cstdint.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include "lsst/afw/detection/Footprint.h"

namespace lsst {
Expand Down Expand Up @@ -151,7 +151,7 @@ HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> makeHeavyFootprint(
* they overlap. The peak list is the union of the two inputs.
*/
template <typename ImagePixelT, typename MaskPixelT, typename VariancePixelT>
boost::shared_ptr<HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> >
std::shared_ptr<HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> >
mergeHeavyFootprints(
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> const& h1,
HeavyFootprint<ImagePixelT, MaskPixelT, VariancePixelT> const& h2
Expand Down
10 changes: 5 additions & 5 deletions include/lsst/afw/detection/Peak.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class PeakRecord : public afw::table::BaseRecord {
typedef afw::table::CatalogT<PeakRecord const> ConstCatalog;

CONST_PTR(PeakTable) getTable() const {
return boost::static_pointer_cast<PeakTable const>(afw::table::BaseRecord::getTable());
return std::static_pointer_cast<PeakTable const>(afw::table::BaseRecord::getTable());
}

//@{
Expand Down Expand Up @@ -149,22 +149,22 @@ class PeakTable : public afw::table::BaseTable {
//@}

/// @copydoc BaseTable::clone
PTR(PeakTable) clone() const { return boost::static_pointer_cast<PeakTable>(_clone()); }
PTR(PeakTable) clone() const { return std::static_pointer_cast<PeakTable>(_clone()); }

/// @copydoc BaseTable::makeRecord
PTR(PeakRecord) makeRecord() { return boost::static_pointer_cast<PeakRecord>(_makeRecord()); }
PTR(PeakRecord) makeRecord() { return std::static_pointer_cast<PeakRecord>(_makeRecord()); }

/// @copydoc BaseTable::copyRecord
PTR(PeakRecord) copyRecord(afw::table::BaseRecord const & other) {
return boost::static_pointer_cast<PeakRecord>(afw::table::BaseTable::copyRecord(other));
return std::static_pointer_cast<PeakRecord>(afw::table::BaseTable::copyRecord(other));
}

/// @copydoc BaseTable::copyRecord
PTR(PeakRecord) copyRecord(
afw::table::BaseRecord const & other,
afw::table::SchemaMapper const & mapper
) {
return boost::static_pointer_cast<PeakRecord>(afw::table::BaseTable::copyRecord(other, mapper));
return std::static_pointer_cast<PeakRecord>(afw::table::BaseTable::copyRecord(other, mapper));
}

protected:
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/detection/Psf.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <string>
#include <limits>

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

#include "lsst/daf/base.h"
#include "lsst/afw/geom/ellipses/Quadrupole.h"
Expand Down Expand Up @@ -72,8 +72,8 @@ class Psf : public daf::base::Citizen, public daf::base::Persistable,
return geom::Point2D(std::numeric_limits<double>::quiet_NaN());
}
public:
typedef boost::shared_ptr<Psf> Ptr; ///< @deprecated shared_ptr to a Psf
typedef boost::shared_ptr<const Psf> ConstPtr; ///< @deprecated shared_ptr to a const Psf
typedef std::shared_ptr<Psf> Ptr; ///< @deprecated shared_ptr to a Psf
typedef std::shared_ptr<const Psf> ConstPtr; ///< @deprecated shared_ptr to a const Psf

typedef math::Kernel::Pixel Pixel; ///< Pixel type of Image returned by computeImage
typedef image::Image<Pixel> Image; ///< Image type returned by computeImage
Expand Down
6 changes: 3 additions & 3 deletions include/lsst/afw/geom/AffineTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef LSST_AFW_MATH_AFFINE_TRANSFORM_H
#define LSST_AFW_MATH_AFFINE_TRANSFORM_H

#include <boost/shared_ptr.hpp>
#include <memory>
#include "Eigen/Core"
#include <iostream>
#include "lsst/afw/geom/Point.h"
Expand Down Expand Up @@ -76,8 +76,8 @@ namespace geom {
*/
class AffineTransform {
public:
typedef boost::shared_ptr<AffineTransform> Ptr;
typedef boost::shared_ptr<AffineTransform const> ConstPtr;
typedef std::shared_ptr<AffineTransform> Ptr;
typedef std::shared_ptr<AffineTransform const> ConstPtr;

enum Parameters {XX=0,YX=1,XY=2,YY=3,X=4,Y=5};

Expand Down
2 changes: 1 addition & 1 deletion include/lsst/afw/geom/Functor.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define LSST_AFW_GEOM_FUNCTOR_H

#include <string>
#include "boost/shared_ptr.hpp"
#include <memory>
#include "lsst/base.h"
#include "lsst/daf/base.h"

Expand Down
4 changes: 2 additions & 2 deletions include/lsst/afw/geom/Span.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ namespace geom {
class Span {
public:

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

/// An iterator over points in the Span.
typedef SpanPixelIterator Iterator;
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/afw/geom/TransformMapImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
#include <sstream>
#include <utility>
#include "boost/make_shared.hpp"
#include <memory>
#include "lsst/pex/exceptions.h"

namespace lsst {
Expand Down Expand Up @@ -58,7 +58,7 @@ TransformMap<CoordSysT>::TransformMap(
// insert identity transform for nativeCoordSys, if not already provided
if (!contains(nativeCoordSys)) {
_transforms.insert(std::make_pair(nativeCoordSys,
boost::make_shared<IdentityXYTransform>()));
std::make_shared<IdentityXYTransform>()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion include/lsst/afw/geom/XYTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define LSST_AFW_GEOM_XYTRANSFORM_H

#include <string>
#include "boost/shared_ptr.hpp"
#include <memory>
#include "lsst/pex/exceptions.h"
#include "lsst/daf/base.h"
#include "lsst/afw/geom/AffineTransform.h"
Expand Down
8 changes: 4 additions & 4 deletions include/lsst/afw/geom/ellipses/Axes.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ namespace lsst { namespace afw { namespace geom { namespace ellipses {
class Axes : public BaseCore {
public:

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

enum ParameterEnum { A=0, B=1, THETA=2 }; ///< Definitions for elements of a core vector.

Expand All @@ -60,7 +60,7 @@ class Axes : public BaseCore {
void setTheta(double theta) { _vector[THETA] = theta; }

/// @brief Deep copy the ellipse core.
Ptr clone() const { return boost::static_pointer_cast<Axes>(_clone()); }
Ptr clone() const { return std::static_pointer_cast<Axes>(_clone()); }

/// Return a string that identifies this parametrization.
virtual std::string getName() const;
Expand Down Expand Up @@ -108,7 +108,7 @@ class Axes : public BaseCore {
#endif
protected:

virtual BaseCore::Ptr _clone() const { return boost::make_shared<Axes>(*this); }
virtual BaseCore::Ptr _clone() const { return std::make_shared<Axes>(*this); }

virtual void _assignToQuadrupole(double & ixx, double & iyy, double & ixy) const;
virtual void _assignFromQuadrupole(double ixx, double iyy, double ixy);
Expand Down
11 changes: 5 additions & 6 deletions include/lsst/afw/geom/ellipses/BaseCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
* @note Do not include directly; use the main ellipse header file.
*/

#include "boost/shared_ptr.hpp"
#include "boost/make_shared.hpp"
#include <memory>

#include "Eigen/Core"

#include "lsst/pex/exceptions.h"
Expand All @@ -60,8 +59,8 @@ class BaseCore {
template <typename Output> struct Converter;
#endif

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

typedef Eigen::Vector3d ParameterVector; ///< Parameter vector type.
typedef Eigen::Matrix3d Jacobian; ///< Parameter Jacobian matrix type.
Expand Down Expand Up @@ -196,7 +195,7 @@ class BaseCore {

template <typename T>
struct Registrar {
Registrar() { registerSubclass(boost::make_shared<T>()); }
Registrar() { registerSubclass(std::make_shared<T>()); }
};

virtual BaseCore::Ptr _clone() const = 0;
Expand Down Expand Up @@ -244,7 +243,7 @@ struct BaseCore::Converter {
explicit Converter(BaseCore const & input_) : input(input_) {}

operator Output() const { return Output(input); }
boost::shared_ptr<Output> copy() const { return boost::shared_ptr<Output>(new Output(input)); }
std::shared_ptr<Output> copy() const { return std::shared_ptr<Output>(new Output(input)); }
};

template <typename Output>
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/afw/geom/ellipses/Ellipse.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class Ellipse {

typedef Eigen::Matrix<double,5,1> ParameterVector; ///< Parameter vector type.

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

enum ParameterEnum { X=3, Y=4 }; ///< Definitions for elements of an ellipse vector.

Expand Down

0 comments on commit 515d520

Please sign in to comment.