aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/datatype/collectiondatatype.h
blob: a41a56bb51f68c615a973561a2b5481807bc5e0c (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
/**
 * \class document::CollectionDataType
 * \ingroup datatype
 *
 * \brief Data type used for collections of data with similar types.
 *
 * This contains common functionality for array and weighted set datatypes.
 */
#pragma once

#include "datatype.h"

namespace document {

class CollectionDataType : public DataType {
    const DataType *_nestedType;

protected:
    CollectionDataType(vespalib::stringref name, const DataType &nestedType) noexcept;
    CollectionDataType(vespalib::stringref name, const DataType &nestedType, int32_t id) noexcept;

public:
    CollectionDataType(const CollectionDataType&) = delete;
    CollectionDataType& operator=(const CollectionDataType&) = delete;
    ~CollectionDataType() override;

    bool equals(const DataType&) const noexcept override;
    const DataType &getNestedType() const noexcept { return *_nestedType; }
    const CollectionDataType * cast_collection() const noexcept override { return this; }
};

} // document