Refactor Serializer, SerialIter, SHAMapItem, NodeObject:

* Make LessThan private
* Make NodeObject::isSame private
* Remove hotTRANSACTION
* Remove some Serializer members
* Remove unused SHAMapItem::getRaw
* Remove unused STLedgerEntry::getOwners
* Remove Serializer constructors
* Remove unused Serializer members
* Remove SerialIter ctor
This commit is contained in:
Vinnie Falco
2015-05-22 13:10:47 -07:00
parent c25184cc88
commit 8be4e7e65f
56 changed files with 220 additions and 370 deletions

View File

@@ -40,8 +40,7 @@ STLedgerEntry::STLedgerEntry (
const Serializer& s, uint256 const& index)
: STObject (sfLedgerEntry), mIndex (index), mMutable (true)
{
// we know 's' isn't going away
SerialIter sit (const_cast<Serializer&> (s));
SerialIter sit (s.slice());
set (sit);
setSLEType ();
}
@@ -184,38 +183,4 @@ RippleAddress STLedgerEntry::getSecondOwner ()
return RippleAddress::createAccountID (getFieldAmount (sfHighLimit).getIssuer ());
}
std::vector<uint256> STLedgerEntry::getOwners ()
{
std::vector<uint256> owners;
Account account;
for (int i = 0, fields = getCount (); i < fields; ++i)
{
auto const& fc = getFieldSType (i);
if ((fc == sfAccount) || (fc == sfOwner))
{
auto entry = dynamic_cast<const STAccount*> (peekAtPIndex (i));
if ((entry != nullptr) && entry->getValueH160 (account))
owners.push_back (getAccountRootIndex (account));
}
if ((fc == sfLowLimit) || (fc == sfHighLimit))
{
auto entry = dynamic_cast<const STAmount*> (peekAtPIndex (i));
if ((entry != nullptr))
{
auto issuer = entry->getIssuer ();
if (issuer.isNonZero ())
owners.push_back (getAccountRootIndex (issuer));
}
}
}
return owners;
}
} // ripple

View File

@@ -106,63 +106,6 @@ int Serializer::addRaw (const void* ptr, int len)
return ret;
}
bool Serializer::get16 (std::uint16_t& o, int offset) const
{
if ((offset + 2) > mData.size ()) return false;
const unsigned char* ptr = &mData[offset];
o = *ptr++;
o <<= 8;
o |= *ptr;
return true;
}
bool Serializer::get32 (std::uint32_t& o, int offset) const
{
if ((offset + 4) > mData.size ()) return false;
const unsigned char* ptr = &mData[offset];
o = *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr;
return true;
}
bool Serializer::get64 (std::uint64_t& o, int offset) const
{
if ((offset + 8) > mData.size ()) return false;
const unsigned char* ptr = &mData[offset];
o = *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr++;
o <<= 8;
o |= *ptr;
return true;
}
bool Serializer::get128 (uint128& o, int offset) const
{
if ((offset + (128 / 8)) > mData.size ()) return false;
memcpy (o.begin (), & (mData.front ()) + offset, (128 / 8));
return true;
}
bool Serializer::get256 (uint256& o, int offset) const
{
if ((offset + (256 / 8)) > mData.size ()) return false;
@@ -171,16 +114,6 @@ bool Serializer::get256 (uint256& o, int offset) const
return true;
}
uint256 Serializer::get256 (int offset) const
{
uint256 ret;
if ((offset + (256 / 8)) > mData.size ()) return ret;
memcpy (ret.begin (), & (mData.front ()) + offset, (256 / 8));
return ret;
}
int Serializer::addFieldID (int type, int name)
{
int ret = mData.size ();