aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/update/addfieldpathupdate.h
blob: fec95123524f4187b00d2e2f99387824ace161ce (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "fieldpathupdate.h"

namespace document {

class ArrayFieldValue;

class AddFieldPathUpdate final : public FieldPathUpdate
{
public:
    /** For deserialization */
    AddFieldPathUpdate();
    AddFieldPathUpdate(const DataType& type, stringref fieldPath,
                       stringref whereClause, std::unique_ptr<ArrayFieldValue> values);
    AddFieldPathUpdate(AddFieldPathUpdate &&) noexcept = default;
    AddFieldPathUpdate & operator =(AddFieldPathUpdate &&) noexcept = default;
    AddFieldPathUpdate(const AddFieldPathUpdate &) = delete;
    AddFieldPathUpdate & operator =( const AddFieldPathUpdate &) = delete;
    ~AddFieldPathUpdate();

    bool operator==(const FieldPathUpdate& other) const override;
    void print(std::ostream& out, bool verbose, const std::string& indent) const override;
    const ArrayFieldValue & getValues() const { return *_values; }

    ACCEPT_UPDATE_VISITOR;
private:
    uint8_t getSerializedType() const override { return AddMagic; }
    void deserialize(const DocumentTypeRepo& repo, const DataType& type, nbostream & stream) override;
    std::unique_ptr<fieldvalue::IteratorHandler> getIteratorHandler(Document &, const DocumentTypeRepo &) const override;

    std::unique_ptr<ArrayFieldValue> _values;
};

}