Rename to Application

This commit is contained in:
Vinnie Falco
2013-07-10 21:06:21 -07:00
parent 5bbfe16520
commit 0841a3b103
7 changed files with 44 additions and 45 deletions

View File

@@ -1489,7 +1489,7 @@
<ClInclude Include="..\..\src\cpp\ripple\ripple_AccountState.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_AccountState.h" />
<ClInclude Include="..\..\src\cpp\ripple\ripple_CanonicalTXSet.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_CanonicalTXSet.h" />
<ClInclude Include="..\..\src\cpp\ripple\ripple_DisputedTx.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_DisputedTx.h" />
<ClInclude Include="..\..\src\cpp\ripple\ripple_IApplication.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_Application.h" />
<ClInclude Include="..\..\src\cpp\ripple\ripple_IFeatures.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_IFeatures.h" />
<ClInclude Include="..\..\src\cpp\ripple\ripple_IFeeVote.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_IFeeVote.h" />
<ClInclude Include="..\..\src\cpp\ripple\ripple_IHashRouter.h" /> <ClInclude Include="..\..\src\cpp\ripple\ripple_IHashRouter.h" />

View File

@@ -1317,9 +1317,6 @@
<ClInclude Include="..\..\src\cpp\ripple\ParameterTable.h"> <ClInclude Include="..\..\src\cpp\ripple\ParameterTable.h">
<Filter>[1] Ripple\ripple_app\_main</Filter> <Filter>[1] Ripple\ripple_app\_main</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\cpp\ripple\ripple_IApplication.h">
<Filter>[1] Ripple\ripple_app\_main</Filter>
</ClInclude>
<ClInclude Include="..\..\src\cpp\ripple\ripple_LocalCredentials.h"> <ClInclude Include="..\..\src\cpp\ripple\ripple_LocalCredentials.h">
<Filter>[1] Ripple\ripple_app\_main</Filter> <Filter>[1] Ripple\ripple_app\_main</Filter>
</ClInclude> </ClInclude>
@@ -1647,6 +1644,9 @@
<ClInclude Include="..\..\modules\ripple_app\ledger\SerializedValidation.h"> <ClInclude Include="..\..\modules\ripple_app\ledger\SerializedValidation.h">
<Filter>[1] Ripple\ripple_app\ledger</Filter> <Filter>[1] Ripple\ripple_app\ledger</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\cpp\ripple\ripple_Application.h">
<Filter>[1] Ripple\ripple_app\_main</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="..\..\src\cpp\ripple\ripple.proto" /> <CustomBuild Include="..\..\src\cpp\ripple\ripple.proto" />

View File

@@ -66,7 +66,7 @@ RIPPLE TODO
- Replace all NULL with nullptr - 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. - Make TxFormats a member of ICore instead of a singleton.
PROBLEM: STObject derived classes like STInt16 make direct use of the PROBLEM: STObject derived classes like STInt16 make direct use of the

View File

@@ -153,7 +153,7 @@ namespace ripple
#include "src/cpp/ripple/RPCHandler.h" #include "src/cpp/ripple/RPCHandler.h"
#include "src/cpp/ripple/TransactionQueue.h" #include "src/cpp/ripple/TransactionQueue.h"
#include "ledger/OrderBookDB.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/CallRPC.h"
#include "src/cpp/ripple/Transactor.h" #include "src/cpp/ripple/Transactor.h"
#include "src/cpp/ripple/ChangeTransactor.h" #include "src/cpp/ripple/ChangeTransactor.h"

View File

@@ -9,7 +9,7 @@
// VFALCO TODO Replace these with beast "unsigned long long" generators // VFALCO TODO Replace these with beast "unsigned long long" generators
// VFALCO NOTE Apparently these are used elsewhere. Make them constants in the config // 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_GIFT 1000ull
#define SYSTEM_CURRENCY_USERS 100000000ull #define SYSTEM_CURRENCY_USERS 100000000ull

View File

