Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finished serialization backend, optimized search to only sort the top…
… N hits instead of the full list
- Loading branch information
Martin Dietze
committed
Apr 8, 2010
1 parent
2eb937d
commit c38b678
Showing
24 changed files
with
492 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "BinaryScoreTableSerializer.h" | ||
#include "PreSelectScoreTable.h" | ||
|
||
#include <boost/archive/binary_oarchive.hpp> | ||
#include <boost/archive/binary_iarchive.hpp> | ||
#include <boost/serialization/export.hpp> | ||
#include <boost/serialization/vector.hpp> | ||
|
||
#include <stdexcept> | ||
|
||
using namespace ImageSearch; | ||
|
||
BOOST_CLASS_EXPORT_GUID (PreSelectScoreTable, "PreSelectScoreTable") | ||
|
||
BinaryScoreTableSerializer::BinaryScoreTableSerializer (void) | ||
{ | ||
} | ||
|
||
BinaryScoreTableSerializer::~BinaryScoreTableSerializer (void) | ||
{ | ||
} | ||
|
||
void | ||
BinaryScoreTableSerializer::doSave (const ScoreTable *scoreTable, const std::string &fileName) | ||
{ | ||
std::ofstream ofs (fileName.c_str (), std::ios::out | std::ios::binary); | ||
boost::archive::binary_oarchive oa (ofs); | ||
oa << scoreTable; | ||
} | ||
|
||
ScoreTable * | ||
BinaryScoreTableSerializer::doLoad (const std::string &fileName) | ||
{ | ||
ScoreTable *result; | ||
std::ifstream ifs (fileName.c_str (), std::ios::in | std::ios::binary); | ||
if (!ifs) | ||
{ | ||
throw std::ios::failure ("error opening file " + fileName); | ||
} | ||
boost::archive::binary_iarchive ia (ifs); | ||
ia >> result; | ||
return result; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef IMAGE_SEARCH_SCORE_TABLE_BINARY_SERIALIZER_H | ||
#define IMAGE_SEARCH_SCORE_TABLE_BINARY_SERIALIZER_H | ||
|
||
#include "ScoreTableSerializer.h" | ||
|
||
namespace ImageSearch | ||
{ | ||
|
||
class BinaryScoreTableSerializer : public ScoreTableSerializer { | ||
public: | ||
BinaryScoreTableSerializer (void); | ||
virtual ~BinaryScoreTableSerializer (void); | ||
virtual void doSave (const ScoreTable *scoreTable, const std::string &fileName); | ||
virtual ScoreTable *doLoad (const std::string &fileName); | ||
}; | ||
|
||
}; | ||
|
||
#endif // IMAGE_SEARCH_SCORE_TABLE_BINARY_SERIALIZER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.