concordia-library/concordia/concordia_index.hpp

64 lines
2.0 KiB
C++
Raw Normal View History

2013-11-14 20:36:34 +01:00
#ifndef CONCORDIA_INDEX_HDR
#define CONCORDIA_INDEX_HDR
#include <boost/shared_ptr.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
2013-11-20 17:43:29 +01:00
#include <fstream>
#include <iostream>
#include <sstream>
#include "concordia/common/config.hpp"
#include "concordia/example.hpp"
2013-11-14 20:36:34 +01:00
#include "concordia/hash_generator.hpp"
#include "concordia/concordia_exception.hpp"
2013-11-29 16:19:49 +01:00
#include "build/libdivsufsort/include/divsufsort.h"
2013-11-14 20:36:34 +01:00
/*!
Class for creating and maintaining the index.
*/
using namespace std;
class ConcordiaIndex {
public:
explicit ConcordiaIndex(const string & hashedIndexFilePath,
const string & markersFilePath)
2013-11-14 20:36:34 +01:00
throw(ConcordiaException);
/*! Destructor.
*/
virtual ~ConcordiaIndex();
void addExample(
boost::shared_ptr<HashGenerator> hashGenerator,
boost::shared_ptr<vector<sauchar_t> > T,
boost::shared_ptr<vector<SUFFIX_MARKER_TYPE> > markers,
const Example & example);
2013-11-14 20:36:34 +01:00
void addAllExamples(
boost::shared_ptr<HashGenerator> hashGenerator,
boost::shared_ptr<vector<sauchar_t> > T,
boost::shared_ptr<vector<SUFFIX_MARKER_TYPE> > markers,
const boost::ptr_vector<Example > & examples);
2013-11-14 20:36:34 +01:00
boost::shared_ptr<vector<saidx_t> > generateSuffixArray(
boost::shared_ptr<HashGenerator> hashGenerator,
boost::shared_ptr<vector<sauchar_t> > T);
2013-11-14 20:36:34 +01:00
private:
// Add example to disk index and update RAM index.
void _addSingleExample(ofstream & hashedIndexFile,
ofstream & markersFile,
boost::shared_ptr<HashGenerator> hashGenerator,
boost::shared_ptr<std::vector<sauchar_t> > T,
boost::shared_ptr<vector<SUFFIX_MARKER_TYPE> > markers,
const Example & example);
2013-11-20 17:43:29 +01:00
2013-11-28 16:47:57 +01:00
string _hashedIndexFilePath;
string _markersFilePath;
2013-11-14 20:36:34 +01:00
};
#endif