aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/vespa/document/datatype/collectiondatatype.cpp
blob: c9fdddb14b3d8fd5fcd2b4af1dba6ec2fb91e457 (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 Yahoo. 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