Reconstitution du dépôt, étape 0

Backup du 15-05-2009, restauré pour effacer les mauvais commits de
Julien (mauvaise compréhension de SVN -> mauvaises utilisation).

Du coup j'en profite pour préparer le terrain : un petit coup de astyle
sur chaque fichier, pour que les diffs soient intéressants.
DÉSORMAIS, ASTYLE DEVRA ÊTRE UTILISÉ AVANT CHAQUE COMMIT !

Pour ce faire :
  astyle --style=gnu *.cc *.hh

git-svn-id: https://pif.pu-pm.univ-fcomte.fr/svn/loc@89 785a6c6c-259e-4ff1-8b91-dc31627914f0
This commit is contained in:
Matteo Cypriani 2009-05-29 11:46:49 +00:00
parent f1791d816a
commit 4784fb00df
15 changed files with 2218 additions and 1891 deletions

View File

@ -28,19 +28,59 @@ public:
AccessPoint(const string &addr = AP_DEFAULT_ADDR, const float &fidx = AP_DEFAULT_FRIIS_INDEX, const Point &coords = Point(), const unsigned int &f = AP_DEFAULT_FREQ, const float &antg = AP_DEFAULT_ANTENNA_GAIN, const float &outp = AP_DEFAULT_OUTPUT_POWER);
AccessPoint(const AccessPoint &ap);
~AccessPoint() {};
string getApAddr()const { return ap_addr; };
float getFriisIndex()const { return friis_index; };
Point getCoordinates()const { return coordinates; };
float getAntennaGain()const { return antenna_gain; };
unsigned int getFrequency()const { return freq; };
float getOutputPower()const { return output_power; };
void setApAddr(const string &addr) { ap_addr = addr; };
void setFriisIndex(const float &fidx) { friis_index = fidx; };
void setCoordinates(const Point &apc) { coordinates = apc; };
void setCoordinates(const float &x, const float &y, const float &z) { Point apc(x, y, z); coordinates = apc; };
void setFrequency(const unsigned int &f) { freq = f; };
void setAntennaGain(const float &antg) { antenna_gain = antg; };
void setOutputPower(const float &outp) {output_power = outp; };
string getApAddr()const
{
return ap_addr;
};
float getFriisIndex()const
{
return friis_index;
};
Point getCoordinates()const
{
return coordinates;
};
float getAntennaGain()const
{
return antenna_gain;
};
unsigned int getFrequency()const
{
return freq;
};
float getOutputPower()const
{
return output_power;
};
void setApAddr(const string &addr)
{
ap_addr = addr;
};
void setFriisIndex(const float &fidx)
{
friis_index = fidx;
};
void setCoordinates(const Point &apc)
{
coordinates = apc;
};
void setCoordinates(const float &x, const float &y, const float &z)
{
Point apc(x, y, z);
coordinates = apc;
};
void setFrequency(const unsigned int &f)
{
freq = f;
};
void setAntennaGain(const float &antg)
{
antenna_gain = antg;
};
void setOutputPower(const float &outp)
{
output_power = outp;
};
bool operator==(const AccessPoint &ap)const;
bool operator!=(const AccessPoint &ap)const;
AccessPoint operator=(const AccessPoint &ap);

View File

@ -26,21 +26,63 @@ public:
bool containsPoint(const Point &p)const ;
string getName()const { return area_name ; } ;
float getXmin()const { return x_min; } ;
float getXmax()const { return x_max; } ;
float getYmin()const { return y_min; } ;
float getYmax()const { return y_max; } ;
float getZmin()const { return z_min; } ;
float getZmax()const { return z_max; } ;
string getName()const
{
return area_name ;
} ;
float getXmin()const
{
return x_min;
} ;
float getXmax()const
{
return x_max;
} ;
float getYmin()const
{
return y_min;
} ;
float getYmax()const
{
return y_max;
} ;
float getZmin()const
{
return z_min;
} ;
float getZmax()const
{
return z_max;
} ;
void setName(const string &_name) { area_name = _name ; } ;
void setXmin(const float &v) { x_min = v; } ;
void setXmax(const float &v) { x_max = v; } ;
void setYmin(const float &v) { y_min = v; } ;
void setYmax(const float &v) { y_max = v; } ;
void setZmin(const float &v) { z_min = v; } ;
void setZmax(const float &v) { z_max = v; } ;
void setName(const string &_name)
{
area_name = _name ;
} ;
void setXmin(const float &v)
{
x_min = v;
} ;
void setXmax(const float &v)
{
x_max = v;
} ;
void setYmin(const float &v)
{
y_min = v;
} ;
void setYmax(const float &v)
{
y_max = v;
} ;
void setZmin(const float &v)
{
z_min = v;
} ;
void setZmax(const float &v)
{
z_max = v;
} ;
bool operator==(const Area &a)const ;
friend ostream &operator<<(ostream &os, const Area &a) ;

View File

