aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/slime/type_traits.h
blob: 10ac60b6534684ea2269072c1652a62bab9943d0 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/vespalib/data/slime/type.h>
#include <vespa/vespalib/data/memory.h>

namespace vespalib {
namespace slime {

// internal traits for data type types
template<typename T> struct TypeTraits {};

template<> struct TypeTraits<NIX> {
    static void assertIsCreatedEmpty() {}
};

template<> struct TypeTraits<BOOL> {
    using PassType = bool;
    using StoreType = PassType;
    static const bool unsetValue = false;
};

template<> struct TypeTraits<LONG> {
    using PassType = int64_t;
    using StoreType = PassType;
    static const int64_t unsetValue = 0;
};

template<> struct TypeTraits<DOUBLE> {
    using PassType = double;
    using StoreType = PassType;
    static const double unsetValue;
};

template<> struct TypeTraits<STRING> {
    using PassType = Memory;
    static const Memory unsetValue;
};

template<> struct TypeTraits<DATA> {
    using PassType = Memory;
    static const Memory unsetValue;
};

template<> struct TypeTraits<ARRAY> {
    static void assertIsCreatedEmpty() {}
};

template<> struct TypeTraits<OBJECT> {
    static void assertIsCreatedEmpty() {}
};

} // namespace vespalib::slime
} // namespace vespalib