From 02099a01350a41a99ec400e9b29df08a01d88979 Mon Sep 17 00:00:00 2001 From: Paul Baltescu Date: Tue, 4 Jun 2013 23:17:57 +0100 Subject: Serialize data structures. --- extractor/alignment.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'extractor/alignment.h') diff --git a/extractor/alignment.h b/extractor/alignment.h index 4596f92b..dc5a8b55 100644 --- a/extractor/alignment.h +++ b/extractor/alignment.h @@ -5,6 +5,10 @@ #include #include +#include +#include +#include +#include namespace fs = boost::filesystem; using namespace std; @@ -19,18 +23,23 @@ class Alignment { // Reads alignment from text file. Alignment(const string& filename); + // Creates empty alignment. + Alignment(); + // Returns the alignment for a given sentence. virtual vector> GetLinks(int sentence_index) const; - // Writes alignment to file in binary format. - void WriteBinary(const fs::path& filepath); - virtual ~Alignment(); - protected: - Alignment(); + bool operator==(const Alignment& alignment) const; private: + friend class boost::serialization::access; + + template void serialize(Archive& ar, unsigned int) { + ar & alignments; + } + vector>> alignments; }; -- cgit v1.2.3