blob: 92965b1e8bf77be29c82a3d6d70f1c92d949eb48 (
plain)
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
|
#pragma once
#include "../indexer/feature_decl.hpp"
#include "../base/mutex.hpp"
#include "../std/set.hpp"
#include "../std/utility.hpp"
#include "../std/vector.hpp"
#include "../std/noncopyable.hpp"
namespace df
{
struct FeatureInfo
{
FeatureInfo(FeatureID const & id)
: m_id(id), m_isOwner(false) {}
bool operator < (FeatureInfo const & other) const
{
if (m_id != other.m_id)
return m_id < other.m_id;
return m_isOwner < other.m_isOwner;
}
FeatureID m_id;
bool m_isOwner;
};
class MemoryFeatureIndex : private noncopyable
{
public:
void ReadFeaturesRequest(vector<FeatureInfo> & features, vector<size_t> & indexes);
void RemoveFeatures(vector<FeatureInfo> & features);
private:
threads::Mutex m_mutex;
set<FeatureID> m_features;
};
} // namespace df
|