107 lines
2.4 KiB
C++
107 lines
2.4 KiB
C++
/*
|
|
* This file is part of the Owl Positioning System (OwlPS) project.
|
|
* It is subject to the copyright notice and license terms in the
|
|
* COPYRIGHT.t2t file found in the top-level directory of this
|
|
* distribution and at
|
|
* http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
|
|
* No part of the OwlPS Project, including this file, may be copied,
|
|
* modified, propagated, or distributed except according to the terms
|
|
* contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
|
|
* distributed along with this file, either separately or by replacing
|
|
* this notice by the COPYRIGHT.t2t file's contents.
|
|
*/
|
|
|
|
|
|
#ifndef _OWLPS_POSITIONING_RESULTLIST_HH_
|
|
#define _OWLPS_POSITIONING_RESULTLIST_HH_
|
|
|
|
class Request ;
|
|
#include "result.hh"
|
|
|
|
#include <vector>
|
|
#include <ostream>
|
|
|
|
/// List of [results](@ref Result) of a single Request, computed by one
|
|
/// or more positioning algorithm
|
|
class ResultList
|
|
{
|
|
protected:
|
|
Request *request ;
|
|
std::vector<Result> results ;
|
|
|
|
public:
|
|
ResultList(const Request *_request = NULL,
|
|
const std::vector<Result> &_results = std::vector<Result>()):
|
|
request(const_cast<Request*>(_request)), results(_results) {}
|
|
ResultList(const ResultList &source):
|
|
request(source.request), results(source.results) {}
|
|
~ResultList(void) ;
|
|
|
|
/** @name Read accessors */
|
|
//@{
|
|
/// Checks if there is at least one Result in the list
|
|
bool empty(void) const ;
|
|
const Request* get_request(void) const ;
|
|
const std::vector<Result>& get_results(void) const ;
|
|
//@}
|
|
|
|
/** @name Write accessors */
|
|
//@{
|
|
void add(const Result &res) ;
|
|
//@}
|
|
|
|
/** @name Operators */
|
|
//@{
|
|
ResultList& operator=(const ResultList &source) ;
|
|
bool operator==(const ResultList &source) const ;
|
|
bool operator!=(const ResultList &source) const ;
|
|
//@}
|
|
|
|
/** @name Conversion accessors */
|
|
//@{
|
|
/// Converts to a CSV string
|
|
const std::string to_csv(void) const ;
|
|
//@}
|
|
|
|
/// Displays a ResultList
|
|
friend std::ostream& operator<<(std::ostream &os,
|
|
const ResultList &r) ;
|
|
} ;
|
|
|
|
|
|
|
|
/* *** Read accessors *** */
|
|
|
|
|
|
inline bool ResultList::empty() const
|
|
{
|
|
return results.empty() ;
|
|
}
|
|
|
|
|
|
inline const Request* ResultList::get_request() const
|
|
{
|
|
return request ;
|
|
}
|
|
|
|
|
|
inline const std::vector<Result>& ResultList::get_results(void) const
|
|
{
|
|
return results ;
|
|
}
|
|
|
|
|
|
|
|
|
|
/* *** Write accessors *** */
|
|
|
|
|
|
inline void ResultList::add(const Result &res)
|
|
{
|
|
results.push_back(res) ;
|
|
}
|
|
|
|
|
|
|
|
#endif // _OWLPS_POSITIONING_RESULTLIST_HH_
|