diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-29 23:09:48 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-29 23:09:48 +0100 |
commit | fe5ffac7434bae9605fc3b481510efc5448b31d6 (patch) | |
tree | 56ea7b84ef7188c524cf57968de3e55411302549 /document | |
parent | 8fb122beb8c3392a183d413111f5eaf7d014a2ab (diff) |
Rename Operator to Operation, to match upcoming json syntax.
Diffstat (limited to 'document')
4 files changed, 17 insertions, 17 deletions
diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index 981f76fc731..a36c0210758 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -178,7 +178,7 @@ FieldValue::UP createTensorFieldValueWith2Cells() { std::unique_ptr<TensorModifyUpdate> createTensorModifyUpdate() { auto tensor = createTensor({ {{{"x", "8"}, {"y", "9"}}, 2} }, {"x", "y"}); - auto update = std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operator::REPLACE, std::move(tensor)); + auto update = std::make_unique<TensorModifyUpdate>(TensorModifyUpdate::Operation::REPLACE, std::move(tensor)); return update; } diff --git a/document/src/vespa/document/serialization/vespadocumentserializer.cpp b/document/src/vespa/document/serialization/vespadocumentserializer.cpp index ef75c475d70..8d77c14bef8 100644 --- a/document/src/vespa/document/serialization/vespadocumentserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentserializer.cpp @@ -571,7 +571,7 @@ void VespaDocumentSerializer::write(const TensorModifyUpdate &value) { _stream << TensorModifyUpdate::classId; - _stream << static_cast<uint8_t>(value.getOperator()); + _stream << static_cast<uint8_t>(value.getOperation()); vespalib::tensor::TypedBinaryFormat::serialize(_stream, value.getOperand()); } diff --git a/document/src/vespa/document/update/tensormodifyupdate.cpp b/document/src/vespa/document/update/tensormodifyupdate.cpp index 458fdbaa443..1da3fc63b22 100644 --- a/document/src/vespa/document/update/tensormodifyupdate.cpp +++ b/document/src/vespa/document/update/tensormodifyupdate.cpp @@ -24,19 +24,19 @@ namespace document { IMPLEMENT_IDENTIFIABLE(TensorModifyUpdate, ValueUpdate); TensorModifyUpdate::TensorModifyUpdate() - : _operator(Operator::MAX_NUM_OPERATORS), + : _operation(Operation::MAX_NUM_OPERATIONS), _operand() { } TensorModifyUpdate::TensorModifyUpdate(const TensorModifyUpdate &rhs) - : _operator(rhs._operator), + : _operation(rhs._operation), _operand(rhs._operand->clone()) { } -TensorModifyUpdate::TensorModifyUpdate(Operator op, std::unique_ptr<vespalib::tensor::Tensor> &&operand) - : _operator(op), +TensorModifyUpdate::TensorModifyUpdate(Operation operation, std::unique_ptr<vespalib::tensor::Tensor> &&operand) + : _operation(operation), _operand(std::move(operand)) { } @@ -46,7 +46,7 @@ TensorModifyUpdate::~TensorModifyUpdate() = default; TensorModifyUpdate & TensorModifyUpdate::operator=(const TensorModifyUpdate &rhs) { - _operator = rhs._operator; + _operation = rhs._operation; _operand = rhs._operand->clone(); return *this; } @@ -54,7 +54,7 @@ TensorModifyUpdate::operator=(const TensorModifyUpdate &rhs) TensorModifyUpdate & TensorModifyUpdate::operator=(TensorModifyUpdate &&rhs) { - _operator = rhs._operator; + _operation = rhs._operation; _operand = std::move(rhs._operand); return *this; } @@ -66,7 +66,7 @@ TensorModifyUpdate::operator==(const ValueUpdate &other) const return false; } const TensorModifyUpdate& o(static_cast<const TensorModifyUpdate&>(other)); - if (_operator != o._operator) { + if (_operation != o._operation) { return false; } if (!_operand->equals(*o._operand)) { @@ -92,7 +92,7 @@ TensorModifyUpdate::applyTo(FieldValue& value) const if (value.inherits(TensorFieldValue::classId)) { TensorFieldValue &tensorFieldValue = static_cast<TensorFieldValue &>(value); auto &oldTensor = tensorFieldValue.getAsTensorPtr(); - // TODO: Apply operator with operand + // TODO: Apply operation with operand auto newTensor = oldTensor->clone(); tensorFieldValue = std::move(newTensor); } else { @@ -123,12 +123,12 @@ TensorModifyUpdate::deserialize(const DocumentTypeRepo&, const DataType&, nbostr { uint8_t op; stream >> op; - if (op >= static_cast<uint8_t>(Operator::MAX_NUM_OPERATORS)) { + if (op >= static_cast<uint8_t>(Operation::MAX_NUM_OPERATIONS)) { vespalib::asciistream msg; msg << "Unrecognized tensor modify update operation " << static_cast<uint32_t>(op); throw DeserializeException(msg.str(), VESPA_STRLOC); } - _operator = static_cast<Operator>(op); + _operation = static_cast<Operation>(op); auto tensor = TypedBinaryFormat::deserialize(stream); _operand = std::move(tensor); } diff --git a/document/src/vespa/document/update/tensormodifyupdate.h b/document/src/vespa/document/update/tensormodifyupdate.h index 6fe588aaa35..6f67ff925d4 100644 --- a/document/src/vespa/document/update/tensormodifyupdate.h +++ b/document/src/vespa/document/update/tensormodifyupdate.h @@ -13,26 +13,26 @@ namespace document { class TensorModifyUpdate : public ValueUpdate { public: /** Declare all types of tensor modify updates. */ - enum class Operator { // Operation to be applied to matching tensor cells + enum class Operation { // Operation to be applied to matching tensor cells REPLACE = 0, ADD = 1, MUL = 2, - MAX_NUM_OPERATORS = 3 + MAX_NUM_OPERATIONS = 3 }; private: - Operator _operator; + Operation _operation; std::unique_ptr<vespalib::tensor::Tensor> _operand; TensorModifyUpdate(); TensorModifyUpdate(const TensorModifyUpdate &rhs); ACCEPT_UPDATE_VISITOR; public: - TensorModifyUpdate(Operator op, std::unique_ptr<vespalib::tensor::Tensor> &&operand); + TensorModifyUpdate(Operation operation, std::unique_ptr<vespalib::tensor::Tensor> &&operand); ~TensorModifyUpdate() override; TensorModifyUpdate &operator=(const TensorModifyUpdate &rhs); TensorModifyUpdate &operator=(TensorModifyUpdate &&rhs); bool operator==(const ValueUpdate &other) const override; - Operator getOperator() const { return _operator; } + Operation getOperation() const { return _operation; } const vespalib::tensor::Tensor &getOperand() const { return *_operand; } void checkCompatibility(const Field &field) const override; bool applyTo(FieldValue &value) const override; |