00001 // Copyright (C) 2008 University of Louisiana at Lafayette 00002 // Authors: Suresh Golconda, Christopher Mire 00003 00006 00007 #ifndef CAJUN_POINT_COLLECTOR_H 00008 #define CAJUN_POINT_COLLECTOR_H 00009 00010 #include <vector> 00011 00012 #include "cbmesg_logger.H" 00013 #include "access_data.H" 00014 #include "cb_time.H" 00015 00016 #include "wall.H" 00017 00018 extern cajun::cbmesg_logger_t msg_logger; 00019 00020 namespace cajun 00021 { 00022 00023 class point_collector_base_t 00024 { 00025 public: 00026 virtual bool update_points (unsigned qid_, unsigned counter) = 0; 00027 virtual ~point_collector_base_t () { } 00028 protected: 00029 private: 00030 }; 00031 00032 template <typename T> 00033 class point_collector_t : public point_collector_base_t 00034 { 00035 public: 00036 point_collector_t (access_data_t *ad_, wall_t *wall_, 00037 unsigned qid_) 00038 : m_ad (ad_), m_wall (wall_), m_qid (qid_) { init (); } 00039 00040 ~point_collector_t () { } 00044 bool update_points (unsigned qid_, unsigned counter); 00045 protected: 00046 access_data_t *m_ad; 00047 wall_t *m_wall; 00048 private: 00049 void init (); 00051 void fill_wall (unsigned counter) 00052 { 00053 if (m_gp_vec.empty ()) 00054 return; 00055 00056 m_wall->update_ref_pos (m_motion, m_nav); 00057 00058 for (size_t i = 0; i < m_gp_vec.size (); ++i) 00059 m_wall->fill_wall (m_gp_vec[i], 00060 counter); 00061 } 00062 00063 std::vector<T> m_gp_vec; 00064 nav_data_t m_nav; 00065 motion_data_t m_motion; 00066 unsigned m_qid; 00067 }; 00068 }; 00069 00070 #endif