Skip to content

Commit d8f529f

Browse files
committed
cosmetic rearranging
1 parent 6f6cd54 commit d8f529f

File tree

1 file changed

+73
-73
lines changed

1 file changed

+73
-73
lines changed

include/flex_sync/approximate_sync.h

+73-73
Original file line numberDiff line numberDiff line change
@@ -501,79 +501,6 @@ namespace flex_sync {
501501
return (0);
502502
}
503503
};
504-
#ifdef DEBUG_PRINTING
505-
class StatePrinter {
506-
public:
507-
StatePrinter() {};
508-
template<std::size_t I>
509-
int operate(ApproximateSync<MsgTypes ...> *sync) {
510-
int num_topics = 0;
511-
auto &type_info = std::get<I>(sync->type_infos_);
512-
for (auto &ti: type_info.topic_info) {
513-
auto &deque = ti.deque;
514-
auto &past = ti.past;
515-
ros::Time dt, pt;
516-
if (!deque.empty()) {
517-
dt = deque.back()->header.stamp;
518-
}
519-
if (!past.empty()) {
520-
pt = past.back()->header.stamp;
521-
}
522-
const int n = I * 3 + num_topics; // XXX only right for 3 topics/type
523-
std::cout << n << " deque: " << deque.size() << " " << dt << std::endl;
524-
std::cout << n << " past: " << past.size() << " " << pt << std::endl;
525-
num_topics++;
526-
}
527-
return (num_topics);;
528-
}
529-
};
530-
531-
void printState() {
532-
StatePrinter sp;
533-
(void) for_each(type_infos_, &sp);
534-
}
535-
536-
class NVMPrinter {
537-
public:
538-
NVMPrinter() {};
539-
template<std::size_t I>
540-
int operate(ApproximateSync<MsgTypes ...> *sync) {
541-
int num_topics = 0;
542-
auto &type_info = std::get<I>(sync->type_infos_);
543-
for (auto &ti: type_info.topic_info) {
544-
const int n = I * 3 + num_topics; // XXX only right for 3 topics/type
545-
std::cout << n << " nvm: " << ti.num_virtual_moves << " " <<
546-
" wb: " << ti.warned_about_incorrect_bound << std::endl;
547-
num_topics++;
548-
}
549-
return (num_topics);;
550-
}
551-
};
552-
553-
554-
void printNVM() {
555-
NVMPrinter nvmp;
556-
(void) for_each(type_infos_, &nvmp);
557-
}
558-
559-
class CandidatePrinter {
560-
public:
561-
CandidatePrinter() {};
562-
template<std::size_t I>
563-
int operate(ApproximateSync<MsgTypes ...> *sync) {
564-
const auto &cand = std::get<I>(sync->candidate_);
565-
for (auto &msg: cand) {
566-
std::cout << "cand: " << I << " " << msg->header.stamp << std::endl;
567-
}
568-
return (0);
569-
}
570-
};
571-
572-
void printCandidate() {
573-
CandidatePrinter cp;
574-
(void) for_each(type_infos_, &cp);
575-
}
576-
#endif
577504

578505
// Assumes: all deques are non empty now
579506
void publishCandidate() {
@@ -744,6 +671,79 @@ namespace flex_sync {
744671
topic_info.warned_about_incorrect_bound = true;
745672
}
746673
}
674+
#ifdef DEBUG_PRINTING
675+
class StatePrinter {
676+
public:
677+
StatePrinter() {};
678+
template<std::size_t I>
679+
int operate(ApproximateSync<MsgTypes ...> *sync) {
680+
int num_topics = 0;
681+
auto &type_info = std::get<I>(sync->type_infos_);
682+
for (auto &ti: type_info.topic_info) {
683+
auto &deque = ti.deque;
684+
auto &past = ti.past;
685+
ros::Time dt, pt;
686+
if (!deque.empty()) {
687+
dt = deque.back()->header.stamp;
688+
}
689+
if (!past.empty()) {
690+
pt = past.back()->header.stamp;
691+
}
692+
const int n = I * 3 + num_topics; // XXX only right for 3 topics/type
693+
std::cout << n << " deque: " << deque.size() << " " << dt << std::endl;
694+
std::cout << n << " past: " << past.size() << " " << pt << std::endl;
695+
num_topics++;
696+
}
697+
return (num_topics);;
698+
}
699+
};
700+
701+
void printState() {
702+
StatePrinter sp;
703+
(void) for_each(type_infos_, &sp);
704+
}
705+
706+
class NVMPrinter {
707+
public:
708+
NVMPrinter() {};
709+
template<std::size_t I>
710+
int operate(ApproximateSync<MsgTypes ...> *sync) {
711+
int num_topics = 0;
712+
auto &type_info = std::get<I>(sync->type_infos_);
713+
for (auto &ti: type_info.topic_info) {
714+
const int n = I * 3 + num_topics; // XXX only right for 3 topics/type
715+
std::cout << n << " nvm: " << ti.num_virtual_moves << " " <<
716+
" wb: " << ti.warned_about_incorrect_bound << std::endl;
717+
num_topics++;
718+
}
719+
return (num_topics);;
720+
}
721+
};
722+
723+
724+
void printNVM() {
725+
NVMPrinter nvmp;
726+
(void) for_each(type_infos_, &nvmp);
727+
}
728+
729+
class CandidatePrinter {
730+
public:
731+
CandidatePrinter() {};
732+
template<std::size_t I>
733+
int operate(ApproximateSync<MsgTypes ...> *sync) {
734+
const auto &cand = std::get<I>(sync->candidate_);
735+
for (auto &msg: cand) {
736+
std::cout << "cand: " << I << " " << msg->header.stamp << std::endl;
737+
}
738+
return (0);
739+
}
740+
};
741+
742+
void printCandidate() {
743+
CandidatePrinter cp;
744+
(void) for_each(type_infos_, &cp);
745+
}
746+
#endif
747747

748748
// some neat template tricks picked up here:
749749
// https://stackoverflow.com/questions/18063451/get-index-of-a-tuple-elements -type

0 commit comments

Comments
 (0)