2009-05-29 17:02:20 +02:00
|
|
|
#ifndef _WRITEINDB_HH_
|
|
|
|
#define _WRITEINDB_HH_
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <sstream>
|
|
|
|
#include <string>
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <vector>
|
|
|
|
|
Incorporation de la dernière version de Julien
Extrait de son courriel :
« Par rapport à la précédente j'ai surtout corrigé des bugs. »
Note : la version du listener portable sur Fonera, envoyée en même temps
par Julien, viendra plus tard (le temps que je l'incorpore).
Détail des changements après analyse du code :
aggregator : correction de bogues.
positioning :
* Ajout d'un fichier de config format boost (cfg/config.cfg).
* Makefile : implantation des cibles "install" et "uninstall" ; la cible
"astyle" devient "style".
* accesspoint.{hh,cc}, area.cc, measurement.hh, point.{hh,cc},
referencepoint.{hh,cc} : cosmétique.
* owlps-positioning.c : correction de la lecture du fichier de config
(ajout d'une option permettant de spécifier un fichier alternatif).
* server.cc : essentiellement correction des requêtes.
* libowlps-positioning.{hh,cc} : passage de "unsigned long long" à
"uint64_t" comme type de retour de timeval_to_ms().
writeInDb :
* Ajout de la gestion d'un fichier de config.
* Ajout de deux scripts pour la BDD.
git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@96 785a6c6c-259e-4ff1-8b91-dc31627914f0
2009-07-01 15:39:58 +02:00
|
|
|
#include "../owlps-positioning/referencepoint.hh"
|
|
|
|
#include "../owlps-positioning/point.hh"
|
|
|
|
#include "../owlps-positioning/accesspoint.hh"
|
|
|
|
#include "../owlps-positioning/area.hh"
|
|
|
|
#include "../owlps-positioning/measurement.hh"
|
2009-05-29 17:02:20 +02:00
|
|
|
|
|
|
|
#include <postgresql/libpq-fe.h>
|
|
|
|
#include <boost/program_options.hpp>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
namespace po = boost::program_options;
|
|
|
|
|
|
|
|
class WriteInDb
|
|
|
|
{
|
|
|
|
|
|
|
|
private:
|
|
|
|
vector<ReferencePoint> reference_point_list;
|
|
|
|
vector<AccessPoint> access_point_list;
|
|
|
|
vector<Point> waypoint_list;
|
|
|
|
map<string, Area> area_list;
|
|
|
|
|
|
|
|
public:
|
|
|
|
WriteInDb() {};
|
|
|
|
~WriteInDb() {};
|
|
|
|
|
|
|
|
void makeReferencePointListFromFile(const string &filename, const bool);
|
|
|
|
void makeApListFromFile(const string &filename);
|
|
|
|
void makeTopologyFromFile(const string &filename);
|
|
|
|
void makeWaypointListFromFile(const string &filename);
|
|
|
|
|
|
|
|
void writeAccessPointToDb(PGconn*);
|
|
|
|
void writeWaypointToDb(PGconn*);
|
|
|
|
int writePointToDb(PGconn *conn, Point p);
|
|
|
|
void writeReferencePointToDb(PGconn*);
|
|
|
|
void writeTopologyToDb(PGconn*);
|
|
|
|
|
|
|
|
bool pointExists(const vector<ReferencePoint> &point_list, const Point &p) const ;
|
|
|
|
int pointIndex(const vector<ReferencePoint> &point_list, const Point &p) const ;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|