28 bool SharedRecognitionResultsManager::addResults(std::vector<ISM::RecognitionResultPtr> &result_ptrs)
31 shared_memory_vector_.insert(shared_memory_vector_.end(), result_ptrs.begin(), result_ptrs.end());
32 ROS_DEBUG_STREAM_NAMED(
"SharedMemory",
"Added: " << result_ptrs.size() <<
" recognitionresults to shared memory, now containing " << shared_memory_vector_.size() <<
" recognitionresults");
37 RecognitionResult SharedRecognitionResultsManager::getLastResult()
40 return *shared_memory_vector_.back();
43 std::vector<RecognitionResultPtr> SharedRecognitionResultsManager::getResults()
46 std::vector<RecognitionResultPtr> results;
50 for (std::vector<RecognitionResultPtr>::iterator it = shared_memory_vector_.begin(); it != shared_memory_vector_.end(); it++)
51 results.push_back(*it);
53 ROS_DEBUG_STREAM_NAMED(
"SharedMemory",
"Returning all (" << shared_memory_vector_.size() <<
") recognitionresults");
61 unsigned int SharedRecognitionResultsManager::getResultsNumber()
64 return shared_memory_vector_.size();
67 void SharedRecognitionResultsManager::clearResults()
70 shared_memory_vector_.clear();
71 ROS_DEBUG_STREAM_NAMED(
"SharedMemory",
"Cleared shared memory, now containing " << shared_memory_vector_.size() <<
" recognitionresults");
75 bool SharedRecognitionResultsManager::recognitionResultsAvailable()
77 return !shared_memory_vector_.empty();
80 bool SharedRecognitionResultsManager::popLastResult()
84 if (!shared_memory_vector_.empty())
85 shared_memory_vector_.pop_back();
90 ROS_DEBUG_STREAM_NAMED(
"SharedMemory",
"Popped last recognitionresult, now containing " << shared_memory_vector_.size() <<
" recognitionresults");
95 std::vector<RecognitionResultPtr> rr_vec = p.
getResults();
96 s <<
"[SharedMemory:size=" << rr_vec.size() <<
";vector:[";
97 for(RecognitionResultPtr r : rr_vec){
101 return strm << s.str();
105 return strm << (*pPtr);
#define ROS_DEBUG_STREAM_NAMED(name, args)
std::ostream & operator<<(std::ostream &strm, SharedRecognitionResultsManager &p)
std::vector< ISM::RecognitionResultPtr > getResults()