summaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/fef/objectstore.h
blob: b85ce527b8f1f43d80dd5f8102247d9527366376 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/hash_map.h>

namespace search {
namespace fef {

class Anything
{
public:
   typedef std::unique_ptr<Anything> UP;
   virtual ~Anything() { }
};

class IObjectStore
{
public:
    virtual ~IObjectStore() { }
    virtual void add(const vespalib::string & key, Anything::UP value) = 0;
    virtual const Anything * get(const vespalib::string & key) const = 0;
};

class ObjectStore : public IObjectStore
{
public:
    ObjectStore();
    ~ObjectStore();
    void add(const vespalib::string & key, Anything::UP value) override;
    const Anything * get(const vespalib::string & key) const override;
private:
    typedef vespalib::hash_map<vespalib::string, Anything *> ObjectMap;
    ObjectMap _objectMap;
};

}
}