aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/datatype/collectiondatatype.cpp
blob: 68faea27b42a0550d61ba8905760eb81ae95fe75 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "collectiondatatype.h"

namespace document {

CollectionDataType::CollectionDataType(vespalib::stringref name,
                                       const DataType& nestedType) noexcept
    : DataType(name),
      _nestedType(&nestedType)
{ }

CollectionDataType::CollectionDataType(vespalib::stringref name,
                                       const DataType& nestedType,
                                       int32_t id) noexcept
    : DataType(name, id),
      _nestedType(&nestedType)
{ }

CollectionDataType::~CollectionDataType() = default;

bool
CollectionDataType::equals(const DataType& other) const noexcept
{
    if (!DataType::equals(other)) return false;
    const CollectionDataType * o = other.cast_collection();
    return o && _nestedType->equals(*o->_nestedType);
}

} // document