141 lines
3.4 KiB
C++
141 lines
3.4 KiB
C++
#include "clientinfo.hh"
|
|
|
|
|
|
ClientInfo::ClientInfo(const string &ip, const int &port, const float &antg)
|
|
{
|
|
#ifdef DEBUG_T
|
|
cout << "//--> ClientInfo::ClientInfo()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
client_ip = ip;
|
|
antenna_gain = antg;
|
|
client_listen_port = port;
|
|
|
|
viterbi_iteration = 1 ;
|
|
|
|
int N = VITERBI_N, K = VITERBI_K ;
|
|
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) ;
|
|
#endif // DEBUG_T
|
|
}
|
|
|
|
|
|
|
|
ClientInfo::ClientInfo(const ClientInfo &c)
|
|
{
|
|
#ifdef DEBUG_T
|
|
cout << "//--> ClientInfo::ClientInfo(ClientInfo)" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
client_ip = c.client_ip ;
|
|
antenna_gain = c.antenna_gain ;
|
|
client_listen_port = c.client_listen_port ;
|
|
viterbi_iteration = c.viterbi_iteration ;
|
|
|
|
const float_array::size_type *s = c.viterbi_V.shape() ; // Récupération des dimensions de c.viterbi_V.
|
|
viterbi_V.resize(boost::extents[s[0]][s[1]]) ; // Redimensionnement de viterbi_V aux dimensions de c.viterbi_V.
|
|
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) ;
|
|
#endif // DEBUG_T
|
|
}
|
|
|
|
|
|
|
|
ClientInfo::~ClientInfo()
|
|
{
|
|
#ifdef DEBUG_T
|
|
cout << "//--> ClientInfo::~ClientInfo()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
viterbi_Eprevious.clear();
|
|
viterbi_Ecurrent.clear();
|
|
|
|
#ifdef DEBUG_T
|
|
cout << "//<-- ClientInfo::~ClientInfo()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
}
|
|
|
|
|
|
|
|
ClientInfo ClientInfo::operator=(const ClientInfo &c)
|
|
{
|
|
#ifdef DEBUG_T
|
|
cout << "//--> ClientInfo::operator=()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
if (this == &c)
|
|
return *this ;
|
|
|
|
client_ip = c.client_ip ;
|
|
antenna_gain = c.antenna_gain ;
|
|
client_listen_port = c.client_listen_port ;
|
|
viterbi_iteration = c.viterbi_iteration ;
|
|
|
|
const float_array::size_type *s = c.viterbi_V.shape() ; // Récupération des dimensions de c.viterbi_V.
|
|
viterbi_V.resize(boost::extents[s[0]][s[1]]) ; // Redimensionnement de viterbi_V aux dimensions de c.viterbi_V.
|
|
viterbi_V = c.viterbi_V ; // Copie du contenu de c.viterbi_V dans viterbi_V.
|
|
|
|
#ifdef DEBUG_T
|
|
cout << "//<-- ClientInfo::operator=()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
return *this ;
|
|
}
|
|
|
|
|
|
|
|
bool ClientInfo::operator==(const ClientInfo &c)
|
|
{
|
|
#ifdef DEBUG_T
|
|
cout << "//--> ClientInfo::operator==()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
if (this == &c)
|
|
return true ;
|
|
|
|
if (client_ip != c.client_ip)
|
|
return false ;
|
|
|
|
if (antenna_gain != c.antenna_gain)
|
|
return false ;
|
|
|
|
if (client_listen_port != c.client_listen_port)
|
|
return false ;
|
|
|
|
if (viterbi_iteration != c.viterbi_iteration)
|
|
return false ;
|
|
|
|
if (viterbi_V != c.viterbi_V)
|
|
return false ;
|
|
|
|
return true ;
|
|
|
|
#ifdef DEBUG_T
|
|
cout << "//<-- ClientInfo::operator==()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
}
|
|
|
|
|
|
|
|
void ClientInfo::print_viterbi_V() const
|
|
{
|
|
#ifdef DEBUG_T
|
|
cout << "//--> ClientInfo::print_viterbi_V()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
|
|
for (float_index n=0 ; n < viterbi_V.shape()[0] ; n++)
|
|
{
|
|
for (float_index k=0 ; k < viterbi_V.shape()[1] ; k++)
|
|
cout << "[" << viterbi_V[n][k] << "]" ;
|
|
cout << endl ;
|
|
}
|
|
|
|
#ifdef DEBUG_T
|
|
cout << "//<-- ClientInfo::print_viterbi_V()" << endl ; fflush(stdout) ;
|
|
#endif // DEBUG_T
|
|
}
|