General refactoring, using C++11

* Remove broken RecycledObjectPool

* Fix beast::ServiceQueue using List instead of LockFreeStack

* Add class semaphore, fixes broken Semaphore

* Move crytpo module files to new beast directory

* Use c++11 replacements for boost and beast types:
  - std::atomic instead of beast::Atomic
  - std::function instead of boost::function, beast::function
  - std::unique_ptr instead of beast::ScopedPointer
  - std::shared_ptr instead of boost::shared_ptr

* Remove modules:
  - beast_db
  - beast_crypto
  - beast_extras

* Remove unnecessary classes:
  - AbstractFifo
  - AddConst
  - AtomicCounter
  - AtomicFlag
  - AtomicPointer
  - AtomicState
  - CopyConst
  - Expression
  - ForwardList
  - IfCond
  - Interval
  - IntrusiveArray
  - KeyvaDB
  - PointerToOther
  - PointerTraits
  - RemoveConst
  - RemoveConstVolatile
  - RemoveReference
  - RemoveVolatile
  - SharedObjectArray
  - SingleThreadedSharedObject
  - SophiaDB factory
  - SortedSet
  - WeakReference
  - beast::unique_ptr
This commit is contained in:
Vinnie Falco
2013-12-31 08:28:12 -08:00
parent 52333b8bd4
commit 087301933a
164 changed files with 827 additions and 8812 deletions

View File

@@ -34,8 +34,6 @@
#endif
#include "../beast/modules/beast_asio/beast_asio.cpp"
#include "../beast/modules/beast_crypto/beast_crypto.cpp"
#include "../beast/modules/beast_db/beast_db.cpp"
#include "../beast/modules/beast_sqdb/beast_sqdb.cpp"
#include "../beast/beast/asio/Asio.cpp"

View File

@@ -20,6 +20,7 @@
#ifndef RIPPLE_HTTP_SERVER_H_INCLUDED
#define RIPPLE_HTTP_SERVER_H_INCLUDED
#include <memory>
#include <ostream>
namespace ripple {
@@ -74,7 +75,7 @@ public:
void stop ();
private:
ScopedPointer <ServerImpl> m_impl;
std::unique_ptr <ServerImpl> m_impl;
};
}

View File

