Go to the documentation of this file.00001
00059
00060
00061
00062
00063
00064
00065
00066 #ifndef DEBUG_INTERFACE_H_
00067 #define DEBUG_INTERFACE_H_
00068
00069 #ifdef DEBUG_
00070
00071 namespace Debug
00072 {
00073 class Interface
00074 {
00075 struct ARROW {
00076 Eigen::Vector3f from, to;
00077 int r,g,b;
00078 };
00079
00080 std::vector<ARROW> arrows_;
00081 double time_;
00082 public:
00083 void addArrow(const Eigen::Vector3f &from, const Eigen::Vector3f &to, int r=255, int g=255, int b=255)
00084 {
00085 ARROW A;A.from=from;A.to=to;
00086 A.r=r;A.g=g;A.b=b;
00087 arrows_.push_back(A);
00088 }
00089
00090 bool getArrow(Eigen::Vector3f &from, Eigen::Vector3f &to, unsigned char &r, unsigned char &g, unsigned char &b)
00091 {
00092 if(arrows_.empty())
00093 return false;
00094 from = arrows_.back().from;
00095 to = arrows_.back().to;
00096 r = arrows_.back().r;
00097 g = arrows_.back().g;
00098 b = arrows_.back().b;
00099 arrows_.pop_back();
00100 return true;
00101 }
00102
00103 void clear()
00104 {
00105 arrows_.clear();
00106 }
00107
00108 void setTime(const double t) {time_ = t;}
00109 double getTime() const {return time_;}
00110 void sayTook(const char *str) const {
00111 std::cout<<"took "<<str<<": "<<(ros::Time::now().toSec()-getTime())<<"\n";
00112 }
00113
00114 static Interface &get() {
00115 static Interface intf;
00116 return intf;
00117 }
00118 };
00119 }
00120 #endif
00121
00122 #endif