aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/engine/propertiesmap.cpp
blob: 48c95ba92b9f6a824c6a2436a674d471caae0152 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "propertiesmap.h"
#include <vespa/vespalib/stllike/hash_map.hpp>

namespace search::engine {

fef::Properties PropertiesMap::_emptyProperties;

PropertiesMap::PropertiesMap()
    : _propertiesMap()
{ }

PropertiesMap::PropertiesMap(uint32_t sz)
    : _propertiesMap(sz)
{ }

PropertiesMap::~PropertiesMap() = default;

fef::Properties &
PropertiesMap::lookupCreate(vespalib::stringref name)
{
    return _propertiesMap[name];
}

const fef::Properties &
PropertiesMap::lookup(vespalib::stringref name) const
{
    auto pos = _propertiesMap.find(name);
    if (pos == _propertiesMap.end()) {
        return _emptyProperties;
    }
    return pos->second;
}

}

VESPALIB_HASH_MAP_INSTANTIATE(vespalib::string, search::fef::Properties);