From 30e068ae17c4a4b095ea4e548f862f58b603e968 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sun, 12 Jul 2015 10:35:49 -0700 Subject: [PATCH] Tidy up compilation units --- Builds/VisualStudio2013/RippleD.vcxproj | 9 --- .../VisualStudio2013/RippleD.vcxproj.filters | 12 --- src/ripple/app/main/Application.cpp | 9 --- src/ripple/app/main/Application.h | 2 - src/ripple/ledger/CachedSLEs.h | 4 +- src/ripple/rpc/Manager.h | 62 ---------------- src/ripple/rpc/handlers/AccountLines.cpp | 1 + src/ripple/rpc/handlers/Print.cpp | 1 + src/ripple/rpc/impl/Manager.cpp | 73 ------------------- src/ripple/rpc/impl/RPCHandler.cpp | 2 + src/ripple/unity/rpcx.cpp | 1 - 11 files changed, 5 insertions(+), 171 deletions(-) delete mode 100644 src/ripple/rpc/Manager.h delete mode 100644 src/ripple/rpc/impl/Manager.cpp diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj index e3050642e1..9d3b5c8bd3 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj +++ b/Builds/VisualStudio2013/RippleD.vcxproj @@ -3257,8 +3257,6 @@ True - - True @@ -3284,9 +3282,6 @@ - - True - True @@ -3318,10 +3313,6 @@ - - - - diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters index eda92c82da..1acbcdbec8 100644 --- a/Builds/VisualStudio2013/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters @@ -3978,9 +3978,6 @@ ripple\rpc\impl - - ripple\rpc\impl - ripple\rpc\impl @@ -4011,9 +4008,6 @@ ripple\rpc\impl - - ripple\rpc\impl - ripple\rpc\impl @@ -4050,12 +4044,6 @@ ripple\rpc - - ripple\rpc - - - ripple\rpc - ripple\rpc diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index fba520bc36..5f9900f819 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include @@ -277,7 +276,6 @@ public: // These are Stoppable-related std::unique_ptr m_jobQueue; - std::unique_ptr m_rpcManager; // VFALCO TODO Make OrderBookDB abstract OrderBookDB m_orderBookDB; std::unique_ptr m_pathRequests; @@ -365,8 +363,6 @@ public: // Anything which calls addJob must be a descendant of the JobQueue // - , m_rpcManager (RPC::make_Manager (m_logs.journal("RPCManager"))) - , m_orderBookDB (*m_jobQueue) , m_pathRequests (new PathRequests ( @@ -473,11 +469,6 @@ public: return *m_jobQueue; } - RPC::Manager& getRPCManager () - { - return *m_rpcManager; - } - LocalCredentials& getLocalCredentials () { return m_localCredentials ; diff --git a/src/ripple/app/main/Application.h b/src/ripple/app/main/Application.h index 45bc87de52..4afd9a1393 100644 --- a/src/ripple/app/main/Application.h +++ b/src/ripple/app/main/Application.h @@ -34,7 +34,6 @@ namespace ripple { namespace Validators { class Manager; } namespace Resource { class Manager; } namespace NodeStore { class Database; } -namespace RPC { class Manager; } // VFALCO TODO Fix forward declares required for header dependency loops class AmendmentTable; @@ -95,7 +94,6 @@ public: virtual CollectorManager& getCollectorManager () = 0; virtual shamap::Family& family() = 0; virtual JobQueue& getJobQueue () = 0; - virtual RPC::Manager& getRPCManager () = 0; virtual NodeCache& getTempNodeCache () = 0; virtual CachedSLEs& cachedSLEs() = 0; virtual Validators::Manager& getValidators () = 0; diff --git a/src/ripple/ledger/CachedSLEs.h b/src/ripple/ledger/CachedSLEs.h index a44c8c7540..a80e6c0fbb 100644 --- a/src/ripple/ledger/CachedSLEs.h +++ b/src/ripple/ledger/CachedSLEs.h @@ -44,8 +44,7 @@ public: CachedSLEs (std::chrono::duration< Rep, Period> const& timeToLive, Stopwatch& clock) - : clock_ (clock) - , timeToLive_ (timeToLive) + : timeToLive_ (timeToLive) , map_ (clock) { } @@ -102,7 +101,6 @@ public: private: std::size_t hit_ = 0; std::size_t miss_ = 0; - Stopwatch const& clock_; std::mutex mutable mutex_; Stopwatch::duration timeToLive_; beast::aged_unordered_map -#include - -namespace ripple { -namespace RPC { - -/** Processes RPC commands. */ -class Manager -{ -public: - using handler_type = std::function ; - - virtual ~Manager () = 0; - - /** Add a handler for the specified JSON-RPC command. */ - template - void add (std::string const& method) - { - add (method, handler_type ( - [](Request& req) - { - Handler h; - h (req); - })); - } - - virtual void add (std::string const& method, handler_type&& handler) = 0; - - /** Dispatch the JSON-RPC request. - @return `true` if the command was found. - */ - virtual bool dispatch (Request& req) = 0; -}; - -std::unique_ptr make_Manager (beast::Journal journal); - -} // RPC -} // ripple - -#endif diff --git a/src/ripple/rpc/handlers/AccountLines.cpp b/src/ripple/rpc/handlers/AccountLines.cpp index cb9061ee03..be8c797edb 100644 --- a/src/ripple/rpc/handlers/AccountLines.cpp +++ b/src/ripple/rpc/handlers/AccountLines.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace ripple { diff --git a/src/ripple/rpc/handlers/Print.cpp b/src/ripple/rpc/handlers/Print.cpp index e3785c3a58..99409ac18d 100644 --- a/src/ripple/rpc/handlers/Print.cpp +++ b/src/ripple/rpc/handlers/Print.cpp @@ -18,6 +18,7 @@ //============================================================================== #include +#include namespace ripple { diff --git a/src/ripple/rpc/impl/Manager.cpp b/src/ripple/rpc/impl/Manager.cpp deleted file mode 100644 index 4015ba9470..0000000000 --- a/src/ripple/rpc/impl/Manager.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright (c) 2012, 2013 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - -#include -#include -#include -#include - -namespace ripple { -namespace RPC { - -class ManagerImp : public Manager -{ -public: - using Map = hash_map ; - - beast::Journal m_journal; - Map m_map; - - ManagerImp (beast::Journal journal) - : m_journal (journal) - { - } - - void add (std::string const& method, handler_type&& handler) - { - m_map.emplace (std::piecewise_construct, - std::forward_as_tuple (method), - std::forward_as_tuple (std::move (handler))); - } - - bool dispatch (Request& req) - { - Map::const_iterator const iter (m_map.find (req.method)); - if (iter == m_map.end()) - return false; - iter->second (req); - return true; - } -}; - -//------------------------------------------------------------------------------ - -Manager::~Manager () -{ -} - -std::unique_ptr make_Manager (beast::Journal journal) -{ - std::unique_ptr m (std::make_unique (journal)); - m->add ("print"); - - return m; -} - -} -} diff --git a/src/ripple/rpc/impl/RPCHandler.cpp b/src/ripple/rpc/impl/RPCHandler.cpp index 24c4b26b4f..6f9cb6bbf7 100644 --- a/src/ripple/rpc/impl/RPCHandler.cpp +++ b/src/ripple/rpc/impl/RPCHandler.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include #include +#include namespace ripple { namespace RPC { diff --git a/src/ripple/unity/rpcx.cpp b/src/ripple/unity/rpcx.cpp index 65255522a4..f152ab64a8 100644 --- a/src/ripple/unity/rpcx.cpp +++ b/src/ripple/unity/rpcx.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include