From 0841a3b103b186787e581c790886eaa0d4230a15 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 10 Jul 2013 21:06:21 -0700 Subject: [PATCH] Rename to Application --- Builds/VisualStudio2012/RippleD.vcxproj | 2 +- .../VisualStudio2012/RippleD.vcxproj.filters | 6 +- TODO.txt | 2 +- modules/ripple_app/ripple_app.cpp | 2 +- .../ripple_core/functional/ripple_Config.h | 2 +- src/cpp/ripple/ripple_Application.cpp | 69 +++++++++---------- ...le_IApplication.h => ripple_Application.h} | 6 +- 7 files changed, 44 insertions(+), 45 deletions(-) rename src/cpp/ripple/{ripple_IApplication.h => ripple_Application.h} (97%) diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj index e05ac2cb0..e2147e19b 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj +++ b/Builds/VisualStudio2012/RippleD.vcxproj @@ -1489,7 +1489,7 @@ - + diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters index 4f60dee99..bc7add8bd 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters @@ -1317,9 +1317,6 @@ [1] Ripple\ripple_app\_main - - [1] Ripple\ripple_app\_main - [1] Ripple\ripple_app\_main @@ -1647,6 +1644,9 @@ [1] Ripple\ripple_app\ledger + + [1] Ripple\ripple_app\_main + diff --git a/TODO.txt b/TODO.txt index e3b1e1ffb..ff58287bc 100644 --- a/TODO.txt +++ b/TODO.txt @@ -66,7 +66,7 @@ RIPPLE TODO - Replace all NULL with nullptr -- Add ICore interface (incremental replacement for IApplication) +- Add ICore interface (incremental replacement for Application) - Make TxFormats a member of ICore instead of a singleton. PROBLEM: STObject derived classes like STInt16 make direct use of the diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index fe137fe7f..6ffd7a4df 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -153,7 +153,7 @@ namespace ripple #include "src/cpp/ripple/RPCHandler.h" #include "src/cpp/ripple/TransactionQueue.h" #include "ledger/OrderBookDB.h" -#include "src/cpp/ripple/ripple_IApplication.h" +#include "src/cpp/ripple/ripple_Application.h" #include "src/cpp/ripple/CallRPC.h" #include "src/cpp/ripple/Transactor.h" #include "src/cpp/ripple/ChangeTransactor.h" diff --git a/modules/ripple_core/functional/ripple_Config.h b/modules/ripple_core/functional/ripple_Config.h index a4ea37665..47b2f7d0d 100644 --- a/modules/ripple_core/functional/ripple_Config.h +++ b/modules/ripple_core/functional/ripple_Config.h @@ -9,7 +9,7 @@ // VFALCO TODO Replace these with beast "unsigned long long" generators // VFALCO NOTE Apparently these are used elsewhere. Make them constants in the config -// or in the IApplication +// or in the Application // #define SYSTEM_CURRENCY_GIFT 1000ull #define SYSTEM_CURRENCY_USERS 100000000ull diff --git a/src/cpp/ripple/ripple_Application.cpp b/src/cpp/ripple/ripple_Application.cpp index 642fd8fe7..81a92b66a 100644 --- a/src/cpp/ripple/ripple_Application.cpp +++ b/src/cpp/ripple/ripple_Application.cpp @@ -12,20 +12,20 @@ class Application; SETUP_LOG (Application) // VFALCO TODO Move the function definitions into the class declaration -class Application - : public IApplication - , public SharedSingleton - , LeakChecked +class ApplicationImp + : public Application + , public SharedSingleton + , LeakChecked { public: - static Application* createInstance () + static ApplicationImp* createInstance () { - return new Application; + return new ApplicationImp; } class Holder; - Application () + ApplicationImp () // // VFALCO NOTE Change this to control whether or not the Application // object is destroyed on exit @@ -34,7 +34,7 @@ public: // Application object will be deleted on exit. If the code doesn't exit // cleanly this could cause hangs or crashes on exit. // - : SharedSingleton (SingletonLifetime::persistAfterCreation) + : SharedSingleton (SingletonLifetime::persistAfterCreation) #else // This will make it so that the Application object is not deleted on exit. // @@ -84,7 +84,21 @@ public: HashMaps::getInstance ().initializeNonce (); } - ~Application (); + ~ApplicationImp () + { + // VFALCO TODO Wrap these in ScopedPointer + delete mTxnDB; + delete mLedgerDB; + delete mWalletDB; + delete mHashNodeDB; + delete mNetNodeDB; + delete mPathFindDB; + delete mHashNodeLDB; + + if (mEphemeralLDB != nullptr) + delete mEphemeralLDB; + } + LocalCredentials& getLocalCredentials () { @@ -322,22 +336,7 @@ private: bool volatile mShutdown; }; -Application::~Application () -{ - // VFALCO TODO Wrap these in ScopedPointer - delete mTxnDB; - delete mLedgerDB; - delete mWalletDB; - delete mHashNodeDB; - delete mNetNodeDB; - delete mPathFindDB; - delete mHashNodeLDB; - - if (mEphemeralLDB != nullptr) - delete mEphemeralLDB; -} - -void Application::stop () +void ApplicationImp::stop () { WriteLog (lsINFO, Application) << "Received shutdown request"; StopSustain (); @@ -387,13 +386,13 @@ static void runIO (boost::asio::io_service& io) // Or better yet refactor these initializations into RAII classes // which are members of the Application object. // -void Application::setup () +void ApplicationImp::setup () { // VFALCO NOTE: 0 means use heuristics to determine the thread count. mJobQueue.setThreadCount (0, theConfig.RUN_STANDALONE); mSweepTimer.expires_from_now (boost::posix_time::seconds (10)); - mSweepTimer.async_wait (BIND_TYPE (&Application::sweep, this)); + mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this)); m_loadManager->startThread (); @@ -622,7 +621,7 @@ void Application::setup () } } -void Application::run () +void ApplicationImp::run () { if (theConfig.NODE_SIZE >= 2) { @@ -661,7 +660,7 @@ void Application::run () boost::this_thread::sleep (boost::posix_time::milliseconds (100)); } -void Application::sweep () +void ApplicationImp::sweep () { boost::filesystem::space_info space = boost::filesystem::space (theConfig.DATA_DIR); @@ -689,10 +688,10 @@ void Application::sweep () mNetOps.sweepFetchPack (); // VFALCO NOTE does the call to sweep() happen on another thread? mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval))); - mSweepTimer.async_wait (BIND_TYPE (&Application::sweep, this)); + mSweepTimer.async_wait (BIND_TYPE (&ApplicationImp::sweep, this)); } -void Application::startNewLedger () +void ApplicationImp::startNewLedger () { // New stuff. RippleAddress rootSeedMaster = RippleAddress::createSeedGeneric ("masterpassphrase"); @@ -722,7 +721,7 @@ void Application::startNewLedger () } } -bool Application::loadOldLedger (const std::string& l) +bool ApplicationImp::loadOldLedger (const std::string& l) { try { @@ -936,7 +935,7 @@ static void addTxnSeqField () db->executeSQL ("END TRANSACTION;"); } -void Application::updateTables () +void ApplicationImp::updateTables () { if (theConfig.NODE_DB.empty ()) { @@ -969,7 +968,7 @@ void Application::updateTables () //------------------------------------------------------------------------------ -IApplication& getApp () +Application& getApp () { - return *Application::getInstance (); + return *ApplicationImp::getInstance (); } diff --git a/src/cpp/ripple/ripple_IApplication.h b/src/cpp/ripple/ripple_Application.h similarity index 97% rename from src/cpp/ripple/ripple_IApplication.h rename to src/cpp/ripple/ripple_Application.h index f7a39e61d..686455972 100644 --- a/src/cpp/ripple/ripple_IApplication.h +++ b/src/cpp/ripple/ripple_Application.h @@ -35,10 +35,10 @@ class DatabaseCon; typedef TaggedCache NodeCache; typedef TaggedCache SLECache; -class IApplication +class Application { public: - virtual ~IApplication () { } + virtual ~Application () { } /* VFALCO NOTE @@ -107,6 +107,6 @@ public: virtual void sweep () = 0; }; -extern IApplication& getApp (); +extern Application& getApp (); #endif