[Positioning] Get rid of STLport, complete Request
- Now use Boost.TR1 instead of STLport, for unordered_map. - Add operator=(), operator==(), operator!=() and a copy constructor to Request.
This commit is contained in:
parent
7c6492645d
commit
efac35a515
|
@ -18,15 +18,14 @@ CPPCHECK = cppcheck --enable=all
|
|||
DOXYGEN = doxygen
|
||||
|
||||
GXX = g++-4.4
|
||||
DEBUG = -g
|
||||
STLPORTGXXFLAGS = -I/usr/include/stlport -pthread -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
|
||||
#DEBUG = -g
|
||||
GXXFLAGS = $(DEBUG) -Wall -Wextra $(STLPORTGXXFLAGS)
|
||||
LD = $(GXX)
|
||||
LDFLAGS = -lm -lstlport
|
||||
LDFLAGS = -lm -lrt
|
||||
LIBS = -lpq -lboost_program_options-mt
|
||||
|
||||
TARGET = owlps-positioning
|
||||
HEADER = owlps-positioning.hh
|
||||
#HEADER = owlps-positioning.hh
|
||||
OBJ = posutil.o point3d.o referencepoint.o waypoint.o building.o \
|
||||
area.o wifidevice.o accesspoint.o mobile.o measurement.o \
|
||||
calibrationmeasurement.o request.o inputcsv.o stock.o
|
||||
|
@ -35,6 +34,7 @@ all: $(TARGET)
|
|||
|
||||
%: %.o
|
||||
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
%.o: %.cc $(HEADER)
|
||||
$(GXX) $(GXXFLAGS) -c $<
|
||||
|
||||
|
@ -81,7 +81,10 @@ uninstall:
|
|||
@$(RM) $(INSTALL_DIR)/$(TARGET)
|
||||
|
||||
style:
|
||||
@$(STYLE) $(OBJ:.o=.hh) $(OBJ:.o=.cc) inputmedium.hh
|
||||
@$(STYLE) \
|
||||
$(OBJ:.o=.hh) \
|
||||
$(OBJ:.o=.cc) \
|
||||
inputmedium.hh
|
||||
|
||||
check:
|
||||
@$(CPPCHECK) $(OBJ:.o=.hh) $(OBJ:.o=.cc) inputmedium.hh
|
||||
|
|
|
@ -33,9 +33,6 @@
|
|||
les Waypoint. Si oui, faut-il aussi les enlever des listes dans
|
||||
Stock ? (Pour l'instant ils ne sont pas dans Stock.)
|
||||
|
||||
- Request
|
||||
Constructeur par recopie, operator==(), etc.
|
||||
|
||||
- PosUtil
|
||||
Remplacer timespec_equals() par operator==(timespec, timespec) ?
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <unordered_map>
|
||||
#include <boost/tr1/unordered_map.hpp>
|
||||
|
||||
using namespace std ;
|
||||
using std::tr1::unordered_map ;
|
||||
|
|
|
@ -36,6 +36,14 @@ Request::Request(const Mobile *_mobile, const struct timespec &_timestamp,
|
|||
}
|
||||
|
||||
|
||||
Request::Request(const Request &source)
|
||||
{
|
||||
mobile = source.mobile ;
|
||||
timestamp = source.timestamp ;
|
||||
measurements = source.measurements ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Note that the value pointed by #mobile is not deleted.
|
||||
|
@ -68,6 +76,32 @@ void Request::clear()
|
|||
/* *** Operators *** */
|
||||
|
||||
|
||||
const Request& Request::operator=(const Request &source)
|
||||
{
|
||||
if (this == &source)
|
||||
return *this ;
|
||||
|
||||
mobile = source.mobile ;
|
||||
timestamp = source.timestamp ;
|
||||
measurements = source.measurements ;
|
||||
|
||||
return *this ;
|
||||
}
|
||||
|
||||
|
||||
bool Request::operator==(const Request &comp) const
|
||||
{
|
||||
if (this == &comp)
|
||||
return true ;
|
||||
|
||||
return
|
||||
mobile == comp.mobile &&
|
||||
PosUtil::timespec_equals(timestamp, comp.timestamp) &&
|
||||
measurements == comp.measurements ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ostream &operator<<(ostream &os, const Request &r)
|
||||
{
|
||||
// Timestamp
|
||||
|
|
|
@ -6,7 +6,7 @@ class Mobile ;
|
|||
#include "measurement.hh"
|
||||
|
||||
#include <ctime>
|
||||
#include <unordered_map>
|
||||
#include <boost/tr1/unordered_map.hpp>
|
||||
#include <ostream>
|
||||
|
||||
/// Represents a request sent by a Mobile
|
||||
|
@ -35,6 +35,8 @@ public:
|
|||
Request(const Mobile *_mobile, const struct timespec &_timestamp,
|
||||
const std::tr1::unordered_map<std::string, Measurement> &_measurements
|
||||
= std::tr1::unordered_map<std::string, Measurement>()) ;
|
||||
/// Copy constructor
|
||||
Request(const Request &source) ;
|
||||
|
||||
~Request(void) ; ///< Destructor
|
||||
|
||||
|
@ -61,6 +63,9 @@ public:
|
|||
|
||||
/** @name Operators */
|
||||
//@{
|
||||
const Request& operator=(const Request &source) ;
|
||||
bool operator==(const Request &comp) const ;
|
||||
bool operator!=(const Request &comp) const ;
|
||||
operator bool(void) const ; ///< Cast to bool operator
|
||||
//@}
|
||||
|
||||
|
@ -112,6 +117,12 @@ inline void Request::set_measurements(const std::tr1::unordered_map
|
|||
/* *** Operators *** */
|
||||
|
||||
|
||||
inline bool Request::operator!=(const Request &comp) const
|
||||
{
|
||||
return !(*this == comp) ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \em false if the Request is empty.
|
||||
* @return \em true if at least one attribute is initialised.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "mobile.hh"
|
||||
#include "accesspoint.hh"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <boost/tr1/unordered_map.hpp>
|
||||
|
||||
/// Storage class
|
||||
class Stock
|
||||
|
|
Loading…
Reference in New Issue