depuraindice.cpp

Ir a la documentaciĆ³n de este archivo.
00001 // vim: set expandtab tabstop=8 shiftwidth=8 foldmethod=marker:
00012 #include <iostream>
00013 #include <iomanip>
00014 #include <list>
00015 #include <vector>
00016 #include <set>
00017 #include <fstream>
00018 #include <istream>
00019 #include <algorithm>
00020 #include <sys/time.h>
00021 #include <sys/stat.h>
00022 
00023 
00024 using namespace std;
00025 
00026 #include "Pos.hpp"
00027 #include "TrieSDisco.hpp"
00028 
00029 
00030 
00031 int main(int argc, char *argv[])
00032 {
00033 
00034         if (argc < 2) {
00035                 cerr << "Se esperaba indice por leer" << endl;
00036                 exit(1);
00037         }
00038 
00039         vector<Doc> docs;
00040         char relacion[MAXLURL];
00041         verificaNombre(argv[1], relacion);
00042 
00043         fstream is(argv[1], ios_base::in);
00044         verificaIndice(is);
00045 
00046         string cad;
00047         long hermano, hijo;
00048         set<Pos> *cpos = NULL;
00049         bool lee = true;
00050         string cmd = "";
00051         do {
00052                 if (lee) {
00053                         if (cpos != NULL) {
00054                                 delete cpos;
00055                                 cpos = NULL;
00056                         }
00057                         cad = leeCad(is);
00058                         hermano = leeNDesp(is);
00059                         hijo = leeNDesp(is);
00060                         cpos = leePos(is);
00061                 }
00062                 cout << "Cadena: " << cad << endl;
00063                 cout << "Hijo menor: " << hijo << endl;
00064                 cout << "Hermano mayor: " << hermano << endl;
00065                 cout << "Posiciones: " << *cpos << endl;
00066                 lee = false;
00067                 cin >> cmd;
00068                 if ((cmd == "hijo" || cmd == "i") && hijo > 0) {
00069                         is.seekg(hijo);
00070                         lee = true;
00071                 } else if ((cmd == "hermano" || cmd == "e") && hermano > 0) {
00072                         is.seekg(hermano);
00073                         lee = true;
00074                 }
00075 
00076         } while (cmd != "salir");
00077 
00078         is.close();
00079 
00080         return 0;
00081 }
00082 

Generado el Wed Jan 6 06:58:21 2010 para Mt77 por  doxygen 1.5.4