Use deleted members to prevent copying in rippled (RIPD-268)

This commit is contained in:
Nik Bougalis
2014-09-20 11:27:37 -07:00
committed by Vinnie Falco
parent 01e52e6f9f
commit 7933e5d1f9
7 changed files with 29 additions and 29 deletions

View File

@@ -60,7 +60,6 @@ class SqliteStatement;
class Ledger class Ledger
: public std::enable_shared_from_this <Ledger> : public std::enable_shared_from_this <Ledger>
, public CountedObject <Ledger> , public CountedObject <Ledger>
, public beast::Uncopyable
{ {
public: public:
static char const* getCountedObjectName () { return "Ledger"; } static char const* getCountedObjectName () { return "Ledger"; }
@@ -118,6 +117,9 @@ public:
Ledger (bool dummy, Ledger & previous); // ledger after this one Ledger (bool dummy, Ledger & previous); // ledger after this one
Ledger (Ledger & target, bool isMutable); // snapshot Ledger (Ledger & target, bool isMutable); // snapshot
Ledger (Ledger const&) = delete;
Ledger& operator= (Ledger const&) = delete;
~Ledger (); ~Ledger ();
static Ledger::pointer getSQL (std::string const& sqlStatement); static Ledger::pointer getSQL (std::string const& sqlStatement);

View File

@@ -23,10 +23,12 @@
namespace ripple { namespace ripple {
/** Holds the cryptographic credentials identifying this instance of the server. */ /** Holds the cryptographic credentials identifying this instance of the server. */
class LocalCredentials : public beast::Uncopyable class LocalCredentials
{ {
public: public:
LocalCredentials (); LocalCredentials ();
LocalCredentials (LocalCredentials const&) = delete;
LocalCredentials& operator= (LocalCredentials const&) = delete;
// Begin processing. // Begin processing.
// - Maintain peer connectivity through validation and peer management. // - Maintain peer connectivity through validation and peer management.
@@ -50,9 +52,6 @@ public:
bool dataStore (std::string const& strKey, std::string const& strValue); bool dataStore (std::string const& strKey, std::string const& strValue);
private: private:
LocalCredentials (LocalCredentials const&); // disallowed
LocalCredentials& operator= (const LocalCredentials&); // disallowed
bool nodeIdentityLoad (); bool nodeIdentityLoad ();
bool nodeIdentityCreate (); bool nodeIdentityCreate ();

View File

@@ -31,7 +31,6 @@ class WSConnection
: public std::enable_shared_from_this <WSConnection> : public std::enable_shared_from_this <WSConnection>
, public InfoSub , public InfoSub
, public CountedObject <WSConnection> , public CountedObject <WSConnection>
, public beast::Uncopyable
{ {
public: public:
static char const* getCountedObjectName () { return "WSConnection"; } static char const* getCountedObjectName () { return "WSConnection"; }
@@ -43,6 +42,9 @@ protected:
Resource::Consumer usage, InfoSub::Source& source, bool isPublic, Resource::Consumer usage, InfoSub::Source& source, bool isPublic,
beast::IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service); beast::IP::Endpoint const& remoteAddress, boost::asio::io_service& io_service);
WSConnection(WSConnection const&) = delete;
WSConnection& operator= (WSConnection const&) = delete;
virtual ~WSConnection (); virtual ~WSConnection ();
virtual void preDestroy () = 0; virtual void preDestroy () = 0;
@@ -69,10 +71,6 @@ protected:
bool m_receiveQueueRunning; bool m_receiveQueueRunning;
bool m_isDead; bool m_isDead;
boost::asio::io_service& m_io_service; boost::asio::io_service& m_io_service;
private:
WSConnection (WSConnection const&);
WSConnection& operator= (WSConnection const&);
}; };
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -35,7 +35,7 @@ class WSConnectionType;
struct WSServerHandlerLog; struct WSServerHandlerLog;
// This tag helps with mutex tracking // This tag helps with mutex tracking
struct WSServerHandlerBase : public beast::Uncopyable struct WSServerHandlerBase
{ {
}; };
@@ -90,6 +90,9 @@ public:
{ {
} }
WSServerHandler(WSServerHandler const&) = delete;
WSServerHandler& operator= (WSServerHandler const&) = delete;
bool getPublic () bool getPublic ()
{ {
return mPublic; return mPublic;

View File

@@ -29,15 +29,10 @@
namespace ripple { namespace ripple {
class CAutoBN_CTX : public beast::Uncopyable class CAutoBN_CTX
{ {
protected: protected:
BN_CTX* pctx; BN_CTX* pctx;
CAutoBN_CTX& operator= (BN_CTX* pnew)
{
pctx = pnew;
return *this;
}
public: public:
CAutoBN_CTX () CAutoBN_CTX ()
@@ -54,6 +49,9 @@ public:
BN_CTX_free (pctx); BN_CTX_free (pctx);
} }
CAutoBN_CTX (CAutoBN_CTX const&) = delete;
CAutoBN_CTX& operator= (CAutoBN_CTX const&) = delete;
operator BN_CTX* () operator BN_CTX* ()
{ {
return pctx; return pctx;

View File

@@ -29,7 +29,6 @@ namespace TestOverlay
template <class Config> template <class Config>
class PeerType class PeerType
: public Config : public Config
, public beast::Uncopyable
{ {
public: public:
typedef typename Config::Peer Peer; typedef typename Config::Peer Peer;
@@ -51,6 +50,9 @@ public:
{ {
} }
PeerType (PeerType const&) = delete;
PeerType& operator= (PeerType const&) = delete;
/** Return the pending Results data associated with this peer. */ /** Return the pending Results data associated with this peer. */
/** @{ */ /** @{ */
Results& results () Results& results ()

View File

@@ -29,7 +29,7 @@ namespace ripple {
done by seeding the hashing function with a random number generated done by seeding the hashing function with a random number generated
at program startup. at program startup.
*/ */
class HashMaps : public beast::Uncopyable class HashMaps
{ {
public: public:
/** Golden ratio constant used in hashing functions. /** Golden ratio constant used in hashing functions.
@@ -89,13 +89,11 @@ public:
} }
private: private:
HashMaps () HashMaps () = default;
{ ~HashMaps () = default;
}
~HashMaps () HashMaps (HashMaps const&) = delete;
{ HashMaps& operator= (HashMaps const&) = delete;
}
/** Creates and holds a nonce for a type. /** Creates and holds a nonce for a type.
*/ */