Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGBinaryMessage.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _BINSOCKETMESSAGE_H_
00040 #define _BINSOCKETMESSAGE_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include <vector>
00046 #include <OSGBase.h>
00047 #include <OSGBaseTypes.h>
00048 #include <OSGNetworkMessage.h>
00049 #include <OSGBaseFunctions.h>
00050 
00051 OSG_BEGIN_NAMESPACE
00052 
00053 class OSG_BASE_DLLMAPPING BinaryMessage : public NetworkMessage
00054 {
00055     /*==========================  PUBLIC  =================================*/
00056   public:
00057 
00058     typedef std::vector<UInt8> BufferType;
00059 
00060     /*---------------------------------------------------------------------*/
00064     BinaryMessage                  (      void                 );
00065     BinaryMessage                  (const BinaryMessage &source);
00066 
00068     /*---------------------------------------------------------------------*/
00072     virtual ~BinaryMessage         (void);
00073 
00075     /*---------------------------------------------------------------------*/
00079     virtual UInt32       getSize   (void);
00080     virtual MemoryHandle getBuffer (void);
00081 
00083     /*---------------------------------------------------------------------*/
00087     virtual void setSize           (UInt32 size);
00088             void clear             (void       );
00089             void reset             (void       );
00090 
00092     /*---------------------------------------------------------------------*/
00096     void putUInt32           (const UInt32       value);
00097     void putInt32            (const Int32        value);
00098     void putUInt16           (const UInt16       value);
00099     void putInt16            (const Int16        value);
00100     void putUInt8            (const UInt8        value);
00101     void putInt8             (const Int8         value);
00102     void putString           (const std::string &value);
00103     void putReal32           (const Real32       value);
00104 
00106     /*---------------------------------------------------------------------*/
00110     void        getUInt32           (UInt32      &value);
00111     void        getInt32            (Int32       &value);
00112     void        getUInt16           (UInt16      &value);
00113     void        getInt16            (Int16       &value);
00114     void        getUInt8            (UInt8       &value);
00115     void        getInt8             (Int8        &value);
00116     void        getString           (std::string &value);
00117     void        getReal32           (Real32      &value);
00118 
00119     UInt32      getUInt32           (void              );
00120     Int32       getInt32            (void              );
00121     UInt16      getUInt16           (void              );
00122     Int16       getInt16            (void              );
00123     UInt8       getUInt8            (void              );
00124     Int8        getInt8             (void              );
00125     std::string getString           (void              );
00126     Real32      getReal32           (void              );
00127 
00129     /*---------------------------------------------------------------------*/
00133     BinaryMessage& operator =(const BinaryMessage &source);
00134 
00136     /*=========================  PROTECTED  ===============================*/
00137   protected:
00138 
00139     /*---------------------------------------------------------------------*/
00143     BufferType               _buffer;
00144     UInt32                   _pos;
00145 
00147     /*==========================  PRIVATE  ================================*/
00148   private:
00149 
00150     typedef NetworkMessage Inherited;
00151 };
00152 
00153 //---------------------------------------------------------------------------
00154 //   Exported Types
00155 //---------------------------------------------------------------------------
00156 
00157 // class pointer
00158 
00159 typedef BinaryMessage *BinaryMessageP;
00160 
00161 OSG_END_NAMESPACE
00162 
00163 #define OSG_BINSOCKETMESSAGEHEADER_CVSID "@(#)$Id:$"
00164 
00165 #include "OSGBinaryMessage.inl"
00166 
00167 #endif /* _BINSOCKETMESSAGE_H_ */

Generated on Thu Aug 25 04:01:18 2005 for OpenSG by  doxygen 1.4.3