@@ -20,6 +20,8 @@
#ifndef RIPPLE_HTTP_PEER_H_INCLUDED
#define RIPPLE_HTTP_PEER_H_INCLUDED
#include <memory>
namespace ripple {
namespace HTTP {
@@ -57,16 +59,16 @@ public:
boost::asio::io_service::strand m_strand;
boost::asio::deadline_timer m_data_timer;
boost::asio::deadline_timer m_request_timer;
ScopedPointer <MultiSocket> m_socket;
std::unique_ptr <MultiSocket> m_socket;
MemoryBlock m_buffer;
HTTPRequestParser m_parser;
int m_writesPending;
bool m_closed;
bool m_callClose;
Atomic <int> m_detached;
SharedPtr <Peer> m_detach_ref;
boost::optional <boost::asio::io_service::work> m_work;
int m_errorCode;
std::atomic <int> m_detached;
//--------------------------------------------------------------------------
@@ -80,6 +82,7 @@ public:
, m_closed (false)
, m_callClose (false)
, m_errorCode (0)
, m_detached (0)
{
tag = nullptr;
@@ -93,7 +96,8 @@ public:
case Port::require_ssl: flags = MultiSocket::server_ssl_required; break;
}
m_socket = MultiSocket::New (m_impl.get_io_service(), port.context->get(), flags);
m_socket.reset (MultiSocket::New (
m_impl.get_io_service(), port.context->get(), flags));
m_impl.add (*this);
}
@@ -163,7 +167,7 @@ public:
// Make the Session asynchronous
void detach ()
{
if (m_detached.compareAndSetBool (1, 0))
if (m_detached.exchange (1) == 0)
{
bassert (! m_work);
bassert (m_detach_ref.empty());

View File

@@ -20,6 +20,8 @@
#ifndef RIPPLE_PEERFINDER_CHECKERADAPTER_H_INCLUDED
#define RIPPLE_PEERFINDER_CHECKERADAPTER_H_INCLUDED
#include <memory>
namespace ripple {
namespace PeerFinder {
@@ -39,7 +41,7 @@ class CheckerAdapter : public Checker
private:
SerializedContext& m_context;
ServiceQueue& m_queue;
ScopedPointer <Checker> m_checker;
std::unique_ptr <Checker> m_checker;
struct Handler
{

View File

@@ -20,6 +20,8 @@
#ifndef RIPPLE_SITEFILES_LOGIC_H_INCLUDED
#define RIPPLE_SITEFILES_LOGIC_H_INCLUDED
#include <memory>
namespace ripple {
namespace SiteFiles {
@@ -74,7 +76,7 @@ public:
SharedState m_state;
Journal m_journal;
ScopedPointer <HTTPClientBase> m_client;
std::unique_ptr <HTTPClientBase> m_client;
explicit Logic (Journal journal)
: m_journal (journal)

View File

@@ -20,8 +20,7 @@
#ifndef RIPPLE_TESTOVERLAY_NETWORKTYPE_H_INCLUDED
#define RIPPLE_TESTOVERLAY_NETWORKTYPE_H_INCLUDED
namespace TestOverlay
{
namespace TestOverlay {
template <class ConfigParam>
class NetworkType : public ConfigParam
@@ -33,7 +32,7 @@ public:
typedef typename Config::State State;
typedef typename Config::SizeType SizeType;
typedef std::vector <ScopedPointer <Peer> > Peers;
typedef std::vector <std::unique_ptr <Peer> > Peers;
NetworkType ()
: m_steps (0)
@@ -63,7 +62,7 @@ public:
Peer& createPeer ()
{
Peer* peer (new Peer (*this));
m_peers.push_back (peer);
m_peers.push_back (std::unique_ptr <Peer> (peer));
return *peer;
}

View File

@@ -25,6 +25,8 @@
#include "beast/modules/beast_core/beast_core.h"
#include <memory>
/** Provides a template based peer to peer network simulator.
A TestOverlay::Network simulates an entire peer to peer network.

View File

@@ -33,6 +33,7 @@
#define RIPPLE_TYPES_BASE58_H
#include <iterator>
#include <type_traits>
#include "Blob.h"
@@ -87,7 +88,7 @@ public:
Alphabet const& alphabet, bool withCheck)
{
typedef typename std::iterator_traits<InputIt>::value_type value_type;
std::vector <typename mpl::RemoveConst <value_type>::type> v;
std::vector <typename std::remove_const <value_type>::type> v;
std::size_t const size (std::distance (first, last));
if (withCheck)
{

View File

@@ -20,15 +20,7 @@
#ifndef RIPPLE_TYPES_RIPPLEASSETS_H_INCLUDED
#define RIPPLE_TYPES_RIPPLEASSETS_H_INCLUDED
#ifndef RIPPLE_USE_C11
#define RIPPLE_USE_C11 1
#endif
#if RIPPLE_USE_C11
# include <type_traits>
#else
# include "beast/beast/mpl/IfCond.h"
#endif
#include <type_traits>
namespace ripple {
@@ -55,21 +47,12 @@ template <bool ByValue>
class RippleAssetType
{
public:
#if RIPPLE_USE_C11
typedef typename std::conditional <ByValue,
RippleCurrency, RippleCurrency const&>::type Currency;
typedef typename std::conditional <ByValue,
RippleIssuer, RippleIssuer const&>::type Issuer;
#else
typedef typename mpl::IfCond <ByValue,
RippleCurrency, RippleCurrency const&>::type Currency;
typedef typename mpl::IfCond <ByValue,
RippleIssuer, RippleIssuer const&>::type Issuer;
#endif
Currency currency;
Issuer issuer;

View File

@@ -23,7 +23,7 @@
#include "../json/ripple_json.h"
#include "beast/modules/beast_core/beast_core.h"
#include "beast/modules/beast_crypto/beast_crypto.h" // for UnsignedInteger, Remove ASAP!
#include "beast/beast/Crypto.h"
#include "beast/modules/beast_core/system/BeforeBoost.h"
#include <boost/utility/base_from_member.hpp>

View File

@@ -20,6 +20,8 @@
#ifndef RIPPLE_VALIDATORS_LOGIC_H_INCLUDED
#define RIPPLE_VALIDATORS_LOGIC_H_INCLUDED
#include <memory>
namespace ripple {
namespace Validators {
@@ -158,7 +160,7 @@ public:
{
if (findSourceByID (source->uniqueID()))
{
ScopedPointer <Source> object (source);
std::unique_ptr <Source> object (source);
m_journal.error << "Duplicate " << source->name();
return;
}

View File

@@ -89,10 +89,7 @@ private:
SourceFile* SourceFile::New (File const& file)
{
ScopedPointer <SourceFile> object (
new SourceFileImp (file));
return object.release ();
return new SourceFileImp (file);
}
}

View File

@@ -75,10 +75,7 @@ private:
SourceStrings* SourceStrings::New (
String name, StringArray const& strings)
{
ScopedPointer <SourceStrings> object (
new SourceStringsImp (name, strings));
return object.release ();
return new SourceStringsImp (name, strings);
}
}

View File

@@ -17,6 +17,8 @@
*/
//==============================================================================
#include <memory>
namespace ripple {
namespace Validators {
@@ -75,7 +77,7 @@ public:
private:
URL m_url;
ScopedPointer <HTTPClientBase> m_client;
std::unique_ptr <HTTPClientBase> m_client;
};
//------------------------------------------------------------------------------