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 _DGRAM_H_ 00040 #define _DGRAM_H_ 00041 #ifdef __sgi 00042 #pragma once 00043 #endif 00044 00045 #include <list> 00046 #include <vector> 00047 00048 #include <OSGBaseTypes.h> 00049 #include <OSGTime.h> 00050 #include <OSGBase.h> 00051 #include <OSGLock.h> 00052 #include <OSGBaseFunctions.h> 00053 00054 OSG_BEGIN_NAMESPACE 00055 00056 /* Package len */ 00057 #define OSG_DGRAM_LEN 9216 00058 00059 /* num of Packages in read or write queue */ 00060 #define OSG_DGRAM_QUEUE_LEN 500 00061 00062 //#define TEST_LOST_DGRAM_RATE 0.1 00063 00064 class OSG_BASE_DLLMAPPING Dgram 00065 { 00066 /*========================== PUBLIC =================================*/ 00067 public: 00068 00069 /*---------------------------------------------------------------------*/ 00073 Dgram(); 00074 ~Dgram(); 00075 00077 /*---------------------------------------------------------------------*/ 00081 inline static Dgram *create (void ); 00082 inline static void release(Dgram *dgram); 00083 00085 /*---------------------------------------------------------------------*/ 00089 inline UInt32 getCapacity (void) const; 00090 inline UInt16 getId (void) const; 00091 inline bool getResponseAck (void) const; 00092 inline UInt32 getSize (void) const; 00093 inline UChar8 *getData (void); 00094 inline const UChar8 *getData (void) const; 00095 00096 inline UChar8 *getBuffer (void); 00097 inline UInt32 getBufferSize (void) const; 00098 inline UInt32 getBufferCapacity(void) const; 00099 00100 inline bool getEarlySend (void) const; 00101 00103 /*---------------------------------------------------------------------*/ 00107 inline void setSize (UInt32 size ); 00108 inline void setResponseSize (void ); 00109 inline void setId (UInt16 id ); 00110 inline void setResponseAck (bool value ); 00111 00112 inline void setBufferSize (UInt32 size ); 00113 00114 inline void setEarlySend (bool value ); 00115 00117 /*---------------------------------------------------------------------*/ 00121 inline bool operator < (const Dgram &other) const; 00122 inline static bool less(UInt16,UInt16); 00123 00125 /*========================= PROTECTED ===============================*/ 00126 protected: 00127 00128 /*---------------------------------------------------------------------*/ 00132 bool _earlySend; 00133 UInt32 _size; 00134 struct { 00135 UInt16 _id; 00136 UChar8 _data[OSG_DGRAM_LEN-2]; 00137 } _buffer; 00138 00140 /*========================== PRIVATE ================================*/ 00141 private: 00142 00143 }; 00144 00145 // class pointer 00146 typedef Dgram *DgramP; 00147 00148 OSG_END_NAMESPACE 00149 00150 #include "OSGDgram.inl" 00151 00152 #define OSG_DGRAMHEADER_CVSID "@(#)$Id:$" 00153 00154 #endif /* _DGRAM_H_ */
1.6.1