MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/Core/MOOSLIB/MOOSCommPkt.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 // MOOSCommPkt.h: interface for the MOOSCommPkt class.
00031 //
00033 
00034 #if !defined(MOOSCOMMPKTH)
00035 #define MOOSCOMMPKTH
00036 
00037 #include <list>
00038 //using namespace std;
00039 
00040 #include "MOOSMsg.h"
00041 
00042 #define MOOS_PKT_DEFAULT_SPACE 32768
00043 
00044 
00045 
00047 //Here we define the current protocol string for this version of the library
00048 //if and when the wire protocol changes change the MOOS_PROTOCOL_STRING name
00049 //keeping it below MOOS_PROTOCOL_STRING_BUFFER_SIZE
00050 #define MOOS_PROTOCOL_STRING_BUFFER_SIZE 32
00051 //#define MOOS_PROTOCOL_STRING "ELKS CAN'T DANCE 30/7/10"
00052 #define MOOS_PROTOCOL_STRING "ELKS CAN'T DANCE 2/8/10"
00053 
00054 
00055 
00056 typedef std::list<CMOOSMsg> MOOSMSG_LIST;
00057 
00061 class CMOOSCommPkt  
00062 {
00063 public:
00064     bool    Serialize(MOOSMSG_LIST & List, bool bToStream = true, bool bNoNULL =false,double * pdfPktTime=NULL);
00065     int     GetStreamLength();
00066     bool    Fill(unsigned char * InData,int nData);
00067     int     GetBytesRequired();
00068         double  GetCompression();
00069 
00070     CMOOSCommPkt();
00071     virtual ~CMOOSCommPkt();
00072 
00073     unsigned char * m_pStream;
00074     unsigned char * m_pNextData;
00075     int                m_nStreamSpace;
00076     unsigned char    DefaultStream[MOOS_PKT_DEFAULT_SPACE];
00077 
00078 protected:
00079     bool InflateTo(int nNewStreamSize);
00080     bool CopyToStream(unsigned char * pData, int nBytes);
00081     int m_nByteCount;
00082     int m_nMsgLen;
00085     bool    m_bAllocated;
00086         double m_dfCompression;
00087 
00088 };
00089 
00090 typedef std::list<CMOOSCommPkt> MOOSPKT_LIST;
00091 
00092 #endif // !defined(AFX_MOOSCOMMPKT_H__2645E53D_479F_4F8D_9020_B5C8DBCF4789__INCLUDED_)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines