Address some review feedback

Signed-off-by: Nicholas Van Sickle <nvsickle@amazon.com>
monroegm-disable-blank-issue-2
Nicholas Van Sickle 4 years ago
parent dec3def9eb
commit 5b8176e99b

@ -14,21 +14,21 @@
namespace AZ::Dom namespace AZ::Dom
{ {
PatchOperation::PatchOperation(Path destinationPath, Type type, Value value) PatchOperation::PatchOperation(Path destinationPath, Type type, Value value)
: m_domPath(destinationPath) : m_domPath(AZStd::move(destinationPath))
, m_type(type) , m_type(type)
, m_value(value) , m_value(AZStd::move(value))
{ {
} }
PatchOperation::PatchOperation(Path destinationPath, Type type, Path sourcePath) PatchOperation::PatchOperation(Path destinationPath, Type type, Path sourcePath)
: m_domPath(destinationPath) : m_domPath(AZStd::move(destinationPath))
, m_type(type) , m_type(type)
, m_value(sourcePath) , m_value(AZStd::move(sourcePath))
{ {
} }
PatchOperation::PatchOperation(Path destinationPath, Type type) PatchOperation::PatchOperation(Path destinationPath, Type type)
: m_domPath(destinationPath) : m_domPath(AZStd::move(destinationPath))
, m_type(type) , m_type(type)
{ {
} }
@ -690,22 +690,22 @@ namespace AZ::Dom
auto Patch::begin() const -> OperationsContainer::const_iterator auto Patch::begin() const -> OperationsContainer::const_iterator
{ {
return m_operations.cbegin(); return m_operations.begin();
} }
auto Patch::end() const -> OperationsContainer::const_iterator auto Patch::end() const -> OperationsContainer::const_iterator
{ {
return m_operations.cend(); return m_operations.end();
} }
auto Patch::cbegin() const -> OperationsContainer::const_iterator auto Patch::cbegin() const -> OperationsContainer::const_iterator
{ {
return m_operations.cbegin(); return m_operations.begin();
} }
auto Patch::cend() const -> OperationsContainer::const_iterator auto Patch::cend() const -> OperationsContainer::const_iterator
{ {
return m_operations.cend(); return m_operations.end();
} }
size_t Patch::size() const size_t Patch::size() const

@ -10,6 +10,7 @@
#include <AzCore/DOM/DomPath.h> #include <AzCore/DOM/DomPath.h>
#include <AzCore/DOM/DomValue.h> #include <AzCore/DOM/DomValue.h>
#include <AzCore/std/containers/deque.h>
namespace AZ::Dom namespace AZ::Dom
{ {
@ -108,12 +109,12 @@ namespace AZ::Dom
//! The current state of a Patch application operation. //! The current state of a Patch application operation.
struct PatchApplicationState struct PatchApplicationState
{ {
//! The outcome of the last operation, may be overridden to produce a different failure outcome.
PatchOperation::PatchOutcome m_outcome;
//! The patch being applied. //! The patch being applied.
const Patch* m_patch = nullptr; const Patch* m_patch = nullptr;
//! The last operation attempted. //! The last operation attempted.
const PatchOperation* m_lastOperation = nullptr; const PatchOperation* m_lastOperation = nullptr;
//! The outcome of the last operation, may be overridden to produce a different failure outcome.
PatchOperation::PatchOutcome m_outcome;
//! The current state of the value being patched, will be returned if the patch operation succeeds. //! The current state of the value being patched, will be returned if the patch operation succeeds.
Value* m_currentState = nullptr; Value* m_currentState = nullptr;
//! If set to false, the patch operation should halt. //! If set to false, the patch operation should halt.
@ -134,7 +135,7 @@ namespace AZ::Dom
{ {
public: public:
using StrategyFunctor = AZStd::function<void(PatchApplicationState&)>; using StrategyFunctor = AZStd::function<void(PatchApplicationState&)>;
using OperationsContainer = AZStd::vector<PatchOperation>; using OperationsContainer = AZStd::deque<PatchOperation>;
Patch() = default; Patch() = default;
Patch(const Patch&) = default; Patch(const Patch&) = default;
@ -193,6 +194,7 @@ namespace AZ::Dom
struct DeltaPatchGenerationParameters struct DeltaPatchGenerationParameters
{ {
static constexpr size_t NoReplace = AZStd::numeric_limits<size_t>::max(); static constexpr size_t NoReplace = AZStd::numeric_limits<size_t>::max();
static constexpr size_t AlwaysFullReplace = 0;
//! The threshold of changed values in a node or array which, if exceeded, will cause the generation to create an //! The threshold of changed values in a node or array which, if exceeded, will cause the generation to create an
//! entire "replace" oepration instead. If set to NoReplace, no replacement will occur. //! entire "replace" oepration instead. If set to NoReplace, no replacement will occur.

@ -106,12 +106,12 @@ namespace AZ::Dom::Benchmark
for (auto _ : state) for (auto _ : state)
{ {
name == name; benchmark::DoNotOptimize(name == name);
name == index; benchmark::DoNotOptimize(name == index);
name == endOfArray; benchmark::DoNotOptimize(name == endOfArray);
index == index; benchmark::DoNotOptimize(index == index);
index == endOfArray; benchmark::DoNotOptimize(index == endOfArray);
endOfArray == endOfArray; benchmark::DoNotOptimize(endOfArray == endOfArray);
} }
state.SetItemsProcessed(6 * state.iterations()); state.SetItemsProcessed(6 * state.iterations());

Loading…
Cancel
Save