@ -4,7 +4,8 @@
ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
{
#ifdef DEBUG_T
cout << "//--> ClientInfo::ClientInfo()" << endl ; fflush(stdout) ;
cout << "//--> ClientInfo::ClientInfo()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
client_ip = ip;
@ -17,7 +18,8 @@ ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
viterbi_V.resize(boost::extents[N-1][K]) ; // Allocation du tableau à la bonne taille (les cases sont initialisées à 0 automatiquement).
#ifdef DEBUG_T
cout << "//<-- ClientInfo::ClientInfo()" << endl ; fflush(stdout) ;
cout << "//<-- ClientInfo::ClientInfo()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -26,7 +28,8 @@ ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
ClientInfo::ClientInfo(const ClientInfo &c)
{
#ifdef DEBUG_T
cout << "//--> ClientInfo::ClientInfo(ClientInfo)" << endl ; fflush(stdout) ;
cout << "//--> ClientInfo::ClientInfo(ClientInfo)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
client_ip = c.client_ip ;
@ -39,7 +42,8 @@ ClientInfo::ClientInfo(const ClientInfo &c)
viterbi_V = c.viterbi_V ; // Copie du contenu de c.viterbi_V dans viterbi_V.
#ifdef DEBUG_T
cout << "//<-- ClientInfo::ClientInfo(ClientInfo)" << endl ; fflush(stdout) ;
cout << "//<-- ClientInfo::ClientInfo(ClientInfo)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -48,14 +52,16 @@ ClientInfo::ClientInfo(const ClientInfo &c)
ClientInfo::~ClientInfo()
{
#ifdef DEBUG_T
cout << "//--> ClientInfo::~ClientInfo()" << endl ; fflush(stdout) ;
cout << "//--> ClientInfo::~ClientInfo()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
viterbi_Eprevious.clear();
viterbi_Ecurrent.clear();
#ifdef DEBUG_T
cout << "//<-- ClientInfo::~ClientInfo()" << endl ; fflush(stdout) ;
cout << "//<-- ClientInfo::~ClientInfo()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -64,7 +70,8 @@ ClientInfo::~ClientInfo()
ClientInfo ClientInfo::operator=(const ClientInfo &c)
{
#ifdef DEBUG_T
cout << "//--> ClientInfo::operator=()" << endl ; fflush(stdout) ;
cout << "//--> ClientInfo::operator=()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
if (this == &c)
@ -80,7 +87,8 @@ ClientInfo ClientInfo::operator=(const ClientInfo &c)
viterbi_V = c.viterbi_V ; // Copie du contenu de c.viterbi_V dans viterbi_V.
#ifdef DEBUG_T
cout << "//<-- ClientInfo::operator=()" << endl ; fflush(stdout) ;
cout << "//<-- ClientInfo::operator=()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return *this ;
@ -91,7 +99,8 @@ ClientInfo ClientInfo::operator=(const ClientInfo &c)
bool ClientInfo::operator==(const ClientInfo &c)
{
#ifdef DEBUG_T
cout << "//--> ClientInfo::operator==()" << endl ; fflush(stdout) ;
cout << "//--> ClientInfo::operator==()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
if (this == &c)
@ -115,7 +124,8 @@ bool ClientInfo::operator==(const ClientInfo &c)
return true ;
#ifdef DEBUG_T
cout << "//<-- ClientInfo::operator==()" << endl ; fflush(stdout) ;
cout << "//<-- ClientInfo::operator==()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -124,7 +134,8 @@ bool ClientInfo::operator==(const ClientInfo &c)
void ClientInfo::print_viterbi_V() const
{
#ifdef DEBUG_T
cout << "//--> ClientInfo::print_viterbi_V()" << endl ; fflush(stdout) ;
cout << "//--> ClientInfo::print_viterbi_V()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
for (float_index n=0 ; n < viterbi_V.shape()[0] ; n++)
@ -135,6 +146,7 @@ void ClientInfo::print_viterbi_V() const
}
#ifdef DEBUG_T
cout << "//<-- ClientInfo::print_viterbi_V()" << endl ; fflush(stdout) ;
cout << "//<-- ClientInfo::print_viterbi_V()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}

View File

@ -43,11 +43,26 @@ public:
ClientInfo operator=(const ClientInfo &c) ;
bool operator==(const ClientInfo &c) ;
float getAntennaGain()const { return antenna_gain; };
vector<Point>& getRef_viterbi_Ecurrent() { return viterbi_Ecurrent; } ;
vector<Point>& getRef_viterbi_Eprevious() { return viterbi_Eprevious; } ;
unsigned int& getRef_viterbi_iteration() { return viterbi_iteration ; } ;
float_array& getRef_viterbi_V() { return viterbi_V; } ;
float getAntennaGain()const
{
return antenna_gain;
};
vector<Point>& getRef_viterbi_Ecurrent()
{
return viterbi_Ecurrent;
} ;
vector<Point>& getRef_viterbi_Eprevious()
{
return viterbi_Eprevious;
} ;
unsigned int& getRef_viterbi_iteration()
{
return viterbi_iteration ;
} ;
float_array& getRef_viterbi_V()
{
return viterbi_V;
} ;
void print_viterbi_V() const ;
};

View File

@ -17,14 +17,38 @@ protected:
vector<int> ss_list;
public:
Measurement(const string &ma = "ff:ff:ff:ff:ff:ff", const float &avg = 0, const vector<int> &ssl = vector<int>()) { mac_addr = ma; average_ss = avg, ss_list = ssl; };
Measurement(const Measurement &m) { mac_addr = m.mac_addr; average_ss = m.average_ss; ss_list = m.ss_list; };
~Measurement() { ss_list.clear(); };
vector<int> getSsList()const { return ss_list; };
float getAverage()const { return average_ss; };
string getMacAddr()const { return mac_addr; };
Measurement(const string &ma = "ff:ff:ff:ff:ff:ff", const float &avg = 0, const vector<int> &ssl = vector<int>())
{
mac_addr = ma;
average_ss = avg, ss_list = ssl;
};
Measurement(const Measurement &m)
{
mac_addr = m.mac_addr;
average_ss = m.average_ss;
ss_list = m.ss_list;
};
~Measurement()
{
ss_list.clear();
};
vector<int> getSsList()const
{
return ss_list;
};
float getAverage()const
{
return average_ss;
};
string getMacAddr()const
{
return mac_addr;
};
void addSsValue(const int &ssv);
void setMacAddr(const string &ma) { mac_addr = ma; };
void setMacAddr(const string &ma)
{
mac_addr = ma;
};
float getSsSquareDistance(const float &ss)const;
friend ostream &operator<<(ostream &os, const Measurement &m);
};

View File

@ -14,28 +14,88 @@ protected:
float z;
public:
Point(const float &_x = 0, const float &_y = 0, const float &_z = 0) { x = _x; y = _y; z = _z; } ;
Point(const Point &p) { x = p.x; y = p.y; z = p.z; } ;
Point(const float c[3]) { x = c[0] ; y = c[1] ; z = c[2] ; } ;
Point(const float &_x = 0, const float &_y = 0, const float &_z = 0)
{
x = _x;
y = _y;
z = _z;
} ;
Point(const Point &p)
{
x = p.x;
y = p.y;
z = p.z;
} ;
Point(const float c[3])
{
x = c[0] ;
y = c[1] ;
z = c[2] ;
} ;
~Point() {};
float getX()const { return x; };
float getY()const { return y; };
float getZ()const { return z; };
void setX(const float &_x) { x = _x; };
void setY(const float &_y) { y = _y; };
void setZ(const float &_z) { z = _z; };
float squareDistance(const Point &p)const { return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)); };
float squareDistance(const float &mx, const float &my, const float &mz)const { return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)); };
float distance(const Point &p)const { return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z))); };
float distance(const float &mx, const float &my, const float &mz)const { return sqrt(((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz))); };
float getX()const
{
return x;
};
float getY()const
{
return y;
};
float getZ()const
{
return z;
};
void setX(const float &_x)
{
x = _x;
};
void setY(const float &_y)
{
y = _y;
};
void setZ(const float &_z)
{
z = _z;
};
float squareDistance(const Point &p)const
{
return ((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z));
};
float squareDistance(const float &mx, const float &my, const float &mz)const
{
return ((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz));
};
float distance(const Point &p)const
{
return sqrt(((x-p.x)*(x-p.x))+((y-p.y)*(y-p.y))+((z-p.z)*(z-p.z)));
};
float distance(const float &mx, const float &my, const float &mz)const
{
return sqrt(((x-mx)*(x-mx))+((y-my)*(y-my))+((z-mz)*(z-mz)));
};
Point operator=(const Point &p) ;
bool operator==(const Point &p) const {return ((x == p.x) && (y == p.y) && (z == p.z)) ;} ;
bool operator!=(const Point &p) const {return !(*this == p) ;} ;
bool operator==(const Point &p) const
{
return ((x == p.x) && (y == p.y) && (z == p.z)) ;
} ;
bool operator!=(const Point &p) const
{
return !(*this == p) ;
} ;
bool operator<(const Point &p) const ;
bool operator>(const Point &p) const {return (p < *this) ;} ;
bool operator<=(const Point &p) const {return (*this < p || *this == p) ;} ;
bool operator>=(const Point &p) const {return (p <= *this) ;} ;
bool operator>(const Point &p) const
{
return (p < *this) ;
} ;
bool operator<=(const Point &p) const
{
return (*this < p || *this == p) ;
} ;
bool operator>=(const Point &p) const
{
return (p <= *this) ;
} ;
friend ostream &operator<<(ostream & os, const Point &p);
};

