9#ifndef INCLUDED_SDSL_CONSTRUCT
10#define INCLUDED_SDSL_CONSTRUCT
23template <
class int_vector>
28 if ((uint64_t)0 == text[i])
30 throw std::logic_error(std::string(
"Error: File \"") + file +
"\" contains zero symbol.");
37template <
class int_vector>
41 text[text.
size() - 1] = 0;
44template <
class t_index>
45void construct(t_index & idx, std::string file, uint8_t num_bytes = 0,
bool move_input =
false)
57template <
class t_index,
class t_data>
58void construct_im(t_index & idx, t_data && data, uint8_t num_bytes = 0)
76template <
class t_index>
80 typename t_index::index_category
index_tag;
85template <
class t_index>
89 if ((t_index::alphabet_category::WIDTH == 8 and num_bytes <= 1) or
90 (t_index::alphabet_category::WIDTH == 0 and num_bytes !=
'd'))
97 idx = t_index(text_buf.
begin(), text_buf.
end(), config.
dir);
109 idx = t_index(text_buf.
begin(), text_buf.
end(), config.
dir);
116template <
class t_index>
120 constexpr uint8_t width = t_index::alphabet_category::WIDTH;
143 std::copy(text.begin(), text.end(), text_mapper.begin());
144 text_mapper[text.size()] = 0;
160 if (!
cache_file_exists(KEY_BWT, config)) { construct_bwt<t_index::alphabet_category::WIDTH>(config); }
166 idx = t_index(config);
171 util::delete_all_files(config.
file_map);
176template <
class t_index, u
int8_t t_w
idth>
211 construct_lcp_PHI<t_width>(config);
218 idx = t_index(config);
223 util::delete_all_files(config.
file_map);
228template <
class t_index>
231 if (1 == num_bytes) { construct<t_index, 8>(idx, file, config, num_bytes, tag); }
234 construct<t_index, 0>(idx, file, config, num_bytes, tag);
239template <
class t_index>
248 typename t_index::csa_type csa;
252 construct(csa, file, csa_config, num_bytes, csa_t);
270 construct_lcp_PHI<t_index::alphabet_category::WIDTH>(config);
277 idx = t_index(config);
282 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(const std::string &name)
static int_vector_mapper< t_width > create(const std::string &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 remove(const std::string &name)
Remove the file with key name
std::string to_string(const T &t, int w=1)
Namespace for the succinct data structure library.
std::string cache_file_name(const std::string &key, const cache_config &config)
Returns the file name of the resource.
bool is_ram_file(const std::string &file)
Determines if the given file is a RAM-file.
std::map< std::string, std::string > tMSS
std::string ram_file_name(const std::string &file)
Returns the corresponding RAM-file name for file.
bool load_vector_from_file(t_int_vec &v, const std::string &file, uint8_t num_bytes=1, uint8_t max_int_width=64)
from disk.
std::string tmp_file(const cache_config &config, std::string name_part="")
Returns a name for a temporary file. I.e. the name was not used before.
bool contains_no_zero_symbol(const int_vector &text, const std::string &file)
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)
uint64_t int_vector_size_type
void register_cache_file(const std::string &key, cache_config &config)
Register the existing resource specified by the key to the cache.
bool store_to_file(const T &v, const std::string &file)
Store a data structure to a file.
bool cache_file_exists(const std::string &key, const cache_config &config)
Checks if the resource specified by the key exists in the cache.
bool store_to_cache(const T &v, const std::string &key, cache_config &config, bool add_type_hash=false)
Stores the object v as a resource in the cache.
int remove(const std::string &)
Remove a file.
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.