MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/Essentials/pMOOSBridge/MOOSCommunity.h
Go to the documentation of this file.
00001 
00002 //
00003 //   MOOS - Mission Oriented Operating Suite 
00004 //  
00005 //   A suit of Applications and Libraries for Mobile Robotics Research 
00006 //   Copyright (C) 2001-2005 Massachusetts Institute of Technology and 
00007 //   Oxford University. 
00008 //    
00009 //   This software was written by Paul Newman at MIT 2001-2002 and Oxford 
00010 //   University 2003-2005. email: pnewman@robots.ox.ac.uk. 
00011 //      
00012 //   This file is part of a  MOOS Core Component. 
00013 //        
00014 //   This program is free software; you can redistribute it and/or 
00015 //   modify it under the terms of the GNU General Public License as 
00016 //   published by the Free Software Foundation; either version 2 of the 
00017 //   License, or (at your option) any later version. 
00018 //          
00019 //   This program is distributed in the hope that it will be useful, 
00020 //   but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
00022 //   General Public License for more details. 
00023 //            
00024 //   You should have received a copy of the GNU General Public License 
00025 //   along with this program; if not, write to the Free Software 
00026 //   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
00027 //   02111-1307, USA. 
00028 //
00030 // MOOSCommunity.h: interface for the CMOOSCommunity class.
00031 //
00033 
00034 #if !defined(AFX_MOOSCOMMUNITY_H__5F2162C1_2606_485D_8F10_610257FD8A67__INCLUDED_)
00035 #define AFX_MOOSCOMMUNITY_H__5F2162C1_2606_485D_8F10_610257FD8A67__INCLUDED_
00036 
00037 #if _MSC_VER > 1000
00038 #pragma once
00039 #endif // _MSC_VER > 1000
00040 
00041 #include "MOOSUDPLink.h"
00042 
00043 
00044 class CMOOSCommunity  
00045 {
00046 public:
00047     typedef std::pair<std::string,std::string> SP;
00048 
00049     std::string GetFormattedName();
00050     std::string GetCommsName();
00051     std::string GetCommunityName();
00052     std::string GetUDPHost();
00053 
00054     bool DoRegistration();
00055     bool Initialise(const std::string & sCommunityName);
00056     
00057     bool InitialiseMOOSClient( const std::string &sHostName,
00058                               long nPort,
00059                               const std::string & sMOOSName,
00060                               int nFreq);
00061     
00062     bool AddSource(const std::string & sStr);
00063     bool AddSink(const SP & sIndex,const std::string & sAlias);
00064     bool WantsToSink(const SP & sIndex);
00065     std::string GetAlias(const SP & sIndex);
00066     CMOOSCommunity();
00067     virtual ~CMOOSCommunity();
00068         bool Fetch(MOOSMSG_LIST & Mail) ;
00069     bool Post(CMOOSMsg & M);
00070     bool SetUDPInfo(const std::string & sHost, int nPort);
00071     bool IsMOOSClientRunning();
00072     int GetUDPPort();
00073     bool HasUDPConfigured() const;
00074     bool HasMOOSSRegistration(const std::string & sVariable);
00075     
00076 protected:
00077     CMOOSCommClient m_CommClient;
00078 
00079     std::set<std::string>               m_Sources;
00080     std::map<SP,std::string>    m_Sinks;
00081     
00082     std::string m_sCommunityName;
00083     int m_nSharedFreq;
00084     
00085     bool m_bMOOSClientRunning;
00086     
00087         std::string     m_sUDPHost;
00088     int m_nUDPPort;
00089 
00090 };
00091 
00092 #endif // !defined(AFX_MOOSCOMMUNITY_H__5F2162C1_2606_485D_8F10_610257FD8A67__INCLUDED_)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines