diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-01-31 19:40:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-31 19:40:53 +0100 |
commit | 2d3b7a1f82c785c8f4149606ad76f527aa721260 (patch) | |
tree | 6d55d93bf63739969f26235e08d99df251d141d4 | |
parent | a276ed8a77abab57e8018aad1ad293c40f86fae1 (diff) | |
parent | 8ae08833faa8979535f512fce51250721b461140 (diff) |
Merge pull request #8296 from vespa-engine/toregge/rename-field-in-tensor-modify-update
Rename field _operand -> _tensor in TensorModifyUpdate.
3 files changed, 17 insertions, 17 deletions
diff --git a/document/src/vespa/document/serialization/vespadocumentserializer.cpp b/document/src/vespa/document/serialization/vespadocumentserializer.cpp index 12500fcc99b..7960cc7934a 100644 --- a/document/src/vespa/document/serialization/vespadocumentserializer.cpp +++ b/document/src/vespa/document/serialization/vespadocumentserializer.cpp @@ -572,7 +572,7 @@ VespaDocumentSerializer::write(const TensorModifyUpdate &value) { _stream << TensorModifyUpdate::classId; _stream << static_cast<uint8_t>(value.getOperation()); - write(value.getOperand()); + write(value.getTensor()); } void diff --git a/document/src/vespa/document/update/tensormodifyupdate.cpp b/document/src/vespa/document/update/tensormodifyupdate.cpp index 738347feb78..87da385a57a 100644 --- a/document/src/vespa/document/update/tensormodifyupdate.cpp +++ b/document/src/vespa/document/update/tensormodifyupdate.cpp @@ -25,19 +25,19 @@ IMPLEMENT_IDENTIFIABLE(TensorModifyUpdate, ValueUpdate); TensorModifyUpdate::TensorModifyUpdate() : _operation(Operation::MAX_NUM_OPERATIONS), - _operand() + _tensor() { } TensorModifyUpdate::TensorModifyUpdate(const TensorModifyUpdate &rhs) : _operation(rhs._operation), - _operand(rhs._operand->clone()) + _tensor(rhs._tensor->clone()) { } -TensorModifyUpdate::TensorModifyUpdate(Operation operation, std::unique_ptr<TensorFieldValue> &&operand) +TensorModifyUpdate::TensorModifyUpdate(Operation operation, std::unique_ptr<TensorFieldValue> &&tensor) : _operation(operation), - _operand(std::move(operand)) + _tensor(std::move(tensor)) { } @@ -47,7 +47,7 @@ TensorModifyUpdate & TensorModifyUpdate::operator=(const TensorModifyUpdate &rhs) { _operation = rhs._operation; - _operand.reset(rhs._operand->clone()); + _tensor.reset(rhs._tensor->clone()); return *this; } @@ -55,7 +55,7 @@ TensorModifyUpdate & TensorModifyUpdate::operator=(TensorModifyUpdate &&rhs) { _operation = rhs._operation; - _operand = std::move(rhs._operand); + _tensor = std::move(rhs._tensor); return *this; } @@ -69,7 +69,7 @@ TensorModifyUpdate::operator==(const ValueUpdate &other) const if (_operation != o._operation) { return false; } - if (*_operand != *o._operand) { + if (*_tensor != *o._tensor) { return false; } return true; @@ -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 operation with operand + // TODO: Apply operation with tensor auto newTensor = oldTensor->clone(); tensorFieldValue = std::move(newTensor); } else { @@ -129,17 +129,17 @@ TensorModifyUpdate::deserialize(const DocumentTypeRepo &repo, const DataType &ty throw DeserializeException(msg.str(), VESPA_STRLOC); } _operation = static_cast<Operation>(op); - auto operand = type.createFieldValue(); - if (operand->inherits(TensorFieldValue::classId)) { - _operand.reset(static_cast<TensorFieldValue *>(operand.release())); + auto tensor = type.createFieldValue(); + if (tensor->inherits(TensorFieldValue::classId)) { + _tensor.reset(static_cast<TensorFieldValue *>(tensor.release())); } else { std::string err = make_string( "Expected tensor field value, got a \"%s\" field " - "value.", operand->getClass().name()); + "value.", tensor->getClass().name()); throw IllegalStateException(err, VESPA_STRLOC); } VespaDocumentDeserializer deserializer(repo, stream, Document::getNewestSerializationVersion()); - deserializer.read(*_operand); + deserializer.read(*_tensor); } TensorModifyUpdate* diff --git a/document/src/vespa/document/update/tensormodifyupdate.h b/document/src/vespa/document/update/tensormodifyupdate.h index c95845aad05..fd89c9da47b 100644 --- a/document/src/vespa/document/update/tensormodifyupdate.h +++ b/document/src/vespa/document/update/tensormodifyupdate.h @@ -23,19 +23,19 @@ public: }; private: Operation _operation; - std::unique_ptr<TensorFieldValue> _operand; + std::unique_ptr<TensorFieldValue> _tensor; TensorModifyUpdate(); TensorModifyUpdate(const TensorModifyUpdate &rhs); ACCEPT_UPDATE_VISITOR; public: - TensorModifyUpdate(Operation operation, std::unique_ptr<TensorFieldValue> &&operand); + TensorModifyUpdate(Operation operation, std::unique_ptr<TensorFieldValue> &&tensor); ~TensorModifyUpdate() override; TensorModifyUpdate &operator=(const TensorModifyUpdate &rhs); TensorModifyUpdate &operator=(TensorModifyUpdate &&rhs); bool operator==(const ValueUpdate &other) const override; Operation getOperation() const { return _operation; } - const TensorFieldValue &getOperand() const { return *_operand; } + const TensorFieldValue &getTensor() const { return *_tensor; } void checkCompatibility(const Field &field) const override; bool applyTo(FieldValue &value) const override; void printXml(XmlOutputStream &xos) const override; |