SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
 All Classes Namespaces Files Functions Variables Typedefs Friends
Classes | Namespaces | Defines | Functions
sdsl/include/sdsl/util.hpp File Reference

util.hpp contains some helper methods for int_vector and other stuff like demangle class names. More...

#include "bitmagic.hpp"
#include "typedefs.hpp"
#include "structure_tree.hpp"
#include <iosfwd>
#include <stdint.h>
#include <cassert>
#include <fstream>
#include <ctime>
#include <string>
#include <string.h>
#include <libgen.h>
#include <cstdlib>
#include <unistd.h>
#include <sstream>
#include <stdexcept>
#include <typeinfo>

Go to the source code of this file.

Classes

struct  sdsl::util::nullstream
struct  sdsl::util::nullstream::nullbuf
class  sdsl::util::_id_helper

Namespaces

namespace  sdsl
 Namespace for the succinct data structure library.
namespace  sdsl::util
 A namespace for helper functions.

Defines

#define SDSL_STR(x)   #x
#define SDSL_XSTR(s)   SDSL_STR(s)

Functions

void sdsl::util::set_verbose ()
std::string sdsl::util::basename (const std::string &file_name)
 Returns the basename of a file_name.
std::string sdsl::util::dirname (const std::string &file_name)
 Returns the directory of a file_name. Trailing / are removed.
template<class int_vector_type >
void sdsl::util::set_random_bits (int_vector_type &v, int seed=0)
 Sets all bits of the int_vector to pseudo-random bits.
template<class int_vector_type >
void sdsl::util::set_zero_bits (int_vector_type &v)
 Sets all bits of the int_vector to 0-bits.
template<class int_vector_type >
void sdsl::util::set_one_bits (int_vector_type &v)
 Sets all bits of the int_vector to 1-bits.
template<class int_vector_type >
void sdsl::util::bit_compress (int_vector_type &v)
 Bit compress the int_vector.
template<class int_vector_type , class size_type_class >
void sdsl::util::all_elements_mod (int_vector_type &v, size_type_class m)
 All elements of v modulo m.
template<class int_vector_type >
void sdsl::util::set_all_values_to_k (int_vector_type &v, uint64_t k)
 Set all entries of int_vector to value k.
template<class int_vector_type >
void sdsl::util::set_to_id (int_vector_type &v)
 Sets each entry of the numerical vector v at position $fi.
template<class int_vector_type >
int_vector_type::size_type sdsl::util::get_one_bits (const int_vector_type &v)
 Counts and returns the 1-bits an int_vector contains.
template<class int_vector_type >
int_vector_type::size_type sdsl::util::get_onezero_bits (const int_vector_type &v)
 Counts 10 bit pair occurencies.
template<class int_vector_type >
int_vector_type::size_type sdsl::util::get_zeroone_bits (const int_vector_type &v)
 Counts 01 bit pair occurencies.
template<class T >
bool sdsl::util::load_from_file (T &v, const char *file_name)
 Load a data structure from a file.
template<>
bool sdsl::util::load_from_file (void *&, const char *file_name)
template<class size_type_class >
bool sdsl::util::load_from_int_vector_buffer (unsigned char *&text, int_vector_file_buffer< 8, size_type_class > &text_buf)
bool sdsl::util::load_from_file (char *&v, const char *file_name)
 Specialization of load_from_file for a char array.
template<class T >
bool sdsl::util::store_to_file (const T &v, const char *file_name)
 Store a data structure to a file.
bool sdsl::util::store_to_file (const char *v, const char *file_name)
 Specialization of store_to_file for a char array.
template<uint8_t fixed_int_width, class size_type_class >
bool sdsl::util::store_to_file (const int_vector< fixed_int_width, size_type_class > &v, const char *file_name, bool write_fixed_as_variable=false)
 Specialization of store_to_file for int_vector.
std::string sdsl::util::demangle (const char *name)
 Demangle the class name of typeid(...).name()
std::string sdsl::util::demangle2 (const char *name)
 Demangle the class name of typeid(...).name() and remove the "sdsl::"-prefix, "unsigned int",...
template<class T >
std::string sdsl::util::class_name (const T &t)
template<class T >
T::size_type sdsl::util::get_size_in_bytes (const T &t)
 Get the size of a data structure in bytes.
template<class T >
double sdsl::util::get_size_in_mega_bytes (const T &t)
 Get the size of a data structure in mega bytes (MB).
template<class T >
size_t sdsl::util::write_member (const T &t, std::ostream &out, sdsl::structure_tree_node *v=NULL, std::string name="")
template<>
size_t sdsl::util::write_member< std::string > (const std::string &t, std::ostream &out, structure_tree_node *v, std::string name)
template<class T >
void sdsl::util::read_member (T &t, std::istream &in)
template<>
void sdsl::util::read_member< std::string > (std::string &t, std::istream &in)
uint64_t sdsl::util::get_pid ()
 Get the process id of the current process.
uint64_t sdsl::util::get_id ()
 Get a unique id inside the process.
template<typename T >
std::string sdsl::util::to_string (const T &t)
 Convert type to string.
template<typename T >
std::string sdsl::util::to_latex_string (const T &t)
std::string sdsl::util::to_latex_string (unsigned char c)
void sdsl::util::delete_all_files (tMSS &file_map)
 Delete all files in the file_map in the file system.
template<class T , class U >
void sdsl::util::assign (T &x, const U &y)
 Assigns the value x of type T to the value of y of type U.
template<class T >
void sdsl::util::assign (T &x, T &y)
 Swaps variables x and y.
template<class T >
void sdsl::util::clear (T &x)
 clear the space used by x
template<class S , class P >
void sdsl::util::swap_support (S &s1, S &s2, const P *p1, const P *p2)
 Swap support data structure and assign to new vector.
template<class S , class X >
void sdsl::util::init_support (S &s, const X *x)
 Initialise support data structure with.
template<format_type F, class X >
void sdsl::util::write_structure (const X &x, std::ostream &out)

Detailed Description

util.hpp contains some helper methods for int_vector and other stuff like demangle class names.

Author:
Simon Gog