mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Optimize SHAMapItem construction
This commit is contained in:
committed by
Scott Schurr
parent
7ed2094a6a
commit
d8aab5a749
@@ -138,6 +138,7 @@ public:
|
|||||||
bool hasItem (uint256 const& id) const;
|
bool hasItem (uint256 const& id) const;
|
||||||
bool delItem (uint256 const& id);
|
bool delItem (uint256 const& id);
|
||||||
bool addItem (SHAMapItem const& i, bool isTransaction, bool hasMeta);
|
bool addItem (SHAMapItem const& i, bool isTransaction, bool hasMeta);
|
||||||
|
bool addItem (SHAMapItem&& i, bool isTransaction, bool hasMeta);
|
||||||
uint256 getHash () const;
|
uint256 getHash () const;
|
||||||
|
|
||||||
// save a copy if you have a temporary anyway
|
// save a copy if you have a temporary anyway
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
SHAMapItem (uint256 const& tag, Blob const & data);
|
SHAMapItem (uint256 const& tag, Blob const & data);
|
||||||
SHAMapItem (uint256 const& tag, Serializer const& s);
|
SHAMapItem (uint256 const& tag, Serializer const& s);
|
||||||
|
SHAMapItem (uint256 const& tag, Serializer&& s);
|
||||||
|
|
||||||
Slice slice() const;
|
Slice slice() const;
|
||||||
|
|
||||||
|
|||||||
@@ -798,6 +798,13 @@ bool SHAMap::addItem (const SHAMapItem& i, bool isTransaction, bool hasMetaData)
|
|||||||
return addGiveItem(std::make_shared<SHAMapItem const>(i), isTransaction, hasMetaData);
|
return addGiveItem(std::make_shared<SHAMapItem const>(i), isTransaction, hasMetaData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SHAMap::addItem(SHAMapItem&& i, bool isTransaction, bool hasMetaData)
|
||||||
|
{
|
||||||
|
return addGiveItem(std::make_shared<SHAMapItem const>(std::move(i)),
|
||||||
|
isTransaction, hasMetaData);
|
||||||
|
}
|
||||||
|
|
||||||
uint256
|
uint256
|
||||||
SHAMap::getHash () const
|
SHAMap::getHash () const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,4 +37,10 @@ SHAMapItem::SHAMapItem (uint256 const& tag, const Serializer& data)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHAMapItem::SHAMapItem (uint256 const& tag, Serializer&& data)
|
||||||
|
: tag_ (tag)
|
||||||
|
, data_(std::move(data.modData()))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
Reference in New Issue
Block a user