00001 /****************************************************************************************************** 00002 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released * 00003 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file * 00004 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. * 00005 ******************************************************************************************************/ 00006 00007 #include "CallbackDocumentHash.h" 00008 #include "Document.h" 00009 #include "DocumentHashGenerator.h" 00010 #include "Logger.h" 00011 00012 DocumentHashGenerator::DocumentHashGenerator() 00013 { 00014 } 00015 00016 DocumentHash DocumentHashGenerator::generate (const Document &document) const 00017 { 00018 // LOG4CPP_INFO_S is below 00019 00020 // Get hash by letting functor iterate through Document 00021 CallbackDocumentHash ftor (document.documentAxesPointsRequired()); 00022 00023 Functor2wRet<const QString &, const Point &, CallbackSearchReturn> ftorWithCallback = functor_ret (ftor, 00024 &CallbackDocumentHash::callback); 00025 00026 document.iterateThroughCurvePointsAxes (ftorWithCallback); 00027 document.iterateThroughCurvesPointsGraphs (ftorWithCallback); 00028 00029 LOG4CPP_INFO_S ((*mainCat)) << "DocumentHashGenerator::generator result=" << ftor.hash().data (); 00030 00031 return ftor.hash (); 00032 }