00001 00024 #include "ccny_rgbd/structures/feature_history.h" 00025 00026 namespace ccny_rgbd { 00027 00028 FeatureHistory::FeatureHistory(): 00029 index_(0), 00030 capacity_(5) 00031 { 00032 00033 } 00034 00035 void FeatureHistory::add(const PointCloudFeature& cloud) 00036 { 00037 if (history_.size() < capacity_) 00038 { 00039 history_.push_back(cloud); 00040 00041 ++index_; 00042 if (index_ >= capacity_) index_ = 0; 00043 } 00044 else if (capacity_ > 0) 00045 { 00046 history_[index_] = cloud; 00047 00048 ++index_; 00049 if (index_ >= capacity_) index_ = 0; 00050 } 00051 } 00052 00053 void FeatureHistory::getAll(PointCloudFeature& cloud) 00054 { 00055 for (unsigned int i=0; i < history_.size(); ++i) 00056 cloud += history_[i]; 00057 } 00058 00059 void FeatureHistory::reset() 00060 { 00061 history_.clear(); 00062 index_ = 0; 00063 } 00064 00065 } // namespace ccny_rgbd