@@ -12,20 +12,20 @@ class Application;
SETUP_LOG (Application) SETUP_LOG (Application)
// VFALCO TODO Move the function definitions into the class declaration // VFALCO TODO Move the function definitions into the class declaration
class Application class ApplicationImp
: public IApplication : public Application
, public SharedSingleton <Application> , public SharedSingleton <ApplicationImp>
, LeakChecked <Application> , LeakChecked <ApplicationImp>
{ {
public: public:
static Application* createInstance () static ApplicationImp* createInstance ()
{ {
return new Application; return new ApplicationImp;
} }
class Holder; class Holder;
Application () ApplicationImp ()
// //
// VFALCO NOTE Change this to control whether or not the Application // VFALCO NOTE Change this to control whether or not the Application
// object is destroyed on exit // object is destroyed on exit
@@ -34,7 +34,7 @@ public:
// Application object will be deleted on exit. If the code doesn't exit // Application object will be deleted on exit. If the code doesn't exit
// cleanly this could cause hangs or crashes on exit. // cleanly this could cause hangs or crashes on exit.
// //
: SharedSingleton <Application> (SingletonLifetime::persistAfterCreation) : SharedSingleton <ApplicationImp> (SingletonLifetime::persistAfterCreation)
#else #else
// This will make it so that the Application object is not deleted on exit. // This will make it so that the Application object is not deleted on exit.
// //
@@ -84,7 +84,21 @@ public:
HashMaps::getInstance ().initializeNonce <size_t> (); HashMaps::getInstance ().initializeNonce <size_t> ();
} }
~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 () LocalCredentials& getLocalCredentials ()
{ {
@@ -322,22 +336,7 @@ private:
bool volatile mShutdown; bool volatile mShutdown;
}; };
Application::~Application () void ApplicationImp::stop ()
{
// 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 ()
{ {
WriteLog (lsINFO, Application) << "Received shutdown request"; WriteLog (lsINFO, Application) << "Received shutdown request";
StopSustain (); StopSustain ();
@@ -387,13 +386,13 @@ static void runIO (boost::asio::io_service& io)
// Or better yet refactor these initializations into RAII classes // Or better yet refactor these initializations into RAII classes
// which are members of the Application object. // which are members of the Application object.
// //
void Application::setup () void ApplicationImp::setup ()
{ {
// VFALCO NOTE: 0 means use heuristics to determine the thread count. // VFALCO NOTE: 0 means use heuristics to determine the thread count.
mJobQueue.setThreadCount (0, theConfig.RUN_STANDALONE); mJobQueue.setThreadCount (0, theConfig.RUN_STANDALONE);
mSweepTimer.expires_from_now (boost::posix_time::seconds (10)); 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 (); m_loadManager->startThread ();
@@ -622,7 +621,7 @@ void Application::setup ()
} }
} }
void Application::run () void ApplicationImp::run ()
{ {
if (theConfig.NODE_SIZE >= 2) if (theConfig.NODE_SIZE >= 2)
{ {
@@ -661,7 +660,7 @@ void Application::run ()
boost::this_thread::sleep (boost::posix_time::milliseconds (100)); 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); boost::filesystem::space_info space = boost::filesystem::space (theConfig.DATA_DIR);
@@ -689,10 +688,10 @@ void Application::sweep ()
mNetOps.sweepFetchPack (); mNetOps.sweepFetchPack ();
// VFALCO NOTE does the call to sweep() happen on another thread? // VFALCO NOTE does the call to sweep() happen on another thread?
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval))); 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. // New stuff.
RippleAddress rootSeedMaster = RippleAddress::createSeedGeneric ("masterpassphrase"); 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 try
{ {
@@ -936,7 +935,7 @@ static void addTxnSeqField ()
db->executeSQL ("END TRANSACTION;"); db->executeSQL ("END TRANSACTION;");
} }
void Application::updateTables () void ApplicationImp::updateTables ()
{ {
if (theConfig.NODE_DB.empty ()) if (theConfig.NODE_DB.empty ())
{ {
@@ -969,7 +968,7 @@ void Application::updateTables ()
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
IApplication& getApp () Application& getApp ()
{ {
return *Application::getInstance (); return *ApplicationImp::getInstance ();
} }

View File

@@ -35,10 +35,10 @@ class DatabaseCon;
typedef TaggedCache <uint256, Blob , UptimeTimerAdapter> NodeCache; typedef TaggedCache <uint256, Blob , UptimeTimerAdapter> NodeCache;
typedef TaggedCache <uint256, SerializedLedgerEntry, UptimeTimerAdapter> SLECache; typedef TaggedCache <uint256, SerializedLedgerEntry, UptimeTimerAdapter> SLECache;
class IApplication class Application
{ {
public: public:
virtual ~IApplication () { } virtual ~Application () { }
/* VFALCO NOTE /* VFALCO NOTE
@@ -107,6 +107,6 @@ public:
virtual void sweep () = 0; virtual void sweep () = 0;
}; };
extern IApplication& getApp (); extern Application& getApp ();
#endif #endif