00001
00016 #if !defined(Elias_hpp)
00017 #define Eliass_hpp
00018
00019 #include <vector>
00020 #include <string>
00021
00022 using namespace std;
00023
00027 unsigned int techo_logb2(unsigned long x);
00028
00032 unsigned int piso_logb2(unsigned int x);
00033
00037 unsigned long pot2(unsigned int e);
00038
00043 string bin2ascii(string bs);
00044
00049 string vb2ascii(vector<bool> &vb);
00050
00054 string vb2bin(vector<bool> &vb);
00055
00059 string vb2str(vector<bool> &vb);
00060
00064 vector<bool> str2vb(string s);
00065
00069 void codifica_unario(unsigned long x, vector<bool> &vb);
00070
00074 unsigned long decodifica_unario(vector<bool> &vb);
00075
00079 void pone_un_entero(unsigned long x, unsigned int nbits, vector<bool> &vb);
00080
00084 unsigned long toma_un_entero(unsigned int nbits, vector<bool> &vb);
00085
00089 void codifica_elias_gama(unsigned int x, vector<bool> &vb);
00090
00094 unsigned long
00095 decodifica_elias_gama(vector<bool> &vb);
00096
00101 unsigned long
00102 lee_elias_gama(std::istream &is) throw(string);
00103
00108 unsigned long
00109 lee_elias_gama2(std::istream &is) throw(string);
00110
00116 void
00117 escribe_elias_gama(std::ostream &os, unsigned int n);
00118
00124 void
00125 escribe_elias_gama2(std::ostream &os, unsigned int n);
00126
00127
00135 unsigned int
00136 long_elias_gama(unsigned long n);
00137
00141 void codifica_binaria_minima(unsigned long x, unsigned int n, vector<bool> &vb);
00142
00146 unsigned long decodifica_binaria_minima(unsigned int n, vector<bool> &vb);
00147
00148 #endif