17 #ifndef _CONNECTION_MANAGER_HH_ 
   18 #define _CONNECTION_MANAGER_HH_ 
   21 #include <boost/shared_ptr.hpp> 
   22 #include <boost/interprocess/sync/interprocess_semaphore.hpp> 
   54       public: 
bool Init(
const std::string &_masterHost,
 
   55                         unsigned int _masterPort);
 
   76       public: 
void Subscribe(
const std::string &_topic,
 
   77                               const std::string &_msgType,
 
   82       public: 
void Unsubscribe(
const msgs::Subscribe &_sub);
 
   88                                 const std::string &_msgType);
 
   93       public: 
void Advertise(
const std::string &_topic,
 
   94                               const std::string &_msgType);
 
   98       public: 
void Unadvertise(
const std::string &_topic);
 
  120       private: 
ConnectionPtr FindConnection(
const std::string &_host,
 
  136       private: 
void OnMasterRead(
const std::string &_data);
 
  146                            const std::string &_data);
 
  150       private: 
void ProcessMessage(
const std::string &_packet);
 
  153       private: 
void RunUpdate();
 
  156       private: boost::condition_variable updateCondition;
 
  159       private: boost::mutex updateMutex;
 
  164       private: std::list<ConnectionPtr> connections;
 
  167       private: 
bool initialized;
 
  168       private: 
bool stop, stopped;
 
  170       private: 
unsigned int tmpIndex;
 
  171       private: boost::recursive_mutex listMutex;
 
  174       private: boost::mutex namespaceMutex;
 
  175       private: boost::recursive_mutex masterMessagesMutex;
 
  176       private: boost::recursive_mutex connectionMutex;
 
  178       private: std::list<msgs::Publish> publishers;
 
  179       private: std::list<std::string> namespaces;
 
  180       private: std::list<std::string> masterMessages;
 
  183       private: boost::condition_variable namespaceCondition;