From c9d26033e9a87d8a484ec770dfdeb2893c8c40f7 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Tue, 26 Apr 2011 16:37:11 +0200 Subject: [PATCH] [Positioning] InputCSV: add debug info --- owlps-positioning/src/inputcsv.cc | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/owlps-positioning/src/inputcsv.cc b/owlps-positioning/src/inputcsv.cc index 0882d14..d38a5c9 100644 --- a/owlps-positioning/src/inputcsv.cc +++ b/owlps-positioning/src/inputcsv.cc @@ -10,6 +10,8 @@ using namespace std ; using std::tr1::unordered_map ; +#define DEBUG + /* *** Operations *** */ @@ -39,7 +41,12 @@ const Request& InputCSV::get_next_request() // Read Mobile MAC field string mac_mobile ; if (! file.read_field(mac_mobile)) // Wrong number of fields - return *current_request ; + { +#ifdef DEBUG + cerr << "InputCSV: cannot read mac_mobile.\n" ; +#endif // DEBUG + return *current_request ; + } const Mobile &mobile = Stock::find_create_mobile(mac_mobile) ; current_request->set_mobile(&mobile) ; @@ -50,6 +57,9 @@ const Request& InputCSV::get_next_request() { // Wrong number of fields: blank current request current_request->clear() ; +#ifdef DEBUG + cerr << "InputCSV: cannot read type.\n" ; +#endif // DEBUG return *current_request ; } type = type_r ; @@ -61,6 +71,9 @@ const Request& InputCSV::get_next_request() { // Wrong number of fields: blank current request current_request->clear() ; +#ifdef DEBUG + cerr << "InputCSV: cannot read timestamp.\n" ; +#endif // DEBUG return *current_request ; } current_request->set_time_sent(timestamp) ; @@ -71,6 +84,9 @@ const Request& InputCSV::get_next_request() { // Wrong number of fields: blank current request current_request->clear() ; +#ifdef DEBUG + cerr << "InputCSV: cannot read coordinates.\n" ; +#endif // DEBUG return *current_request ; } @@ -81,6 +97,9 @@ const Request& InputCSV::get_next_request() { // Wrong number of fields: blank current request current_request->clear() ; +#ifdef DEBUG + cerr << "InputCSV: cannot read direction.\n" ; +#endif // DEBUG return *current_request ; } if (direction_int != 0) @@ -97,6 +116,9 @@ const Request& InputCSV::get_next_request() { // Wrong number of fields: blank current request current_request->clear() ; +#ifdef DEBUG + cerr << "InputCSV: cannot read mac_ap.\n" ; +#endif // DEBUG return *current_request ; } const AccessPoint &ap = Stock::find_create_ap(mac_ap) ;