[all] Switch from boost::shared_ptr -> std::shared_ptr.

Shared_ptr has moved into the standard library since these tools were
first written.
This commit is contained in:
Joe Thornber 2020-04-30 15:02:43 +01:00
parent e801cc607b
commit 4313469475
40 changed files with 78 additions and 94 deletions

View File

@ -1,9 +1,9 @@
#ifndef BASE_APPLICATION_H
#define BASE_APPLICATION_H
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <list>
#include <memory>
#include <string>
#include <stdexcept>
#include <stdint.h>
@ -13,7 +13,7 @@
namespace base {
class command {
public:
typedef boost::shared_ptr<command> ptr;
typedef std::shared_ptr<command> ptr;
command(std::string const &name);
virtual ~command() {}

View File

@ -1,7 +1,6 @@
#ifndef BASE_PROGRESS_MONITOR_H
#define BASE_PROGRESS_MONITOR_H
#include <boost/shared_ptr.hpp>
#include <memory>
#include <string>

View File

@ -8,7 +8,6 @@
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/set.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <functional>
#include <iostream>
#include <libaio.h>
@ -29,7 +28,7 @@ namespace bcache {
class validator {
public:
typedef boost::shared_ptr<validator> ptr;
typedef std::shared_ptr<validator> ptr;
virtual ~validator() {}

View File

@ -125,7 +125,7 @@ namespace cache {
typedef block_manager<>::read_ref read_ref;
typedef block_manager<>::write_ref write_ref;
typedef boost::shared_ptr<metadata> ptr;
typedef std::shared_ptr<metadata> ptr;
tm_ptr tm_;
superblock sb_;

View File

@ -3,7 +3,6 @@
#include "persistent-data/block.h"
#include <boost/shared_ptr.hpp>
#include <vector>
//----------------------------------------------------------------
@ -13,7 +12,7 @@ namespace caching {
class emitter {
public:
typedef boost::shared_ptr<emitter> ptr;
typedef std::shared_ptr<emitter> ptr;
virtual ~emitter() {}

View File

@ -38,16 +38,16 @@ namespace {
xx(4);
template <uint32_t WIDTH>
boost::shared_ptr<array_base> mk_array(transaction_manager &tm) {
std::shared_ptr<array_base> mk_array(transaction_manager &tm) {
typedef hint_traits<WIDTH> traits;
typedef persistent_data::array<traits> ha;
boost::shared_ptr<array_base> r = typename ha::ptr(new ha(tm, typename traits::ref_counter()));
std::shared_ptr<array_base> r = typename ha::ptr(new ha(tm, typename traits::ref_counter()));
return r;
}
boost::shared_ptr<array_base> mk_array(transaction_manager &tm, uint32_t width) {
std::shared_ptr<array_base> mk_array(transaction_manager &tm, uint32_t width) {
switch (width) {
#define xx(n) case n: return mk_array<n>(tm)
@ -58,15 +58,15 @@ namespace {
}
// never get here
return boost::shared_ptr<array_base>();
return std::shared_ptr<array_base>();
}
//--------------------------------
template <typename HA>
boost::shared_ptr<HA>
downcast_array(boost::shared_ptr<array_base> base) {
boost::shared_ptr<HA> a = dynamic_pointer_cast<HA>(base);
std::shared_ptr<HA>
downcast_array(std::shared_ptr<array_base> base) {
std::shared_ptr<HA> a = dynamic_pointer_cast<HA>(base);
if (!a)
throw runtime_error("internal error: couldn't cast hint array");
@ -76,16 +76,16 @@ namespace {
//--------------------------------
template <uint32_t WIDTH>
boost::shared_ptr<array_base> mk_array(transaction_manager &tm, block_address root, unsigned nr_entries) {
std::shared_ptr<array_base> mk_array(transaction_manager &tm, block_address root, unsigned nr_entries) {
typedef hint_traits<WIDTH> traits;
typedef persistent_data::array<traits> ha;
boost::shared_ptr<array_base> r = typename ha::ptr(new ha(tm, typename traits::ref_counter(), root, nr_entries));
std::shared_ptr<array_base> r = typename ha::ptr(new ha(tm, typename traits::ref_counter(), root, nr_entries));
return r;
}
boost::shared_ptr<array_base> mk_array(transaction_manager &tm, uint32_t width, block_address root, unsigned nr_entries) {
std::shared_ptr<array_base> mk_array(transaction_manager &tm, uint32_t width, block_address root, unsigned nr_entries) {
switch (width) {
#define xx(n) case n: return mk_array<n>(tm, root, nr_entries)
all_widths
@ -95,21 +95,21 @@ namespace {
}
// never get here
return boost::shared_ptr<array_base>();
return std::shared_ptr<array_base>();
}
//--------------------------------
template <uint32_t WIDTH>
void get_hint(boost::shared_ptr<array_base> base, unsigned index, vector<unsigned char> &data) {
void get_hint(std::shared_ptr<array_base> base, unsigned index, vector<unsigned char> &data) {
typedef hint_traits<WIDTH> traits;
typedef persistent_data::array<traits> ha;
boost::shared_ptr<ha> a = downcast_array<ha>(base);
std::shared_ptr<ha> a = downcast_array<ha>(base);
data = a->get(index);
}
void get_hint_(uint32_t width, boost::shared_ptr<array_base> base, unsigned index, vector<unsigned char> &data) {
void get_hint_(uint32_t width, std::shared_ptr<array_base> base, unsigned index, vector<unsigned char> &data) {
switch (width) {
#define xx(n) case n: return get_hint<n>(base, index, data)
all_widths
@ -120,15 +120,15 @@ namespace {
//--------------------------------
template <uint32_t WIDTH>
void set_hint(boost::shared_ptr<array_base> base, unsigned index, vector<unsigned char> const &data) {
void set_hint(std::shared_ptr<array_base> base, unsigned index, vector<unsigned char> const &data) {
typedef hint_traits<WIDTH> traits;
typedef persistent_data::array<traits> ha;
boost::shared_ptr<ha> a = downcast_array<ha>(base);
std::shared_ptr<ha> a = downcast_array<ha>(base);
a->set(index, data);
}
void set_hint_(uint32_t width, boost::shared_ptr<array_base> base,
void set_hint_(uint32_t width, std::shared_ptr<array_base> base,
unsigned index, vector<unsigned char> const &data) {
switch (width) {
#define xx(n) case n: return set_hint<n>(base, index, data)
@ -140,15 +140,15 @@ namespace {
//--------------------------------
template <uint32_t WIDTH>
void grow(boost::shared_ptr<array_base> base, unsigned new_nr_entries, vector<unsigned char> const &value) {
void grow(std::shared_ptr<array_base> base, unsigned new_nr_entries, vector<unsigned char> const &value) {
typedef hint_traits<WIDTH> traits;
typedef persistent_data::array<traits> ha;
boost::shared_ptr<ha> a = downcast_array<ha>(base);
std::shared_ptr<ha> a = downcast_array<ha>(base);
a->grow(new_nr_entries, value);
}
void grow_(uint32_t width, boost::shared_ptr<array_base> base,
void grow_(uint32_t width, std::shared_ptr<array_base> base,
unsigned new_nr_entries, vector<unsigned char> const &value)
{
switch (width) {
@ -194,17 +194,17 @@ namespace {
};
template <uint32_t WIDTH>
void walk_hints(boost::shared_ptr<array_base> base, hint_visitor &hv, damage_visitor &dv) {
void walk_hints(std::shared_ptr<array_base> base, hint_visitor &hv, damage_visitor &dv) {
typedef hint_traits<WIDTH> traits;
typedef persistent_data::array<traits> ha;
boost::shared_ptr<ha> a = downcast_array<ha>(base);
std::shared_ptr<ha> a = downcast_array<ha>(base);
value_adapter vv(hv);
ll_damage_visitor ll(dv);
a->visit_values(vv, ll);
}
void walk_hints_(uint32_t width, boost::shared_ptr<array_base> base,
void walk_hints_(uint32_t width, std::shared_ptr<array_base> base,
hint_visitor &hv, damage_visitor &dv) {
switch (width) {
#define xx(n) case n: walk_hints<n>(base, hv, dv); break

View File

@ -55,7 +55,7 @@ namespace caching {
class hint_array {
public:
typedef boost::shared_ptr<hint_array> ptr;
typedef std::shared_ptr<hint_array> ptr;
hint_array(transaction_manager &tm, unsigned width);
hint_array(transaction_manager &tm, unsigned width, block_address root, unsigned nr_entries);
@ -77,7 +77,7 @@ namespace caching {
static uint32_t check_width(uint32_t width);
unsigned width_;
boost::shared_ptr<persistent_data::array_base> impl_;
std::shared_ptr<persistent_data::array_base> impl_;
};
}

View File

@ -24,7 +24,7 @@ namespace caching {
typedef block_manager::read_ref read_ref;
typedef block_manager::write_ref write_ref;
typedef boost::shared_ptr<metadata> ptr;
typedef std::shared_ptr<metadata> ptr;
metadata(block_manager::ptr bm, open_type ot, unsigned metadata_version = 2); // Create only
metadata(block_manager::ptr bm);

View File

@ -74,7 +74,6 @@ AC_CHECK_HEADERS([expat.h \
boost/lexical_cast.hpp \
boost/noncopyable.hpp \
boost/optional.hpp \
boost/shared_ptr.hpp \
boost/static_assert.hpp],
[], [AC_MSG_ERROR(bailing out)])

View File

@ -10,7 +10,7 @@ namespace era {
class emitter {
public:
typedef boost::shared_ptr<emitter> ptr;
typedef std::shared_ptr<emitter> ptr;
virtual ~emitter() {}

View File

@ -25,7 +25,7 @@ namespace era {
typedef block_manager::read_ref read_ref;
typedef block_manager::write_ref write_ref;
typedef boost::shared_ptr<metadata> ptr;
typedef std::shared_ptr<metadata> ptr;
metadata(block_manager::ptr bm, open_type ot);
metadata(block_manager::ptr bm, block_address metadata_snap);

View File

@ -46,7 +46,7 @@ namespace era {
class damage_visitor {
public:
typedef boost::shared_ptr<damage_visitor> ptr;
typedef std::shared_ptr<damage_visitor> ptr;
virtual ~damage_visitor() {}
@ -60,7 +60,7 @@ namespace era {
class writeset_visitor {
public:
typedef boost::shared_ptr<writeset_visitor> ptr;
typedef std::shared_ptr<writeset_visitor> ptr;
virtual ~writeset_visitor() {}

View File

@ -27,7 +27,6 @@
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <string>
@ -40,7 +39,7 @@ namespace persistent_data {
class block_manager : private boost::noncopyable {
public:
typedef boost::shared_ptr<block_manager> ptr;
typedef std::shared_ptr<block_manager> ptr;
enum mode {
READ_ONLY,

View File

@ -75,7 +75,7 @@ namespace persistent_data {
};
struct damage {
typedef boost::shared_ptr<damage> ptr;
typedef std::shared_ptr<damage> ptr;
damage(run<uint32_t> lost_keys,
std::string const &desc)
@ -222,7 +222,7 @@ namespace persistent_data {
typedef array_block<ValueTraits, block_manager::write_ref> wblock;
typedef array_block<ValueTraits, block_manager::read_ref> rblock;
typedef boost::shared_ptr<array<ValueTraits> > ptr;
typedef std::shared_ptr<array<ValueTraits> > ptr;
typedef typename ValueTraits::value_type value_type;
typedef typename ValueTraits::ref_counter ref_counter;

View File

@ -36,7 +36,7 @@ namespace persistent_data {
template <typename ValueTraits, typename RefType>
class array_block {
public:
typedef boost::shared_ptr<array_block> ptr;
typedef std::shared_ptr<array_block> ptr;
typedef typename ValueTraits::disk_type disk_type;
typedef typename ValueTraits::value_type value_type;
typedef typename ValueTraits::ref_counter ref_counter;

View File

@ -30,7 +30,7 @@ namespace persistent_data {
class bitset_impl {
public:
typedef boost::shared_ptr<bitset_impl> ptr;
typedef std::shared_ptr<bitset_impl> ptr;
typedef persistent_data::transaction_manager::ptr tm_ptr;
bitset_impl(transaction_manager &tm)

View File

@ -38,7 +38,7 @@ namespace persistent_data {
class bitset_visitor {
public:
typedef boost::shared_ptr<bitset_visitor> ptr;
typedef std::shared_ptr<bitset_visitor> ptr;
virtual ~bitset_visitor() {}
virtual void visit(uint32_t index, bool value) = 0;
@ -48,7 +48,7 @@ namespace persistent_data {
class bitset {
public:
typedef boost::shared_ptr<bitset> ptr;
typedef std::shared_ptr<bitset> ptr;
bitset(transaction_manager &tm);
bitset(transaction_manager &tm,
@ -66,7 +66,7 @@ namespace persistent_data {
void walk_bitset(bitset_detail::bitset_visitor &v) const;
private:
boost::shared_ptr<bitset_detail::bitset_impl> impl_;
std::shared_ptr<bitset_detail::bitset_impl> impl_;
};
}

View File

@ -4,14 +4,12 @@
#include "persistent-data/transaction_manager.h"
#include "persistent-data/data-structures/bitset.h"
#include <boost/shared_ptr.hpp>
//----------------------------------------------------------------
namespace persistent_data {
class bloom_filter {
public:
typedef boost::shared_ptr<bloom_filter> ptr;
typedef std::shared_ptr<bloom_filter> ptr;
// nr_bits must be a power of two
bloom_filter(transaction_manager &tm,

View File

@ -298,7 +298,7 @@ namespace persistent_data {
template <unsigned Levels, typename ValueTraits>
class btree {
public:
typedef boost::shared_ptr<btree<Levels, ValueTraits> > ptr;
typedef std::shared_ptr<btree<Levels, ValueTraits> > ptr;
typedef uint64_t key[Levels];
typedef typename ValueTraits::value_type value_type;
@ -338,7 +338,7 @@ namespace persistent_data {
// inspect the individual nodes that make up a btree.
class visitor {
public:
typedef boost::shared_ptr<visitor> ptr;
typedef std::shared_ptr<visitor> ptr;
typedef btree_detail::node_location node_location;
virtual ~visitor() {}

View File

@ -10,7 +10,7 @@
namespace persistent_data {
namespace btree_detail {
struct damage {
typedef boost::shared_ptr<damage> ptr;
typedef std::shared_ptr<damage> ptr;
damage(run<uint64_t> lost_keys,
std::string const &desc)

View File

@ -19,15 +19,13 @@
#ifndef REF_COUNTER_H
#define REF_COUNTER_H
#include <boost/shared_ptr.hpp>
//----------------------------------------------------------------
namespace persistent_data {
template <typename ValueType>
class ref_counter {
public:
boost::shared_ptr<ref_counter<ValueType> > ptr;
std::shared_ptr<ref_counter<ValueType> > ptr;
virtual ~ref_counter() {}

View File

@ -20,8 +20,8 @@
#define ERROR_SET_H
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
#include <list>
#include <memory>
#include <iosfwd>
#include <string>
@ -34,7 +34,7 @@ namespace persistent_data {
// user can control how much detail is displayed.
class error_set {
public:
typedef boost::shared_ptr<error_set> ptr;
typedef std::shared_ptr<error_set> ptr;
error_set(std::string const &err);

View File

@ -19,8 +19,6 @@
#include "persistent-data/space-maps/careful_alloc.h"
#include "persistent-data/space-maps/subtracting_span_iterator.h"
#include <boost/shared_ptr.hpp>
using namespace std;
//----------------------------------------------------------------
@ -30,7 +28,7 @@ namespace {
class sm_careful_alloc : public checked_space_map {
public:
typedef boost::shared_ptr<sm_careful_alloc> ptr;
typedef std::shared_ptr<sm_careful_alloc> ptr;
sm_careful_alloc(checked_space_map::ptr sm)
: sm_(sm) {

View File

@ -26,7 +26,7 @@
namespace persistent_data {
class core_map : public checked_space_map {
public:
typedef boost::shared_ptr<core_map> ptr;
typedef std::shared_ptr<core_map> ptr;
core_map(block_address nr_blocks)
: counts_(nr_blocks, 0),

View File

@ -250,7 +250,7 @@ namespace {
#if 0
class ref_count_checker : public btree_checker<1, ref_count_traits> {
public:
typedef boost::shared_ptr<ref_count_checker> ptr;
typedef std::shared_ptr<ref_count_checker> ptr;
ref_count_checker(block_counter &counter)
: btree_checker<1, ref_count_traits>(counter) {
@ -267,7 +267,7 @@ namespace {
class index_store {
public:
typedef boost::shared_ptr<index_store> ptr;
typedef std::shared_ptr<index_store> ptr;
virtual ~index_store() {}
@ -285,7 +285,7 @@ namespace {
class sm_disk : public checked_space_map {
public:
typedef boost::shared_ptr<sm_disk> ptr;
typedef std::shared_ptr<sm_disk> ptr;
typedef transaction_manager::read_ref read_ref;
typedef transaction_manager::write_ref write_ref;
@ -635,7 +635,7 @@ namespace {
class btree_index_store : public index_store {
public:
typedef boost::shared_ptr<btree_index_store> ptr;
typedef std::shared_ptr<btree_index_store> ptr;
btree_index_store(transaction_manager &tm)
: tm_(tm),
@ -714,7 +714,7 @@ namespace {
class metadata_index_store : public index_store {
public:
typedef boost::shared_ptr<metadata_index_store> ptr;
typedef std::shared_ptr<metadata_index_store> ptr;
metadata_index_store(transaction_manager &tm)
: tm_(tm) {

View File

@ -26,7 +26,7 @@
namespace persistent_data {
class noop_map : public checked_space_map {
public:
typedef boost::shared_ptr<noop_map> ptr;
typedef std::shared_ptr<noop_map> ptr;
block_address get_nr_blocks() const {
fail();

View File

@ -23,7 +23,6 @@
#include "persistent-data/block_counter.h"
#include "persistent-data/run.h"
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <functional>
@ -36,7 +35,7 @@ namespace persistent_data {
class space_map {
public:
typedef boost::shared_ptr<space_map> ptr;
typedef std::shared_ptr<space_map> ptr;
virtual ~space_map() {};
@ -140,7 +139,7 @@ namespace persistent_data {
class persistent_space_map : public space_map {
public:
typedef boost::shared_ptr<persistent_space_map> ptr;
typedef std::shared_ptr<persistent_space_map> ptr;
virtual void count_metadata(block_counter &bc) const = 0;
virtual size_t root_size() const = 0;
@ -149,7 +148,7 @@ namespace persistent_data {
class checked_space_map : public persistent_space_map {
public:
typedef boost::shared_ptr<checked_space_map> ptr;
typedef std::shared_ptr<checked_space_map> ptr;
virtual void visit(space_map_detail::visitor &v) const {
throw std::runtime_error("space_map.visit not implemented");

View File

@ -23,14 +23,13 @@
#include "space_map.h"
#include <set>
#include <boost/shared_ptr.hpp>
//----------------------------------------------------------------
namespace persistent_data {
class transaction_manager : boost::noncopyable {
public:
typedef boost::shared_ptr<transaction_manager> ptr;
typedef std::shared_ptr<transaction_manager> ptr;
typedef block_manager::read_ref read_ref;
typedef block_manager::write_ref write_ref;
typedef bcache::validator::ptr validator;

View File

@ -50,7 +50,7 @@ namespace thin_provisioning {
class damage_visitor {
public:
typedef boost::shared_ptr<damage_visitor> ptr;
typedef std::shared_ptr<damage_visitor> ptr;
virtual ~damage_visitor() {}

View File

@ -19,10 +19,10 @@
#ifndef EMITTER_H
#define EMITTER_H
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <boost/optional/optional_io.hpp>
#include <memory>
#include <string>
#include <stdint.h>
@ -44,7 +44,7 @@ namespace thin_provisioning {
class emitter {
public:
typedef boost::shared_ptr<emitter> ptr;
typedef std::shared_ptr<emitter> ptr;
virtual ~emitter() {}

View File

@ -96,7 +96,7 @@ namespace thin_provisioning {
class damage_visitor {
public:
typedef boost::shared_ptr<damage_visitor> ptr;
typedef std::shared_ptr<damage_visitor> ptr;
virtual ~damage_visitor() {}

View File

@ -57,7 +57,7 @@ namespace thin_provisioning {
typedef block_manager::read_ref read_ref;
typedef block_manager::write_ref write_ref;
typedef boost::shared_ptr<metadata> ptr;
typedef std::shared_ptr<metadata> ptr;
metadata(block_manager::ptr bm, open_type ot,
sector_t data_block_size = 128,

View File

@ -56,7 +56,7 @@ namespace thin_provisioning {
class metadata_checker {
public:
typedef boost::shared_ptr<metadata_checker> ptr;
typedef std::shared_ptr<metadata_checker> ptr;
virtual ~metadata_checker() {}

View File

@ -111,7 +111,7 @@ namespace {
class command {
public:
typedef boost::shared_ptr<command> ptr;
typedef std::shared_ptr<command> ptr;
virtual ~command() {}
virtual void exec(strings const &args, ostream &out) = 0;

View File

@ -52,7 +52,7 @@ namespace {
//-------------------------------------------------------------------
struct btree_node_checker {
typedef boost::shared_ptr<btree_node_checker> ptr;
typedef std::shared_ptr<btree_node_checker> ptr;
virtual ~btree_node_checker() {}
virtual bool check(node_ref<uint64_traits> &n) = 0;
};

View File

@ -22,7 +22,6 @@
#include "metadata.h"
#include <string>
#include <boost/shared_ptr.hpp>
//----------------------------------------------------------------
@ -34,7 +33,7 @@ namespace thin_provisioning {
class thin_pool;
class thin {
public:
typedef boost::shared_ptr<thin> ptr;
typedef std::shared_ptr<thin> ptr;
typedef boost::optional<mapping_tree_detail::block_time> maybe_address;
thin_dev_t get_dev_t() const;
@ -57,7 +56,7 @@ namespace thin_provisioning {
class thin_pool {
public:
typedef boost::shared_ptr<thin_pool> ptr;
typedef std::shared_ptr<thin_pool> ptr;
thin_pool(metadata::ptr md);
~thin_pool();

View File

@ -61,7 +61,7 @@ namespace {
class validator_mock : public bcache::validator {
public:
typedef boost::shared_ptr<validator_mock> ptr;
typedef std::shared_ptr<validator_mock> ptr;
MOCK_CONST_METHOD2(check, void(void const *, block_address));
MOCK_CONST_METHOD1(check_raw, bool(void const *data));

View File

@ -66,7 +66,7 @@ namespace {
//--------------------------------
struct node_info {
typedef boost::shared_ptr<node_info> ptr;
typedef std::shared_ptr<node_info> ptr;
btree_detail::btree_path path;
@ -170,7 +170,7 @@ namespace {
public:
typedef btree_detail::node_location node_location;
typedef btree<Levels, ValueTraits> tree;
typedef boost::shared_ptr<btree_layout_visitor> ptr;
typedef std::shared_ptr<btree_layout_visitor> ptr;
virtual bool visit_internal(node_location const &loc,
typename tree::internal_node const &n) {

View File

@ -19,8 +19,6 @@
#include "gmock/gmock.h"
#include "persistent-data/cache.h"
#include <boost/shared_ptr.hpp>
using namespace boost;
using namespace base;
using namespace std;
@ -55,7 +53,7 @@ namespace {
struct SharedThingTraits {
typedef unsigned key_type;
typedef boost::shared_ptr<Thing> value_type;
typedef std::shared_ptr<Thing> value_type;
static key_type get_key(value_type const &p) {
return p->key_;

View File

@ -61,7 +61,7 @@ namespace {
class devices_visitor : public detail_tree::visitor {
public:
struct node_info {
typedef boost::shared_ptr<node_info> ptr;
typedef std::shared_ptr<node_info> ptr;
bool leaf;
unsigned depth;
@ -71,7 +71,7 @@ namespace {
};
typedef btree_detail::node_location node_location;
typedef boost::shared_ptr<devices_visitor> ptr;
typedef std::shared_ptr<devices_visitor> ptr;
virtual bool visit_internal(node_location const &loc,
detail_tree::internal_node const &n) {