View File

@ -15,16 +15,40 @@ protected:
vector<Measurement> measurement_list;
public:
ReferencePoint(const float &x = 0, const float &y = 0, const float &z = 0) { coordinates.setX(x); coordinates.setY(y); coordinates.setZ(z); };
ReferencePoint(const ReferencePoint &rp) { coordinates = rp.coordinates; measurement_list = rp.measurement_list; };
ReferencePoint(const Point &c) { coordinates = c; };
~ReferencePoint() { measurement_list.clear(); };
ReferencePoint(const float &x = 0, const float &y = 0, const float &z = 0)
{
coordinates.setX(x);
coordinates.setY(y);
coordinates.setZ(z);
};
ReferencePoint(const ReferencePoint &rp)
{
coordinates = rp.coordinates;
measurement_list = rp.measurement_list;
};
ReferencePoint(const Point &c)
{
coordinates = c;
};
~ReferencePoint()
{
measurement_list.clear();
};
float getSsSquareDistance(const vector<Measurement> &m)const;
Point getCoordinates()const { return coordinates; };
Point getCoordinates()const
{
return coordinates;
};
void addMeasurement(const string &mac_a, const int &value);
void setCoordinates(const Point &p) { coordinates = p; };
vector<Measurement> getMeasurementList() const { return measurement_list; } ;
void setCoordinates(const Point &p)
{
coordinates = p;
};
vector<Measurement> getMeasurementList() const
{
return measurement_list;
} ;
bool getPowerForAp(const string &ap_mac, float *p) const ;
ReferencePoint operator=(const ReferencePoint &rp);

View File

