From a75631da566db43b65ef699d396c94612f06cdf9 Mon Sep 17 00:00:00 2001 From: David Schwartz Date: Tue, 20 Aug 2013 17:50:14 -0700 Subject: [PATCH] STPath::assembleAdd function. --- .../protocol/ripple_SerializedTypes.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/ripple_data/protocol/ripple_SerializedTypes.h b/modules/ripple_data/protocol/ripple_SerializedTypes.h index ba79db09d5..0f02444c37 100644 --- a/modules/ripple_data/protocol/ripple_SerializedTypes.h +++ b/modules/ripple_data/protocol/ripple_SerializedTypes.h @@ -1369,6 +1369,27 @@ public: value.push_back (e); } + bool assembleAdd(STPath const& base, STPathElement const& tail) + { // assemble base+tail and add it to the set if it's not a duplicate + value.push_back (base); + + std::vector::reverse_iterator it = value.rbegin (); + + STPath& newPath = *it; + newPath.mPath.push_back (tail); + + while (++it != value.rend ()) + { + if (it->mPath == newPath.mPath) + { + value.pop_back (); + return false; + } + } + return true; + } + + virtual bool isEquivalent (const SerializedType& t) const; virtual bool isDefault () const {