Sux
SearchablePrefixSums.hpp
Go to the documentation of this file.
1 /*
2  * Sux: Succinct data structures
3  *
4  * Copyright (C) 2019-2020 Stefano Marchini
5  *
6  * This library is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by the Free
8  * Software Foundation; either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * This library is free software; you can redistribute it and/or modify it under
12  * the terms of the GNU General Public License as published by the Free Software
13  * Foundation; either version 3, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
16  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
17  * PARTICULAR PURPOSE. See the GNU General Public License for more details.
18  *
19  * Under Section 7 of GPL version 3, you are granted additional permissions
20  * described in the GCC Runtime Library Exception, version 3.1, as published by
21  * the Free Software Foundation.
22  *
23  * You should have received a copy of the GNU General Public License and a copy of
24  * the GCC Runtime Library Exception along with this program; see the files
25  * COPYING3 and COPYING.RUNTIME respectively. If not, see
26  * <http://www.gnu.org/licenses/>.
27  */
28 
29 #pragma once
30 
31 #include <cstddef>
32 #include <cstdint>
33 
34 namespace sux::util {
35 
36 using namespace std;
37 
54 
55  public:
56  virtual ~SearchablePrefixSums() = default;
57 
63  virtual uint64_t prefix(size_t length) = 0;
64 
73  virtual void add(size_t idx, int64_t c) = 0;
74 
86  virtual size_t find(uint64_t *val) = 0;
87  size_t find(uint64_t val) { return find(&val); }
88 
100  virtual size_t compFind(uint64_t *val) = 0;
101  size_t compFind(uint64_t val) { return compFind(&val); }
102 
109  virtual void push(uint64_t val) = 0;
110 
115  virtual void pop() = 0;
116 
118  virtual size_t size() const = 0;
119 
121  virtual size_t bitCount() const = 0;
122 };
123 
124 } // namespace sux::util
sux::util
Definition: Expandable.hpp:37
sux::util::SearchablePrefixSums::find
size_t find(uint64_t val)
Definition: SearchablePrefixSums.hpp:87
sux::util::SearchablePrefixSums::compFind
size_t compFind(uint64_t val)
Definition: SearchablePrefixSums.hpp:101
sux::util::SearchablePrefixSums
Definition: SearchablePrefixSums.hpp:53