00001 #include "hpcl_rtt/topic_manager.h" 00002 00003 00004 namespace hpcl_rtt 00005 { 00006 00007 TopicManagerPtr g_topic_manager; 00008 00009 const TopicManagerPtr& TopicManager::instance() 00010 { 00011 if (!g_topic_manager) 00012 { 00013 // boost::mutex::scoped_lock lock(g_topic_manager_mutex); 00014 if (!g_topic_manager) 00015 { 00016 g_topic_manager.reset(new TopicManager); 00017 } 00018 } 00019 00020 return g_topic_manager; 00021 } 00022 00023 TopicManager::TopicManager() 00024 { 00025 } 00026 00027 TopicManager::~TopicManager() 00028 { 00029 } 00030 00031 ConnectionBasePtr TopicManager::lookupPublication(const std::string& topic) 00032 { 00033 ConnectionBasePtr t; 00034 for (V_ConnectionBase::iterator i = advertised_topics_.begin(); 00035 !t && i != advertised_topics_.end(); 00036 ++i) 00037 { 00038 if ((*i)->getTopic() == topic) 00039 { 00040 t = *i; 00041 break; 00042 } 00043 } 00044 00045 return t; 00046 } 00047 00048 00049 } 00050