From 7f062c49e4d7abda275054e7a8a88efafdecc058 Mon Sep 17 00:00:00 2001 From: rjawor Date: Tue, 12 Nov 2013 16:58:31 +0100 Subject: [PATCH] hash generator stub --- concordia/hash_generator.cpp | 33 ++++++++++++++++++++++++++++++++ concordia/hash_generator.hpp | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 concordia/hash_generator.cpp create mode 100644 concordia/hash_generator.hpp diff --git a/concordia/hash_generator.cpp b/concordia/hash_generator.cpp new file mode 100644 index 0000000..2916f4b --- /dev/null +++ b/concordia/hash_generator.cpp @@ -0,0 +1,33 @@ +#include "concordia/hash_generator.hpp" +#include +#include +#include +#include +#include + + +HashGenerator::HashGenerator(const string & wordMapFilename) throw(ConcordiaException) { + _wordMapFilename = wordMapFilename; + if (boost::filesystem::exists(_wordMapFilename)) { + ifstream ifs(_wordMapFilename.c_str(), std::ios::binary); + boost::archive::binary_iarchive ia(ifs); + ia >> _wordMap; + + } +} + +HashGenerator::~HashGenerator() { +} + +vector HashGenerator::generateHash(const string & sentence) { + vector result; + return result; +} + +void HashGenerator::serializeWordMap() { + ofstream ofs(_wordMapFilename.c_str(), std::ios::binary); + boost::archive::binary_oarchive oa(ofs); + oa << _wordMap; +} + + diff --git a/concordia/hash_generator.hpp b/concordia/hash_generator.hpp new file mode 100644 index 0000000..588240a --- /dev/null +++ b/concordia/hash_generator.hpp @@ -0,0 +1,37 @@ +#ifndef HASH_GENERATOR_HDR +#define HASH_GENERATOR_HDR + +#include +#include +#include + +#include "concordia/concordia_config.hpp" + +/*! + Class for generating a sentence hash. + +*/ + +using namespace std; + +class HashGenerator { +public: + explicit HashGenerator(const string & wordMapFilename) throw(ConcordiaException); + + /*! Destructor. + */ + virtual ~HashGenerator(); + + vector generateHash(const string & sentence); + + void serializeWordMap(); + +private: + + map _wordMap; + + string _wordMapFilename; + +}; + +#endif