@ -216,7 +216,8 @@ inline vector<string> extractReferencePointInfoFromBuffer(const string &buffer_i
Server::Server(const string &ap_file, const string &ref_pt_file, const string &ip_addr, const int &listen_port)
{
#ifdef DEBUG_T
cout << "//--> Server::Server()" << endl ; fflush(stdout) ;
cout << "//--> Server::Server()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
/* Open socket */
@ -248,7 +249,8 @@ Server::Server(const string &ap_file, const string &ref_pt_file, const string &i
makeApListFromFile(ap_file.c_str()) ; // Initialisation de "access_point_list".
#ifdef DEBUG_T
cout << "//<-- Server::Server()" << endl ; fflush(stdout) ;
cout << "//<-- Server::Server()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -257,7 +259,8 @@ Server::Server(const string &ap_file, const string &ref_pt_file, const string &i
Server::~Server()
{
#ifdef DEBUG_T
cout << "//--> Server::~Server()" << endl ; fflush(stdout) ;
cout << "//--> Server::~Server()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
close(sockListen);
@ -267,7 +270,8 @@ Server::~Server()
client_list.clear();
#ifdef DEBUG_T
cout << "//<-- Server::~Server()" << endl ; fflush(stdout) ;
cout << "//<-- Server::~Server()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -294,7 +298,8 @@ int Server::receive_data()
map<string, Area> Server::inWhichAreas(const Point &p)
{
#ifdef DEBUG_T
cout << "//--> Server::inWhichAreas()" << endl ; fflush(stdout) ;
cout << "//--> Server::inWhichAreas()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
map<string, Area> areas ;
@ -304,7 +309,8 @@ map<string, Area> Server::inWhichAreas(const Point &p)
areas.insert(make_pair(it->first, it->second)) ;
#ifdef DEBUG_T
cout << "//<-- Server::inWhichAreas()" << endl ; fflush(stdout) ;
cout << "//<-- Server::inWhichAreas()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return areas ;
@ -317,7 +323,8 @@ map<string, Area> Server::inWhichAreas(const Point &p)
bool Server::inTheSameArea(const Point &p1, const Point &p2)
{
#ifdef DEBUG_T
cout << "//--> Server::inTheSameArea()" << endl ; fflush(stdout) ;
cout << "//--> Server::inTheSameArea()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
map<string, Area> // Liste des zones comportant les points p1 et p2 :
@ -338,7 +345,8 @@ bool Server::inTheSameArea(const Point &p1, const Point &p2)
if (zones1.size() == 0 || zones2.size() == 0) // Si aucune zone ne contient p1 ou p2,
{
#ifdef DEBUG_T
cout << "//<-- Server::inTheSameArea()" << endl ; fflush(stdout) ;
cout << "//<-- Server::inTheSameArea()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return false ; // on quitte.
@ -349,13 +357,15 @@ bool Server::inTheSameArea(const Point &p1, const Point &p2)
if (it1->second == it2->second) // Si les deux zones sont identiques,
{
#ifdef DEBUG_T
cout << "//<-- Server::inTheSameArea()" << endl ; fflush(stdout) ;
cout << "//<-- Server::inTheSameArea()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return true ; // p1 et p2 sont dans la même zone.
}
#ifdef DEBUG_T
cout << "//<-- Server::inTheSameArea()" << endl ; fflush(stdout) ;
cout << "//<-- Server::inTheSameArea()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return false ;
@ -369,7 +379,8 @@ bool Server::inTheSameArea(const Point &p1, const Point &p2)
vector<Point> Server::areaConnection(const Area &z1, const Area &z2)
{
#ifdef DEBUG_T
cout << "//--> Server::areaConnection(Area&, Area&)" << endl ; fflush(stdout) ;
cout << "//--> Server::areaConnection(Area&, Area&)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
vector<Point> points ;
@ -382,7 +393,8 @@ vector<Point> Server::areaConnection(const Area &z1, const Area &z2)
}
#ifdef DEBUG_T
cout << "//<-- Server::areaConnection(Area&, Area&)" << endl ; fflush(stdout) ;
cout << "//<-- Server::areaConnection(Area&, Area&)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return points ;
@ -396,7 +408,8 @@ vector<Point> Server::areaConnection(const Area &z1, const Area &z2)
vector<Point> Server::areaConnection(const Area &z)
{
#ifdef DEBUG_T
cout << "//--> Server::areaConnection(Area&)" << endl ; fflush(stdout) ;
cout << "//--> Server::areaConnection(Area&)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
vector<Point> points ;
@ -409,7 +422,8 @@ vector<Point> Server::areaConnection(const Area &z)
}
#ifdef DEBUG_T
cout << "//<-- Server::areaConnection(Area&)" << endl ; fflush(stdout) ;
cout << "//<-- Server::areaConnection(Area&)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return points ;
@ -422,7 +436,8 @@ vector<Point> Server::areaConnection(const Area &z)
float Server::distanceTopology(const Point &p1, const Point &p2)
{
#ifdef DEBUG_T
cout << "//--> Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//--> Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
map<string, Area>
@ -436,7 +451,8 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
#endif // DEBUG_2
#ifdef DEBUG_T
cout << "//<-- Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return -1 ; // on quitte.
@ -457,7 +473,8 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
#endif // DEBUG_2
#ifdef DEBUG_T
cout << "//<-- Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return p1.distance(p2) ; // la distance entre eux est la distance euclidienne.
@ -482,7 +499,8 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
}
#ifdef DEBUG_T
cout << "//<-- Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return dist ;
@ -505,7 +523,8 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
if (wp_z1.size() == 0 || wp_z2.size() == 0) // Si l'une des deux zones ne comporte aucun point de passage,
{
#ifdef DEBUG_T
cout << "//<-- Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return -1 ; // on quitte (ceci ne devrait jamais se produire).
}
@ -531,7 +550,8 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
if (i1 >= wp_z1.size()) // Si on a parcouru tout le tableau sans trouver de chemin,
{
#ifdef DEBUG_T
cout << "//<-- Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return -1 ; // on quitte.
}
@ -576,7 +596,8 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
}
#ifdef DEBUG_T
cout << "//<-- Server::distanceTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::distanceTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return dist ;
@ -589,13 +610,15 @@ float Server::distanceTopology(const Point &p1, const Point &p2)
inline bool Server::pointExists(const float &x, const float &y, const float &z) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointExists(&float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
bool ret = pointExists(reference_point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointExists(&float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -608,13 +631,15 @@ inline bool Server::pointExists(const float &x, const float &y, const float &z)
inline bool Server::pointExists(const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointExists(&Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
bool ret = pointExists(reference_point_list, p) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointExists(&Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -626,13 +651,15 @@ inline bool Server::pointExists(const Point &p) const
inline bool Server::pointExists(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointExists(&vector<ReferencePoint>, &float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
bool ret = pointExists(point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -644,13 +671,15 @@ inline bool Server::pointExists(const vector<ReferencePoint> &point_list, const
inline bool Server::pointExists(const vector<ReferencePoint> &point_list, const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
bool ret = (pointIndex(point_list, p) != -1) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointExists(&vector<ReferencePoint>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -661,13 +690,15 @@ inline bool Server::pointExists(const vector<ReferencePoint> &point_list, const
inline int Server::pointIndex(const float &x, const float &y, const float &z) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointIndex(&float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int ret = pointIndex(reference_point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -678,13 +709,15 @@ inline int Server::pointIndex(const float &x, const float &y, const float &z) co
inline int Server::pointIndex(const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointIndex(&Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int ret = pointIndex(reference_point_list, p) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -695,13 +728,15 @@ inline int Server::pointIndex(const Point &p) const
inline int Server::pointIndex(const vector<ReferencePoint> &point_list, const float &x, const float &y, const float &z) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointIndex(&vector<ReferencePoint>, &float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int ret = pointIndex(point_list, Point(x, y, z)) ;
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &float, &float, &float)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &float, &float, &float)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -712,7 +747,8 @@ inline int Server::pointIndex(const vector<ReferencePoint> &point_list, const fl
inline int Server::pointIndex(const vector<ReferencePoint> &point_list, const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
@ -721,13 +757,15 @@ inline int Server::pointIndex(const vector<ReferencePoint> &point_list, const Po
if (p == point_list[i].getCoordinates())
{
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return i ;
}
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&vector<ReferencePoint>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return -1 ; // Point non trouvé
@ -751,20 +789,23 @@ inline int Server::pointIndex(const Point *point_tab, unsigned int &size, const
inline int Server::pointIndex(const vector<Point> &point_list, const Point &p) const
{
#ifdef DEBUG_T
cout << "//--> Server::pointIndex(&vector<Point>, &Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::pointIndex(&vector<Point>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
for (unsigned int i = 0 ; i < point_list.size() ; i++)
if (point_list[i] == p)
{
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<Point>, &Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&vector<Point>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return i ;
}
#ifdef DEBUG_T
cout << "//<-- Server::pointIndex(&vector<Point>, &Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::pointIndex(&vector<Point>, &Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return -1 ;
@ -775,7 +816,8 @@ inline int Server::pointIndex(const vector<Point> &point_list, const Point &p) c
bool Server::apExists(const string &ap_addr)const
{
#ifdef DEBUG_T
cout << "//--> Server::apExists()" << endl ; fflush(stdout) ;
cout << "//--> Server::apExists()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
string str;
@ -789,14 +831,16 @@ bool Server::apExists(const string &ap_addr)const
if (str == ap_addr)
{
#ifdef DEBUG_T
cout << "//<-- Server::apExists()" << endl ; fflush(stdout) ;
cout << "//<-- Server::apExists()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return true ;
}
}
#ifdef DEBUG_T
cout << "//<-- Server::apExists()" << endl ; fflush(stdout) ;
cout << "//<-- Server::apExists()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return false ;
@ -807,7 +851,8 @@ bool Server::apExists(const string &ap_addr)const
unsigned int Server::apIndex(const string &ap_addr)const
{
#ifdef DEBUG_T
cout << "//--> Server::apIndex()" << endl ; fflush(stdout) ;
cout << "//--> Server::apIndex()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
@ -822,14 +867,16 @@ unsigned int Server::apIndex(const string &ap_addr)const
if (str == ap_addr)
{
#ifdef DEBUG_T
cout << "//<-- Server::apIndex()" << endl ; fflush(stdout) ;
cout << "//<-- Server::apIndex()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return i;
}
}
#ifdef DEBUG_T
cout << "//<-- Server::apIndex()" << endl ; fflush(stdout) ;
cout << "//<-- Server::apIndex()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return 0; // Should never happen
@ -860,7 +907,8 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const
{
#ifdef DEBUG_T
cout << "//--> Server::getkClosestInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::getkClosestInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int i, j, min_idx;
@ -945,7 +993,8 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
#endif // DEBUG
#ifdef DEBUG_T
cout << "//<-- Server::getkClosestInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::getkClosestInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return points_vector;
@ -956,13 +1005,15 @@ vector<Point> Server::getkClosestInSs(const vector<Measurement> &m, const unsign
Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k)const
{
#ifdef DEBUG_T
cout << "//--> Server::getkWeightedInSs(&vector<Measurement>, &unsigned int)" << endl ; fflush(stdout) ;
cout << "//--> Server::getkWeightedInSs(&vector<Measurement>, &unsigned int)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
Point ret = getkWeightedInSs(m, k, NULL) ;
#ifdef DEBUG_T
cout << "//<-- Server::getkWeightedInSs(&vector<Measurement>, &unsigned int)" << endl ; fflush(stdout) ;
cout << "//<-- Server::getkWeightedInSs(&vector<Measurement>, &unsigned int)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -975,7 +1026,8 @@ Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int
Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int &k, const Point *point_ignored)const
{
#ifdef DEBUG_T
cout << "//--> Server::getkWeightedInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
cout << "//--> Server::getkWeightedInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int i, j;
@ -1031,7 +1083,8 @@ Point Server::getkWeightedInSs(const vector<Measurement> &m, const unsigned int
ret.setZ(z);
#ifdef DEBUG_T
cout << "//<-- Server::getkWeightedInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ; fflush(stdout) ;
cout << "//<-- Server::getkWeightedInSs(&vector<Measurement>, &unsigned int, *Point)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret;
@ -1042,7 +1095,8 @@ return ret;
Point Server::kPointsAverage(const vector<Point> &vp)const
{
#ifdef DEBUG_T
cout << "//--> Server::kPointsAverage()" << endl ; fflush(stdout) ;
cout << "//--> Server::kPointsAverage()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int i;
@ -1060,7 +1114,8 @@ Point Server::kPointsAverage(const vector<Point> &vp)const
p.setZ(z / (float) vp.size());
#ifdef DEBUG_T
cout << "//<-- Server::kPointsAverage()" << endl ; fflush(stdout) ;
cout << "//<-- Server::kPointsAverage()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return p;
@ -1071,7 +1126,8 @@ return p;
Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
{
#ifdef DEBUG_T
cout << "//--> Server::fbcm()" << endl ; fflush(stdout) ;
cout << "//--> Server::fbcm()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
Point ret(0, 0, 0);
@ -1125,7 +1181,8 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
centres.clear();
#ifdef DEBUG_T
cout << "//<-- Server::fbcm()" << endl ; fflush(stdout) ;
cout << "//<-- Server::fbcm()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
/* Return position */
@ -1136,7 +1193,8 @@ Point Server::fbcm(const vector<Measurement> &m, const int &client_idx)const
Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> friis_idx_list, const float &z)const
{
#ifdef DEBUG_T
cout << "//--> Server::fbcm_friis()" << endl ; fflush(stdout) ;
cout << "//--> Server::fbcm_friis()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
Point ret(0, 0, 0);
@ -1197,7 +1255,8 @@ Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> frii
//cout << "RESULTAT DU FRBHM ---> " << ret << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::fbcm_friis()" << endl ; fflush(stdout) ;
cout << "//<-- Server::fbcm_friis()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
/* Return position */
@ -1208,7 +1267,8 @@ Point Server::fbcm_friis( const vector<Measurement> &m, const vector<float> frii
Point Server::interlink(const vector<Measurement> &m, const int &client_idx)const
{
#ifdef DEBUG_T
cout << "//--> Server::interlink()" << endl ; fflush(stdout) ;
cout << "//--> Server::interlink()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
Point ret(0, 0, 0);
@ -1257,7 +1317,8 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
centres.clear();
#ifdef DEBUG_T
cout << "//<-- Server::interlink()" << endl ; fflush(stdout) ;
cout << "//<-- Server::interlink()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
/* Return position */
@ -1272,13 +1333,15 @@ Point Server::interlink(const vector<Measurement> &m, const int &client_idx)cons
void Server::makeReferencePointListFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makePointListFromFile(&string)" << endl ; fflush(stdout) ;
cout << "//--> Server::makePointListFromFile(&string)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
makePointListFromFile(reference_point_list, filename, true) ;
#ifdef DEBUG_T
cout << "//<-- Server::makePointListFromFile(&string)" << endl ; fflush(stdout) ;
cout << "//<-- Server::makePointListFromFile(&string)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1287,13 +1350,15 @@ void Server::makeReferencePointListFromFile(const string &filename)
void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makePointListFromFile(&vector<ReferencePoint>, &string)" << endl ; fflush(stdout) ;
cout << "//--> Server::makePointListFromFile(&vector<ReferencePoint>, &string)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
makePointListFromFile(dest_point_list, filename, true) ;
#ifdef DEBUG_T
cout << "//<-- Server::makePointListFromFile(&vector<ReferencePoint>, &string)" << endl ; fflush(stdout) ;
cout << "//<-- Server::makePointListFromFile(&vector<ReferencePoint>, &string)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1306,7 +1371,8 @@ void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, cons
void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, const string &filename, const bool uniq_point)
{
#ifdef DEBUG_T
cout << "//--> Server::makePointListFromFile(&vector<ReferencePoint>, &string, bool)" << endl ; fflush(stdout) ;
cout << "//--> Server::makePointListFromFile(&vector<ReferencePoint>, &string, bool)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file ; // Flux d'entrée du fichier.
@ -1417,7 +1483,8 @@ void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, cons
infos.clear() ;
#ifdef DEBUG_T
cout << "//<-- Server::makePointListFromFile(&vector<ReferencePoint>, &string, bool)" << endl ; fflush(stdout) ;
cout << "//<-- Server::makePointListFromFile(&vector<ReferencePoint>, &string, bool)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1426,7 +1493,8 @@ void Server::makePointListFromFile(vector<ReferencePoint> &dest_point_list, cons
void Server::makeApListFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makeApListFromFile()" << endl ; fflush(stdout) ;
cout << "//--> Server::makeApListFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file;
@ -1481,7 +1549,8 @@ void Server::makeApListFromFile(const string &filename)
input_file.close();
#ifdef DEBUG_T
cout << "//<-- Server::makeApListFromFile()" << endl ; fflush(stdout) ;
cout << "//<-- Server::makeApListFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1491,7 +1560,8 @@ void Server::makeApListFromFile(const string &filename)
void Server::makeTopologyFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makeTopologyFromFile()" << endl ; fflush(stdout) ;
cout << "//--> Server::makeTopologyFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
ifstream input_file ;
@ -1548,7 +1618,8 @@ void Server::makeTopologyFromFile(const string &filename)
input_file.close() ;
#ifdef DEBUG_T
cout << "//<-- Server::makeTopologyFromFile()" << endl ; fflush(stdout) ;
cout << "//<-- Server::makeTopologyFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1560,7 +1631,8 @@ void Server::makeTopologyFromFile(const string &filename)
void Server::makeWaypointListFromFile(const string &filename)
{
#ifdef DEBUG_T
cout << "//--> Server::makeWaypointListFromFile()" << endl ; fflush(stdout) ;
cout << "//--> Server::makeWaypointListFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
@ -1576,7 +1648,8 @@ void Server::makeWaypointListFromFile(const string &filename)
{
cerr << "Error opening input file « " << filename << " » !" << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::makeWaypointListFromFile()" << endl ; fflush(stdout) ;
cout << "//<-- Server::makeWaypointListFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ;
}
@ -1598,7 +1671,8 @@ void Server::makeWaypointListFromFile(const string &filename)
infos = explode(buffer, ';') ;
#ifdef DEBUG
cout << "Point de passage : " << buffer << ' ' ; fflush(stdout);
cout << "Point de passage : " << buffer << ' ' ;
fflush(stdout);
#endif // DEBUG
/* Ajout du point lu */
@ -1607,7 +1681,8 @@ void Server::makeWaypointListFromFile(const string &filename)
cerr << "Point " << tmp_pt << " non ajouté ! Peut-être est-il dupliqué ?" << endl ;
#ifdef DEBUG
else
cout << "traité." << endl ; fflush(stdout);
cout << "traité." << endl ;
fflush(stdout);
#endif // DEBUG
infos.clear() ;
@ -1634,7 +1709,8 @@ void Server::makeWaypointListFromFile(const string &filename)
cout << "Traitement des points de passage (" << nb_pts << ")..." ;
#endif // DEBUG
#ifdef DEBUG_2
cout << "--> Liste des points de passage (" << nb_pts << ") :" << endl ; fflush(stdout);
cout << "--> Liste des points de passage (" << nb_pts << ") :" << endl ;
fflush(stdout);
#endif // DEBUG_2
@ -1740,7 +1816,8 @@ void Server::makeWaypointListFromFile(const string &filename)
#ifdef DEBUG_T
cout << "//<-- Server::makeWaypointListFromFile()" << endl ; fflush(stdout) ;
cout << "//<-- Server::makeWaypointListFromFile()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1753,7 +1830,8 @@ void Server::makeWaypointListFromFile(const string &filename)
bool Server::checkTopology()
{
#ifdef DEBUG_T
cout << "//--> Server::checkTopology()" << endl ; fflush(stdout) ;
cout << "//--> Server::checkTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
bool ret = true ;
@ -1855,7 +1933,8 @@ bool Server::checkTopology()
#ifdef DEBUG_T
cout << "//<-- Server::checkTopology()" << endl ; fflush(stdout) ;
cout << "//<-- Server::checkTopology()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ret ;
@ -1869,7 +1948,8 @@ bool Server::checkTopology()
void Server::makeReferencePointDistances()
{
#ifdef DEBUG_T
cout << "//--> Server::makeReferencePointDistances()" << endl ; fflush(stdout) ;
cout << "//--> Server::makeReferencePointDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
unsigned int nb_pts = reference_point_list.size() ; // Nombre de points à traiter.
@ -1887,7 +1967,8 @@ void Server::makeReferencePointDistances()
cout << "Traitement des points de référence (" << nb_pts << ")..." ;
#endif // DEBUG
#ifdef DEBUG_2
cout << "--> Liste des points de référence (" << nb_pts << ") :" << endl ; fflush(stdout);
cout << "--> Liste des points de référence (" << nb_pts << ") :" << endl ;
fflush(stdout);
#endif // DEBUG_2
/* Calcul des distances */
@ -1944,7 +2025,8 @@ void Server::makeReferencePointDistances()
#endif // DEBUG_2
#ifdef DEBUG_T
cout << "//<-- Server::makeReferencePointDistances()" << endl ; fflush(stdout) ;
cout << "//<-- Server::makeReferencePointDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1955,7 +2037,8 @@ void Server::makeReferencePointDistances()
void Server::selectDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) const
{
#ifdef DEBUG_T
cout << "//--> Server::selectDistances()" << endl ; fflush(stdout) ;
cout << "//--> Server::selectDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
matrix->resize(boost::extents[l1.size()][l2.size()]) ;
@ -1964,7 +2047,8 @@ void Server::selectDistances(float_array *matrix, const vector<Point> &l1, const
(*matrix)[i][j] = reference_point_matrix[pointIndex(l1[i])][pointIndex(l2[j])] ;
#ifdef DEBUG_T
cout << "//<-- Server::selectDistances()" << endl ; fflush(stdout) ;
cout << "//<-- Server::selectDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1975,7 +2059,8 @@ void Server::selectDistances(float_array *matrix, const vector<Point> &l1, const
void Server::computeEuclideanDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2) const
{
#ifdef DEBUG_T
cout << "//--> Server::computeEuclideanDistances()" << endl ; fflush(stdout) ;
cout << "//--> Server::computeEuclideanDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
matrix->resize(boost::extents[l1.size()][l2.size()]) ;
@ -1985,7 +2070,8 @@ void Server::computeEuclideanDistances(float_array *matrix, const vector<Point>
(*matrix)[i][j] = l1[i].distance(l2[j]) ;
#ifdef DEBUG_T
cout << "//<-- Server::computeEuclideanDistances()" << endl ; fflush(stdout) ;
cout << "//<-- Server::computeEuclideanDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -1996,7 +2082,8 @@ void Server::computeEuclideanDistances(float_array *matrix, const vector<Point>
void Server::computeTopologyDistances(float_array *matrix, const vector<Point> &l1, const vector<Point> &l2)
{
#ifdef DEBUG_T
cout << "//--> Server::computeTopologyDistances()" << endl ; fflush(stdout) ;
cout << "//--> Server::computeTopologyDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
matrix->resize(boost::extents[l1.size()][l2.size()]) ;
@ -2016,7 +2103,8 @@ void Server::computeTopologyDistances(float_array *matrix, const vector<Point> &
#endif // DEBUG_2
#ifdef DEBUG_T
cout << "//<-- Server::computeTopologyDistances()" << endl ; fflush(stdout) ;
cout << "//<-- Server::computeTopologyDistances()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -2027,13 +2115,15 @@ void Server::computeTopologyDistances(float_array *matrix, const vector<Point> &
void Server::printReferencePointList()
{
#ifdef DEBUG_T
cout << "//--> Server::printReferencePointList()" << endl ; fflush(stdout) ;
cout << "//--> Server::printReferencePointList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
printPointList(reference_point_list) ;
#ifdef DEBUG_T
cout << "//<-- Server::printReferencePointList()" << endl ; fflush(stdout) ;
cout << "//<-- Server::printReferencePointList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -2043,14 +2133,16 @@ void Server::printReferencePointList()
void Server::printPointList(vector<ReferencePoint> &point_list)
{
#ifdef DEBUG_T
cout << "//--> Server::printPointList()" << endl ; fflush(stdout) ;
cout << "//--> Server::printPointList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
for (unsigned int i = 0 ; i < point_list.size() ; i++)
cout << point_list[i] << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::printPointList()" << endl ; fflush(stdout) ;
cout << "//<-- Server::printPointList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -2059,14 +2151,16 @@ void Server::printPointList(vector<ReferencePoint> &point_list)
void Server::printAccessPointList() const
{
#ifdef DEBUG_T
cout << "//--> Server::printAccessPointList()" << endl ; fflush(stdout) ;
cout << "//--> Server::printAccessPointList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
for (unsigned int i = 0 ; i < access_point_list.size() ; i++)
cout << access_point_list[i] << endl;
#ifdef DEBUG_T
cout << "//<-- Server::printAccessPointList()" << endl ; fflush(stdout) ;
cout << "//<-- Server::printAccessPointList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -2075,7 +2169,8 @@ void Server::printAccessPointList() const
void Server::computeFriisFromRefList()
{
#ifdef DEBUG_T
cout << "//--> Server::computeFriisFromRefList()" << endl ; fflush(stdout) ;
cout << "//--> Server::computeFriisFromRefList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
vector<float> friis_idx_list;
@ -2117,7 +2212,8 @@ void Server::computeFriisFromRefList()
}
#ifdef DEBUG_T
cout << "//<-- Server::computeFriisFromRefList()" << endl ; fflush(stdout) ;
cout << "//<-- Server::computeFriisFromRefList()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -2127,7 +2223,8 @@ void Server::computeFriisFromRefList()
vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measurement> &m)
{
#ifdef DEBUG_T
cout << "//--> Server::computeFriisFromRefList(&Point, &vector<Measurement>)" << endl ; fflush(stdout) ;
cout << "//--> Server::computeFriisFromRefList(&Point, &vector<Measurement>)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
vector<float> friis_idx_list;
@ -2177,7 +2274,8 @@ vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measu
}
#ifdef DEBUG_T
cout << "//<-- Server::computeFriisFromRefList(&Point, &vector<Measurement>)" << endl ; fflush(stdout) ;
cout << "//<-- Server::computeFriisFromRefList(&Point, &vector<Measurement>)" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return friis_idx_list;
@ -2189,13 +2287,15 @@ vector<float> Server::computeFriisFromRefList(const Point &p, const vector<Measu
ClientInfo& Server::createClient()
{
#ifdef DEBUG_T
cout << "//--> Server::createClient()" << endl ; fflush(stdout) ;
cout << "//--> Server::createClient()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
client_list.push_back(ClientInfo()) ;
#ifdef DEBUG_T
cout << "//<-- Server::createClient()" << endl ; fflush(stdout) ;
cout << "//<-- Server::createClient()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return client_list.back() ;
@ -2207,14 +2307,16 @@ ClientInfo& Server::createClient()
void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
{
#ifdef DEBUG_T
cout << "//--> Server::monitorClient()" << endl ; fflush(stdout) ;
cout << "//--> Server::monitorClient()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
if (VITERBI_N < 2)
{
cerr << "monitorClient() : N ne peut être inférieur à 2 !" << endl ;
#ifdef DEBUG_T
cout << "//<-- Server::monitorClient()" << endl ; fflush(stdout) ;
cout << "//<-- Server::monitorClient()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return ;
}
@ -2301,7 +2403,8 @@ void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
Frbhmbasique = fbcm_friis(vm, friisFromList, position.getZ());
cout << "Point selectionné final: " << Frbhmbasique << endl;
fichier.open(filename.c_str(), std::ios::app);
if ( !fichier ){
if ( !fichier )
{
cerr << "Erreur de creation du fichier" << endl;
exit(1);
}
@ -2328,7 +2431,8 @@ void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
pointFastViterbi = fastViterbiLike(client_id, dst_matrix) ;
fichier.open(filename.c_str(), std::ios::app);
cout << "Point selectionné: " << pointFastViterbi << endl;
if ( !fichier ){
if ( !fichier )
{
cerr << "Erreur de creation du fichier" << endl;
exit(1);
}
@ -2346,7 +2450,8 @@ void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
}
#ifdef DEBUG_T
cout << "//<-- Server::monitorClient()" << endl ; fflush(stdout) ;
cout << "//<-- Server::monitorClient()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
}
@ -2360,7 +2465,8 @@ void Server::monitorClient(const unsigned int &client_id, const ALGORITHM &algo)
Point Server::fastViterbiLike(const unsigned int &client_id, const float_array &distance_matrix)
{
#ifdef DEBUG_T
cout << "//--> Server::fastViterbiLike()" << endl ; fflush(stdout) ;
cout << "//--> Server::fastViterbiLike()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
float_array &V = client_list[client_id].getRef_viterbi_V() ;
@ -2442,7 +2548,8 @@ Point Server::fastViterbiLike(const unsigned int &client_id, const float_array &
i++ ;
#ifdef DEBUG_T
cout << "//<-- Server::fastViterbiLike()" << endl ; fflush(stdout) ;
cout << "//<-- Server::fastViterbiLike()" << endl ;
fflush(stdout) ;
#endif // DEBUG_T
return E_current[V0_min_k] ;

View File

@ -134,7 +134,10 @@ public:
void computeFriisFromRefList();
vector<float> computeFriisFromRefList(const Point &p, const vector<Measurement> &m);
unsigned int getNbReferencePoints()const { return reference_point_list.size(); };
unsigned int getNbReferencePoints()const
{
return reference_point_list.size();
};
void monitorClient(const unsigned int &client_id, const ALGORITHM &algo) ;
Point fastViterbiLike(const unsigned int &id_client, const float_array &distance_matrix) ;