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