diff --git a/modules/ripple_main/ripple_main.cpp b/modules/ripple_main/ripple_main.cpp
index bc114e3f7e..c7c461984e 100644
--- a/modules/ripple_main/ripple_main.cpp
+++ b/modules/ripple_main/ripple_main.cpp
@@ -184,7 +184,8 @@
-#include "src/cpp/ripple/AccountItems.h"
+#include "src/cpp/ripple/ripple_AccountItem.h"
+#include "src/cpp/ripple/ripple_AccountItems.h"
#include "src/cpp/ripple/ripple_AcceptedLedgerTx.h"
#include "src/cpp/ripple/ripple_AcceptedLedger.h"
#include "src/cpp/ripple/LedgerEntrySet.h"
@@ -267,7 +268,8 @@ static const uint64 tenTo17m1 = tenTo17 - 1;
#include "src/cpp/database/database.cpp"
#include "src/cpp/database/SqliteDatabase.cpp"
-#include "src/cpp/ripple/AccountItems.cpp" // no log
+#include "src/cpp/ripple/ripple_AccountItem.cpp"
+#include "src/cpp/ripple/ripple_AccountItems.cpp"
#include "src/cpp/ripple/AccountSetTransactor.cpp"
#include "src/cpp/ripple/AccountState.cpp" // no log
#include "src/cpp/ripple/CallRPC.cpp"
diff --git a/newcoin.vcxproj b/newcoin.vcxproj
index 3542e038a2..261fd2a6c4 100644
--- a/newcoin.vcxproj
+++ b/newcoin.vcxproj
@@ -731,12 +731,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
@@ -749,6 +743,18 @@
true
true
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
true
true
@@ -1710,9 +1716,10 @@
true
-
+
+
diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters
index 7e91e06294..fb83a07661 100644
--- a/newcoin.vcxproj.filters
+++ b/newcoin.vcxproj.filters
@@ -136,6 +136,9 @@
{ba524810-8446-4c50-ad59-d284747ba220}
+
+ {5b22fcf9-c9f0-4260-9a17-7b448e30bb57}
+
@@ -633,9 +636,6 @@
1. Modules\ripple_main\refactored
-
- 1. Modules\ripple_main\_unfactored\ledger
-
1. Modules\ripple_main\_unfactored\ledger
@@ -780,30 +780,6 @@
1. Modules\ripple_main\refactored
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
1. Modules\ripple_main\refactored
@@ -855,6 +831,36 @@
1. Modules\ripple_main
+
+ 1. Modules\ripple_main\refactored
+
+
+ 1. Modules\ripple_main\refactored
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
@@ -1382,9 +1388,6 @@
1. Modules\ripple_main\refactored
-
- 1. Modules\ripple_main\_unfactored\ledger
-
1. Modules\ripple_main\_unfactored\ledger
@@ -1532,30 +1535,6 @@
1. Modules\ripple_main\refactored
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
-
- 1. Modules\ripple_main\refactored
-
1. Modules\ripple_main\refactored
@@ -1604,6 +1583,36 @@
1. Modules\ripple_main\refactored
+
+ 1. Modules\ripple_main\refactored
+
+
+ 1. Modules\ripple_main\refactored
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
+
+ 1. Modules\ripple_main\refactored\shamap
+
diff --git a/src/cpp/ripple/AccountItems.cpp b/src/cpp/ripple/AccountItems.cpp
deleted file mode 100644
index 7ae07b5697..0000000000
--- a/src/cpp/ripple/AccountItems.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-
-AccountItem::AccountItem(SerializedLedgerEntry::ref ledger) : mLedgerEntry(ledger)
-{
-
-}
-
-AccountItems::AccountItems(const uint160& accountID, Ledger::ref ledger, AccountItem::pointer ofType)
-{
- mOfType = ofType;
-
- fillItems(accountID, ledger);
-}
-
-void AccountItems::fillItems(const uint160& accountID, Ledger::ref ledger)
-{
- uint256 rootIndex = Ledger::getOwnerDirIndex(accountID);
- uint256 currentIndex = rootIndex;
-
- while (1)
- {
- SLE::pointer ownerDir = ledger->getDirNode(currentIndex);
- if (!ownerDir) return;
-
- BOOST_FOREACH(uint256 const& uNode, ownerDir->getFieldV256(sfIndexes).peekValue())
- {
- SLE::pointer sleCur = ledger->getSLEi(uNode);
-
- AccountItem::pointer item = mOfType->makeItem(accountID, sleCur);
- if (item)
- {
- mItems.push_back(item);
- }
- }
-
- uint64 uNodeNext = ownerDir->getFieldU64(sfIndexNext);
- if (!uNodeNext) return;
-
- currentIndex = Ledger::getDirNodeIndex(rootIndex, uNodeNext);
- }
-}
-
-Json::Value AccountItems::getJson(int v)
-{
- Json::Value ret(Json::arrayValue);
- BOOST_FOREACH(AccountItem::ref ai, mItems)
- ret.append(ai->getJson(v));
- return ret;
-}
-
-// vim:ts=4
diff --git a/src/cpp/ripple/AccountItems.h b/src/cpp/ripple/AccountItems.h
deleted file mode 100644
index 95dafc87be..0000000000
--- a/src/cpp/ripple/AccountItems.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __ACCOUNT_ITEMS__
-#define __ACCOUNT_ITEMS__
-
-//
-// Fetch ledger entries from an account's owner dir.
-//
-class AccountItem
-{
-public:
- typedef boost::shared_ptr pointer;
- typedef const pointer& ref;
-
- AccountItem(){ }
- AccountItem(SerializedLedgerEntry::ref ledger);
- virtual ~AccountItem() { ; }
- virtual AccountItem::pointer makeItem(const uint160& accountID, SerializedLedgerEntry::ref ledgerEntry)=0;
- virtual LedgerEntryType getType()=0;
- virtual Json::Value getJson(int)=0;
-
- SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; }
- const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
- SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
-
- Blob getRaw() const;
-
- // VFALCO TODO make an accessor for mLedgerEntry so we can change protected to private
-protected:
- SerializedLedgerEntry::pointer mLedgerEntry;
-};
-
-class AccountItems
-{
-public:
- typedef boost::shared_ptr pointer;
-
- AccountItems(const uint160& accountID, Ledger::ref ledger, AccountItem::pointer ofType);
-
- std::vector& getItems() { return(mItems); }
- Json::Value getJson(int);
-
-private:
- AccountItem::pointer mOfType;
-
- std::vector mItems;
- void fillItems(const uint160& accountID, Ledger::ref ledger);
-};
-
-#endif
-
-// vim:ts=4
diff --git a/src/cpp/ripple/AccountState.h b/src/cpp/ripple/AccountState.h
index 1bfb937f31..462db2ef70 100644
--- a/src/cpp/ripple/AccountState.h
+++ b/src/cpp/ripple/AccountState.h
@@ -11,10 +11,13 @@ public:
typedef boost::shared_ptr pointer;
public:
- explicit AccountState(const RippleAddress& naAccountID); // For new accounts
- AccountState (SLE::ref ledgerEntry,const RippleAddress& naAccountI); // For accounts in a ledger
+ // For new accounts
+ explicit AccountState (const RippleAddress& naAccountID);
+
+ // For accounts in a ledger
+ AccountState (SLE::ref ledgerEntry, const RippleAddress& naAccountI);
- bool bHaveAuthorizedKey()
+ bool haveAuthorizedKey ()
{
return mLedgerEntry->isFieldPresent(sfRegularKey);
}
diff --git a/src/cpp/ripple/Offer.h b/src/cpp/ripple/Offer.h
index dee556228c..b7631279af 100644
--- a/src/cpp/ripple/Offer.h
+++ b/src/cpp/ripple/Offer.h
@@ -1,8 +1,6 @@
#ifndef RIPPLE_OFFER_H
#define RIPPLE_OFFER_H
-#include "AccountItems.h"
-
class Offer : public AccountItem
{
RippleAddress mAccount;
diff --git a/src/cpp/ripple/Pathfinder.h b/src/cpp/ripple/Pathfinder.h
index 100b88a25d..c9ae2b0747 100644
--- a/src/cpp/ripple/Pathfinder.h
+++ b/src/cpp/ripple/Pathfinder.h
@@ -5,7 +5,6 @@
#include "RippleCalc.h"
#include "OrderBookDB.h"
-#include "AccountItems.h"
#if 0
//
diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp
index 130bb32b5e..ad194542cd 100644
--- a/src/cpp/ripple/RPCHandler.cpp
+++ b/src/cpp/ripple/RPCHandler.cpp
@@ -11,7 +11,6 @@
#include "Pathfinder.h"
#include "RPCHandler.h"
#include "RPCSub.h"
-#include "AccountItems.h"
#include "Wallet.h"
#include "RippleCalc.h"
#include "RPCErr.h"
@@ -443,7 +442,7 @@ Json::Value RPCHandler::authorize(Ledger::ref lrLedger,
RippleAddress naMasterGenerator;
- if (asSrc->bHaveAuthorizedKey())
+ if (asSrc->haveAuthorizedKey())
{
Json::Value obj = getMasterGenerator(lrLedger, naRegularSeed, naMasterGenerator);
@@ -491,7 +490,7 @@ Json::Value RPCHandler::authorize(Ledger::ref lrLedger,
naAccountPublic.setAccountPublic(naGenerator, iIndex);
naAccountPrivate.setAccountPrivate(naGenerator, naRegularSeed, iIndex);
- if (asSrc->bHaveAuthorizedKey() && (asSrc->getAuthorizedKey().getAccountID() != naAccountPublic.getAccountID()))
+ if (asSrc->haveAuthorizedKey() && (asSrc->getAuthorizedKey().getAccountID() != naAccountPublic.getAccountID()))
{
// std::cerr << "iIndex: " << iIndex << std::endl;
// std::cerr << "sfAuthorizedKey: " << strHex(asSrc->getAuthorizedKey().getAccountID()) << std::endl;
diff --git a/src/cpp/ripple/RippleState.h b/src/cpp/ripple/RippleState.h
index a02678e373..bafea5f9db 100644
--- a/src/cpp/ripple/RippleState.h
+++ b/src/cpp/ripple/RippleState.h
@@ -6,8 +6,6 @@
// - Isolate ledger entry format.
//
-#include "AccountItems.h"
-
class RippleState : public AccountItem
{
public:
diff --git a/src/cpp/ripple/ripple_AccountItem.cpp b/src/cpp/ripple/ripple_AccountItem.cpp
new file mode 100644
index 0000000000..f1be6fb0b3
--- /dev/null
+++ b/src/cpp/ripple/ripple_AccountItem.cpp
@@ -0,0 +1,6 @@
+
+AccountItem::AccountItem (SerializedLedgerEntry::ref ledger)
+ : mLedgerEntry (ledger)
+{
+
+}
diff --git a/src/cpp/ripple/ripple_AccountItem.h b/src/cpp/ripple/ripple_AccountItem.h
new file mode 100644
index 0000000000..007b37f359
--- /dev/null
+++ b/src/cpp/ripple/ripple_AccountItem.h
@@ -0,0 +1,46 @@
+#ifndef RIPPLE_ACCOUNTITEM_H
+#define RIPPLE_ACCOUNTITEM_H
+
+//
+// Fetch ledger entries from an account's owner dir.
+//
+/** Base class representing account items.
+*/
+class AccountItem
+{
+public:
+ typedef boost::shared_ptr pointer;
+ typedef const pointer& ref;
+
+public:
+ AccountItem ()
+ { }
+
+ /** Construct from a flat ledger entry.
+ */
+ explicit AccountItem (SerializedLedgerEntry::ref ledger);
+
+ virtual ~AccountItem() { ; }
+
+ virtual AccountItem::pointer makeItem (const uint160& accountID, SerializedLedgerEntry::ref ledgerEntry)=0;
+
+ virtual LedgerEntryType getType ()=0;
+
+ virtual Json::Value getJson(int)=0;
+
+ SerializedLedgerEntry::pointer getSLE() { return mLedgerEntry; }
+
+ const SerializedLedgerEntry& peekSLE() const { return *mLedgerEntry; }
+
+ SerializedLedgerEntry& peekSLE() { return *mLedgerEntry; }
+
+ Blob getRaw() const;
+
+ // VFALCO TODO Make this private and use the existing accessors
+ //
+protected:
+ // VFALCO TODO Research making the object pointed to const
+ SerializedLedgerEntry::pointer mLedgerEntry;
+};
+
+#endif
diff --git a/src/cpp/ripple/ripple_AccountItems.cpp b/src/cpp/ripple/ripple_AccountItems.cpp
new file mode 100644
index 0000000000..3aed6dcb04
--- /dev/null
+++ b/src/cpp/ripple/ripple_AccountItems.cpp
@@ -0,0 +1,63 @@
+
+AccountItems::AccountItems (uint160 const& accountID,
+ Ledger::ref ledger,
+ AccountItem::pointer ofType)
+{
+ mOfType = ofType;
+
+ fillItems(accountID, ledger);
+}
+
+void AccountItems::fillItems(const uint160& accountID, Ledger::ref ledger)
+{
+ uint256 const rootIndex = Ledger::getOwnerDirIndex(accountID);
+ uint256 currentIndex = rootIndex;
+
+ // VFALCO TODO Rewrite all infinite loops to have clear terminating
+ // conditions defined in one location.
+ //
+ while (1)
+ {
+ SLE::pointer ownerDir = ledger->getDirNode (currentIndex);
+
+ // VFALCO TODO Rewrite to not return from the middle of the function
+ if (!ownerDir)
+ return;
+
+ BOOST_FOREACH (uint256 const& uNode, ownerDir->getFieldV256 (sfIndexes).peekValue ())
+ {
+ // VFALCO TODO rename getSLEi() to something legible.
+ SLE::pointer sleCur = ledger->getSLEi (uNode);
+
+ AccountItem::pointer item = mOfType->makeItem (accountID, sleCur);
+
+ // VFALCO NOTE Under what conditions would makeItem() return nullptr?
+ if (item)
+ {
+ mItems.push_back (item);
+ }
+ }
+
+ uint64 uNodeNext = ownerDir->getFieldU64(sfIndexNext);
+
+ // VFALCO TODO Rewrite to not return from the middle of the function
+ if (!uNodeNext)
+ return;
+
+ currentIndex = Ledger::getDirNodeIndex (rootIndex, uNodeNext);
+ }
+}
+
+Json::Value AccountItems::getJson(int v)
+{
+ Json::Value ret (Json::arrayValue);
+
+ BOOST_FOREACH (AccountItem::ref ai, mItems)
+ {
+ ret.append (ai->getJson (v));
+ }
+
+ return ret;
+}
+
+// vim:ts=4
diff --git a/src/cpp/ripple/ripple_AccountItems.h b/src/cpp/ripple/ripple_AccountItems.h
new file mode 100644
index 0000000000..13abcdc510
--- /dev/null
+++ b/src/cpp/ripple/ripple_AccountItems.h
@@ -0,0 +1,36 @@
+#ifndef RIPPLE_ACCOUNTITEMS_H
+#define RIPPLE_ACCOUNTITEMS_H
+
+/** A set of AccountItem objects.
+*/
+class AccountItems
+{
+public:
+ typedef boost::shared_ptr pointer;
+
+ typedef std::vector Container;
+
+ // VFALCO TODO Create a typedef uint160 AccountID and replace
+ AccountItems (uint160 const& accountID,
+ Ledger::ref ledger,
+ AccountItem::pointer ofType);
+
+ // VFALCO TODO rename to getContainer and make this change in every interface
+ // that exposes the caller to the type of container.
+ //
+ Container& getItems() { return mItems; }
+
+ // VFALCO TODO What is the int for?
+ Json::Value getJson (int);
+
+private:
+ void fillItems (const uint160& accountID, Ledger::ref ledger);
+
+private:
+ // VFALCO TODO This looks like its used as an exemplar, rename appropriately
+ AccountItem::pointer mOfType;
+
+ Container mItems;
+};
+
+#endif