[Positioner] Add ResultList::get_result_for_algo()

This commit is contained in:
Matteo Cypriani 2014-05-12 14:58:59 -04:00
parent feb5a715fa
commit 52940bcfc3
2 changed files with 16 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include "resultlist.hh"
#include "request.hh"
#include "mobile.hh"
#include "posexcept.hh"
#include <sstream>
@ -32,6 +33,20 @@ ResultList::~ResultList()
/* *** Read accessors *** */
const Result& ResultList::get_result_for_algo(const string &algo) const
{
for (auto i = results.begin() ; i != results.end() ; ++i)
if (i->get_algorithm() == algo)
return *i ;
throw element_not_found("No results for algorithm \""+ algo +"\"") ;
}
/* *** Operators *** */

View File

@ -43,6 +43,7 @@ public:
bool empty(void) const ;
const Request* get_request(void) const ;
const std::vector<Result>& get_results(void) const ;
const Result& get_result_for_algo(const std::string &algo) const ;
//@}
/** @name Write accessors */