From 36bd8f71734d90adff2a8bd3674623c02613ab24 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Fri, 14 Jun 2013 08:06:44 -0700 Subject: [PATCH] Rename members for clarity --- src/cpp/ripple/Pathfinder.cpp | 2 +- src/cpp/ripple/Pathfinder.h | 2 +- src/cpp/ripple/ripple_Job.cpp | 13 +++++++++---- src/cpp/ripple/ripple_Job.h | 16 ++++++++++++---- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/cpp/ripple/Pathfinder.cpp b/src/cpp/ripple/Pathfinder.cpp index a6d7a539b4..af4dfc3f98 100644 --- a/src/cpp/ripple/Pathfinder.cpp +++ b/src/cpp/ripple/Pathfinder.cpp @@ -151,7 +151,7 @@ Pathfinder::Pathfinder(RLCache::ref cache, theApp->getOrderBookDB().setup(mLedger); - mLoadMonitor = theApp->getJobQueue().getLoadEvent(jtPATH_FIND, "FindPath"); + m_loadEvent = theApp->getJobQueue().getLoadEvent(jtPATH_FIND, "FindPath"); // Construct the default path for later comparison. diff --git a/src/cpp/ripple/Pathfinder.h b/src/cpp/ripple/Pathfinder.h index c9ae2b0747..f56d7a55db 100644 --- a/src/cpp/ripple/Pathfinder.h +++ b/src/cpp/ripple/Pathfinder.h @@ -70,7 +70,7 @@ private: Ledger::pointer mLedger; PathState::pointer mPsDefault; - LoadEvent::pointer mLoadMonitor; + LoadEvent::pointer m_loadEvent; RLCache::pointer mRLCache; boost::unordered_map mRLMap; diff --git a/src/cpp/ripple/ripple_Job.cpp b/src/cpp/ripple/ripple_Job.cpp index 1d5019792e..29127446aa 100644 --- a/src/cpp/ripple/ripple_Job.cpp +++ b/src/cpp/ripple/ripple_Job.cpp @@ -21,8 +21,7 @@ Job::Job (JobType type, , mJob (job) , mName (name) { - // VFALCO NOTE what the heck does this do? - mLoadMonitor = boost::make_shared (boost::ref (lm), name, false); + m_loadEvent = boost::make_shared (boost::ref (lm), name, false); } JobType Job::getType() const @@ -32,9 +31,15 @@ JobType Job::getType() const void Job::doJob () { - mLoadMonitor->start(); + m_loadEvent->start(); + mJob (*this); - mLoadMonitor->reName(mName); + + // VFALCO TODO Isn't there a way to construct the load event with + // the proper name? This way the load event object + // can have the invariant "name is always set" + // + m_loadEvent->reName (mName); } void Job::rename (std::string const& newName) diff --git a/src/cpp/ripple/ripple_Job.h b/src/cpp/ripple/ripple_Job.h index d26421979c..f910268cff 100644 --- a/src/cpp/ripple/ripple_Job.h +++ b/src/cpp/ripple/ripple_Job.h @@ -42,9 +42,18 @@ enum JobType class Job { public: + /** Default constructor. - // VFALCO TODO find out why these extra constructors are needed - Job(); + Allows Job to be used as a container type. + + This is used to allow things like jobMap [key] = value. + */ + // VFALCO NOTE I'd prefer not to have a default constructed object. + // What is the semantic meaning of a Job with no associated + // function? Having the invariant "all Job objects refer to + // a job" would reduce the number of states. + // + Job (); Job (JobType type, uint64 index); @@ -73,8 +82,7 @@ private: JobType mType; uint64 mJobIndex; FUNCTION_TYPE mJob; - // VFALCO TODO why is this called mLoadMonitor if the type is LoadEvent pointer? - LoadEvent::pointer mLoadMonitor; + LoadEvent::pointer m_loadEvent; std::string mName; };