9#ifndef INCLUDED_SDSL_CONSTRUCT
10#define INCLUDED_SDSL_CONSTRUCT
34template <
class int_vector>
39 if ((uint64_t)0 == text[i])
41 throw std::logic_error(std::string(
"Error: File \"") + file +
"\" contains zero symbol.");
48template <
class int_vector>
52 text[text.
size() - 1] = 0;
55template <
class t_index>
56void construct(t_index & idx, std::string file, uint8_t num_bytes = 0,
bool move_input =
false)
68template <
class t_index,
class t_data>
69void construct_im(t_index & idx, t_data && data, uint8_t num_bytes = 0)
87template <
class t_index>
91 typename t_index::index_category
index_tag;
96template <
class t_index>
100 if ((t_index::alphabet_category::WIDTH == 8 and num_bytes <= 1)
101 or (t_index::alphabet_category::WIDTH == 0 and num_bytes !=
'd'))
108 idx = t_index(text_buf.
begin(), text_buf.
end(), config.
dir);
120 idx = t_index(text_buf.
begin(), text_buf.
end(), config.
dir);
127template <
class t_index>
131 constexpr uint8_t width = t_index::alphabet_category::WIDTH;
154 std::copy(text.begin(), text.end(), text_mapper.begin());
155 text_mapper[text.size()] = 0;
170 construct_sa<t_index::alphabet_category::WIDTH>(config);
179 construct_bwt<t_index::alphabet_category::WIDTH>(config);
186 idx = t_index(config);
191 util::delete_all_files(config.
file_map);
196template <
class t_index, u
int8_t t_w
idth>
227 construct_sa<t_width>(config);
237 construct_lcp_PHI<t_width>(config);
244 idx = t_index(config);
249 util::delete_all_files(config.
file_map);
254template <
class t_index>
259 construct<t_index, 8>(idx, file, config, num_bytes, tag);
263 construct<t_index, 0>(idx, file, config, num_bytes, tag);
268template <
class t_index>
277 typename t_index::csa_type csa;
281 construct(csa, file, csa_config, num_bytes, csa_t);
296 if (t_index::alphabet_category::WIDTH == 8)
302 construct_lcp_PHI<t_index::alphabet_category::WIDTH>(config);
309 idx = t_index(config);
314 util::delete_all_files(config.
file_map);
A generic vector class for integers of width .
size_type size() const noexcept
The number of elements in the int_vector.
void resize(const size_type size)
Resize the int_vector in terms of elements.
static mm_event_proxy event(std::string const &name)
static int_vector_mapper< t_width > create(std::string const &key, cache_config &config)
construct_bwt.hpp contains a space and time efficient construction method for the Burrows and Wheeler...
construct_lcp.hpp contains a space and time efficient construction method for lcp arrays
construct_sa.hpp contains an interface to access suffix array construction algorithms
int_vector.hpp contains the sdsl::int_vector class.
int_vector_buffer.hpp contains the sdsl::int_vector_buffer class.
io.hpp contains some methods for reading/writing sdsl structures.
memory_tracking.hpp contains two function for allocating and deallocating memory
int remove(std::string const &name)
Remove the file with key name
std::string to_string(T const &t, int w=1)
Namespace for the succinct data structure library.
bool contains_no_zero_symbol(int_vector const &text, std::string const &file)
bool store_to_cache(T const &v, std::string const &key, cache_config &config, bool add_type_hash=false)
Stores the object v as a resource in the cache.
bool cache_file_exists(std::string const &key, cache_config const &config)
Checks if the resource specified by the key exists in the cache.
int remove(std::string const &)
Remove a file.
std::map< std::string, std::string > tMSS
std::string tmp_file(cache_config const &config, std::string name_part="")
Returns a name for a temporary file. I.e. the name was not used before.
std::string cache_file_name(std::string const &key, cache_config const &config)
Returns the file name of the resource.
std::string ram_file_name(std::string const &file)
Returns the corresponding RAM-file name for file.
void register_cache_file(std::string const &key, cache_config &config)
Register the existing resource specified by the key to the cache.
bool load_vector_from_file(t_int_vec &v, std::string const &file, uint8_t num_bytes=1, uint8_t max_int_width=64)
from disk.
void construct(t_index &idx, std::string file, uint8_t num_bytes=0, bool move_input=false)
void construct_lcp_semi_extern_PHI(cache_config &config)
Construct the LCP array (only for byte strings)
bool is_ram_file(std::string const &file)
Determines if the given file is a RAM-file.
bool store_to_file(T const &v, std::string const &file)
Store a data structure to a file.
uint64_t int_vector_size_type
void append_zero_symbol(int_vector &text)
void construct_im(t_index &idx, t_data &&data, uint8_t num_bytes=0)
Contains declarations and definitions of data structure concepts.
Helper class for construction process.
Helper classes to transform width=0 and width=8 to corresponding bwt key.
Helper classes to transform width=0 and width=8 to corresponding text key.
util.hpp contains some helper methods for int_vector and other stuff like demangle class names.