-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathAtomsIndex.hpp
39 lines (31 loc) · 1.08 KB
/
AtomsIndex.hpp
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
#ifndef LIBSETREPLACE_ATOMSINDEX_HPP_
#define LIBSETREPLACE_ATOMSINDEX_HPP_
#include <functional>
#include <memory>
#include <unordered_set>
#include <vector>
#include "IDTypes.hpp"
namespace SetReplace {
/** @brief AtomsIndex keeps references to tokens accessible by atoms, which is useful for matching.
*/
class AtomsIndex {
public:
/** @brief Creates an empty index.
* @param getAtomsVector datasource function that returns the list of atoms for a requested token.
*/
explicit AtomsIndex(const GetAtomsVectorFunc& getAtomsVector);
/** @brief Removes tokens with specified IDs from the index.
*/
void removeTokens(const std::vector<TokenID>& tokenIDs);
/** @brief Adds tokens with specified IDs to the index.
*/
void addTokens(const std::vector<TokenID>& tokenIDs);
/** @brief Returns the list of tokens containing a specified atom.
*/
std::unordered_set<TokenID> tokensContainingAtom(Atom atom) const;
private:
class Implementation;
std::shared_ptr<Implementation> implementation_;
};
} // namespace SetReplace
#endif // LIBSETREPLACE_ATOMSINDEX_HPP_