32 #ifndef _TOPIC_PRIORITY_H_
33 #define _TOPIC_PRIORITY_H_
44 template <
class cmd_type>
50 typename std::map<int,cmd_type>::iterator
it;
73 msg->lifetime=ros::Time::now().toSec()+msg->lifetime;
97 typename std::map<int,cmd_type>::iterator it_max;
99 for(it=message_map.begin();it!=message_map.end();it++)
100 if((*it).second->priority > max_priority)
102 max_priority=(*it).second->priority;
106 if(message_map.size())
107 return (*it_max).second;
123 for(it=message_map.begin();it!=message_map.end();it++)
124 if(ros::Time::now().toSec() > (*it).second->lifetime)
125 message_map.erase(it);
Topic priority sorting class.
cmd_type top_msg(void)
Return the current command message.
std::map< int, cmd_type >::iterator it
Iterator for the messages.
void push_msg(cmd_type msg)
Add new command message.
std::map< int, cmd_type > message_map
Map of all the messages received.
void maintenance(void)
Do maintenance on the message map.