|
26 | 26 | #ifndef LSST_PARTITION_MAPREDUCE_H |
27 | 27 | #define LSST_PARTITION_MAPREDUCE_H |
28 | 28 |
|
29 | | -#include <sys/types.h> |
30 | | -#include <stdint.h> |
| 29 | +#include <algorithm> |
31 | 30 | #include <cstdlib> |
32 | 31 | #include <cstring> |
33 | | -#include <algorithm> |
| 32 | +#include <memory> |
| 33 | +#include <sys/types.h> |
34 | 34 | #include <stdexcept> |
| 35 | +#include <stdint.h> |
35 | 36 | #include <vector> |
36 | 37 |
|
37 | 38 | #include "boost/filesystem.hpp" |
38 | | -#include "boost/make_shared.hpp" |
39 | 39 | #include "boost/program_options.hpp" |
40 | 40 | #include "boost/ref.hpp" |
41 | 41 | #include "boost/scoped_array.hpp" |
42 | | -#include "boost/shared_ptr.hpp" |
43 | 42 | #include "boost/thread.hpp" |
44 | 43 |
|
45 | 44 | #include "partition/ConfigStore.h" |
@@ -271,7 +270,7 @@ void Silo<K>::_grow() { |
271 | 270 | /// After all input has been read, mapped and reduced, each worker |
272 | 271 | /// is asked for a result via: |
273 | 272 | /// |
274 | | -/// boost::shared_ptr<Result> const result(); |
| 273 | +/// std::shared_ptr<Result> const result(); |
275 | 274 | /// |
276 | 275 | /// The `Result` type must provide the following method: |
277 | 276 | /// |
@@ -305,7 +304,7 @@ namespace detail { |
305 | 304 | /// Comparator for shared pointers to `Silo`s. |
306 | 305 | template <typename K> |
307 | 306 | struct SiloPtrCmp { |
308 | | - bool operator()(boost::shared_ptr<Silo<K> > const &s, boost::shared_ptr<Silo<K> > const &t) const { |
| 307 | + bool operator()(std::shared_ptr<Silo<K> > const &s, std::shared_ptr<Silo<K> > const &t) const { |
309 | 308 | return *s < *t; |
310 | 309 | } |
311 | 310 | }; |
@@ -357,7 +356,7 @@ class JobBase { |
357 | 356 | typedef detail::SortedRecordRange<Key> SortedRecordRange; |
358 | 357 | typedef typename SortedRecordRange::RecordIter RecordIter; |
359 | 358 | typedef partition::Silo<Key> Silo; |
360 | | - typedef boost::shared_ptr<Silo> SiloPtr; |
| 359 | + typedef std::shared_ptr<Silo> SiloPtr; |
361 | 360 | typedef detail::SiloPtrCmp<Key> SiloPtrCmp; |
362 | 361 | typedef typename std::vector<SiloPtr>::const_iterator SiloPtrIter; |
363 | 362 |
|
@@ -440,7 +439,7 @@ void JobBase<DerivedT, WorkerT>::run(InputLines input) { |
440 | 439 | std::vector<SiloPtr> silos; |
441 | 440 | silos.reserve(_numWorkers); |
442 | 441 | for (uint32_t i = 0; i < _numWorkers; ++i) { |
443 | | - silos.push_back(boost::make_shared<Silo>()); |
| 442 | + silos.push_back(std::make_shared<Silo>()); |
444 | 443 | } |
445 | 444 | _silos.swap(silos); |
446 | 445 | _input = input; |
@@ -504,8 +503,8 @@ void JobBase<DerivedT, WorkerT>::defineOptions(boost::program_options::options_d |
504 | 503 | template <typename DerivedT, typename WorkerT> |
505 | 504 | void JobBase<DerivedT, WorkerT>::_work() { |
506 | 505 | // Pre-allocate disk read buffer. |
507 | | - boost::shared_ptr<char> buffer(static_cast<char *>(std::malloc(_input.getMinimumBufferCapacity())), |
508 | | - std::free); |
| 506 | + std::shared_ptr<char> buffer(static_cast<char *>(std::malloc(_input.getMinimumBufferCapacity())), |
| 507 | + std::free); |
509 | 508 | if (!buffer) { |
510 | 509 | throw std::bad_alloc(); |
511 | 510 | } |
@@ -652,30 +651,30 @@ class JobImpl : private JobBase<JobImpl<WorkerT, ResultT>, WorkerT> { |
652 | 651 | typedef JobBase<JobImpl<WorkerT, ResultT>, WorkerT> Base; |
653 | 652 |
|
654 | 653 | void _storeResult(WorkerT &w) { |
655 | | - boost::shared_ptr<ResultT> r = w.result(); |
| 654 | + std::shared_ptr<ResultT> r = w.result(); |
656 | 655 | if (!_result) { |
657 | 656 | _result = r; |
658 | 657 | } else if (r) { |
659 | 658 | _result->merge(*r); |
660 | 659 | } |
661 | 660 | } |
662 | 661 |
|
663 | | - boost::shared_ptr<ResultT> _result; |
| 662 | + std::shared_ptr<ResultT> _result; |
664 | 663 |
|
665 | 664 | // Allow JobBase to call _storeResult. |
666 | 665 | friend class JobBase<JobImpl<WorkerT, ResultT>, WorkerT>; |
667 | 666 |
|
668 | 667 | public: |
669 | 668 | explicit JobImpl(ConfigStore const &config) : Base(config) {} |
670 | 669 |
|
671 | | - boost::shared_ptr<ResultT> const run(InputLines input) { |
| 670 | + std::shared_ptr<ResultT> const run(InputLines input) { |
672 | 671 | try { |
673 | 672 | Base::run(input); |
674 | 673 | } catch (...) { |
675 | 674 | _result.reset(); |
676 | 675 | throw; |
677 | 676 | } |
678 | | - boost::shared_ptr<ResultT> r; |
| 677 | + std::shared_ptr<ResultT> r; |
679 | 678 | r.swap(_result); |
680 | 679 | return r; |
681 | 680 | } |
@@ -711,7 +710,7 @@ class JobImpl<WorkerT, void> : private JobBase<JobImpl<WorkerT, void>, WorkerT> |
711 | 710 | /// |
712 | 711 | /// Otherwise, it is: |
713 | 712 | /// |
714 | | -/// boost::shared_ptr<typename WorkerT::Result> const run(InputLines input); |
| 713 | +/// std::shared_ptr<typename WorkerT::Result> const run(InputLines input); |
715 | 714 | /// |
716 | 715 | /// Multiple calls to `run` with different inputs are perfectly legal, and `run` |
717 | 716 | /// provides the strong exception safety guarantee, at least as far as in-memory |
|
0 commit comments