mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Minor optimization of STObject::add
This commit is contained in:
committed by
Nik Bougalis
parent
70d9d88cda
commit
574ea2c14d
@@ -354,12 +354,12 @@ public:
|
||||
|
||||
virtual void add (Serializer & s) const override
|
||||
{
|
||||
add (s, true); // just inner elements
|
||||
add (s, withAllFields); // just inner elements
|
||||
}
|
||||
|
||||
void addWithoutSigningFields (Serializer & s) const
|
||||
{
|
||||
add (s, false);
|
||||
add (s, omitSigningFields);
|
||||
}
|
||||
|
||||
// VFALCO NOTE does this return an expensive copy of an object with a
|
||||
@@ -368,7 +368,7 @@ public:
|
||||
Serializer getSerializer () const
|
||||
{
|
||||
Serializer s;
|
||||
add (s, true);
|
||||
add (s, withAllFields);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -538,13 +538,22 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
void add (Serializer & s, bool withSigningFields) const;
|
||||
enum WhichFields : bool
|
||||
{
|
||||
// These values are carefully chosen to do the right thing if passed
|
||||
// to SField::shouldInclude (bool)
|
||||
omitSigningFields = false,
|
||||
withAllFields = true
|
||||
};
|
||||
|
||||
void add (Serializer & s, WhichFields whichFields) const;
|
||||
|
||||
// Sort the entries in an STObject into the order that they will be
|
||||
// serialized. Note: they are not sorted into pointer value order, they
|
||||
// are sorted by SField::fieldCode.
|
||||
static std::vector<STBase const*>
|
||||
getSortedFields (STObject const& objToSort);
|
||||
getSortedFields (
|
||||
STObject const& objToSort, WhichFields whichFields);
|
||||
|
||||
// Two different ways to compare STObjects.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user