#include <OSGBINLoader.h>

Public Member Functions | |
| BinaryFileHandler (std::istream &is) | |
| virtual | ~BinaryFileHandler () |
| void | read (MemoryHandle mem, UInt32 size) |
Put | |
| void | put (void const *src, UInt32 size) |
| void | putAndFree (MemoryHandle src, UInt32 size) |
| void | putValue (const bool &value) |
| void | putValue (const UInt8 &value) |
| void | putValue (const UInt16 &value) |
| void | putValue (const UInt32 &value) |
| void | putValue (const UInt64 &value) |
| void | putValue (const Int8 &value) |
| void | putValue (const Int16 &value) |
| void | putValue (const Int32 &value) |
| void | putValue (const Int64 &value) |
| void | putValue (const Real16 &value) |
| void | putValue (const Real32 &value) |
| void | putValue (const Real64 &value) |
| void | putValue (const Real128 &value) |
| void | putValue (const std::string &value) |
| void | putValues (const bool *value, UInt32 size) |
| void | putValues (const UInt8 *value, UInt32 size) |
| void | putValues (const UInt16 *value, UInt32 size) |
| void | putValues (const UInt32 *value, UInt32 size) |
| void | putValues (const UInt64 *value, UInt32 size) |
| void | putValues (const Int8 *value, UInt32 size) |
| void | putValues (const Int16 *value, UInt32 size) |
| void | putValues (const Int32 *value, UInt32 size) |
| void | putValues (const Int64 *value, UInt32 size) |
| void | putValues (const Real16 *value, UInt32 size) |
| void | putValues (const Real32 *value, UInt32 size) |
| void | putValues (const Real64 *value, UInt32 size) |
| void | putValues (const Real128 *value, UInt32 size) |
| void | putValues (const std::string *value, UInt32 size) |
Get | |
| void | get (void *dst, UInt32 size) |
| void | getAndAlloc (MemoryHandle &src, UInt32 size) |
| void | getValue (bool &value) |
| void | getValue (UInt8 &value) |
| void | getValue (UInt16 &value) |
| void | getValue (UInt32 &value) |
| void | getValue (UInt64 &value) |
| void | getValue (Int8 &value) |
| void | getValue (Int16 &value) |
| void | getValue (Int32 &value) |
| void | getValue (Int64 &value) |
| void | getValue (Real16 &value) |
| void | getValue (Real32 &value) |
| void | getValue (Real64 &value) |
| void | getValue (Real128 &value) |
| void | getValue (std::string &value) |
| void | getValues (bool *value, UInt32 size) |
| void | getValues (UInt8 *value, UInt32 size) |
| void | getValues (UInt16 *value, UInt32 size) |
| void | getValues (UInt32 *value, UInt32 size) |
| void | getValues (UInt64 *value, UInt32 size) |
| void | getValues (Int8 *value, UInt32 size) |
| void | getValues (Int16 *value, UInt32 size) |
| void | getValues (Int32 *value, UInt32 size) |
| void | getValues (Int64 *value, UInt32 size) |
| void | getValues (Real16 *value, UInt32 size) |
| void | getValues (Real32 *value, UInt32 size) |
| void | getValues (Real64 *value, UInt32 size) |
| void | getValues (Real128 *value, UInt32 size) |
| void | getValues (std::string *value, UInt32 size) |
Helper | |
| virtual void | forceCopy (void) |
| virtual void | forceDirectIO (void) |
| void | flush (void) |
| write data not yet written | |
| void | setNetworkOrder (bool value) |
| bool | getNetworkOrder (void) |
Protected Types | |
| typedef std::vector< MemoryBlock > | BuffersT |
| typedef std::list< MemoryHandle > | FreeMemT |
Protected Member Functions | |
Read | |
| BuffersT::iterator | readBufBegin (void) |
| BuffersT::iterator | readBufEnd (void) |
| void | readBufAdd (MemoryHandle mem, UInt32 size, UInt32 dataSize=0) |
| void | readBufClear (void) |
| virtual void | readBuffer (void) |
Write | |
| BuffersT::iterator | writeBufBegin (void) |
| BuffersT::iterator | writeBufEnd (void) |
| void | writeBufAdd (MemoryHandle mem, UInt32 size, UInt32 dataSize=0) |
| void | writeBufClear (void) |
| virtual void | write (MemoryHandle src, UInt32 size) |
| virtual void | writeBuffer (void) |
Helper | |
| bool | isReadBufferEmpty (void) |
Protected Attributes | |
Member | |
| BuffersT | _readBuffers |
| BuffersT | _writeBuffers |
| BuffersT | _zeroCopyBuffers |
| UInt32 | _zeroCopyThreshold |
| FreeMemT | _freeMem |
| BuffersT::iterator | _currentReadBuffer |
| UInt32 | _currentReadBufferPos |
| BuffersT::iterator | _currentWriteBuffer |
| UInt32 | _currentWriteBufferPos |
| bool | _networkOrder |
Private Attributes | |
| std::vector< UInt8 > | _readMemory |
| std::istream & | _is |
Definition at line 105 of file OSGBINLoader.h.
typedef std::vector<MemoryBlock> osg::BinaryDataHandler::BuffersT [protected, inherited] |
Definition at line 213 of file OSGBinaryDataHandler.h.
typedef std::list<MemoryHandle> osg::BinaryDataHandler::FreeMemT [protected, inherited] |
Definition at line 214 of file OSGBinaryDataHandler.h.
| BINLoader::BinaryFileHandler::BinaryFileHandler | ( | std::istream & | is | ) |
constructor
Definition at line 331 of file OSGBINLoader.cpp.
References _readMemory, and osg::BinaryDataHandler::readBufAdd().
00331 : 00332 BinaryDataHandler(0), 00333 _is(is) 00334 { 00335 _readMemory.resize(10000); 00336 readBufAdd(&_readMemory[0], _readMemory.size()); 00337 }
| BINLoader::BinaryFileHandler::~BinaryFileHandler | ( | void | ) | [virtual] |
| void BINLoader::BinaryFileHandler::read | ( | MemoryHandle | mem, | |
| UInt32 | size | |||
| ) | [virtual] |
read
Reimplemented from osg::BinaryDataHandler.
Definition at line 347 of file OSGBINLoader.cpp.
References _is.
00348 { 00349 _is.read((char *) mem, size); 00350 }
| void BinaryDataHandler::put | ( | void const * | src, | |
| UInt32 | size | |||
| ) | [inherited] |
Definition at line 83 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_currentWriteBufferPos, osg::BinaryDataHandler::_zeroCopyBuffers, osg::BinaryDataHandler::_zeroCopyThreshold, osg::osgMin(), osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::write(), and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::BinaryDataHandler::putAndFree(), osg::BinaryDataHandler::putValue(), osg::BinaryDataHandler::putValues(), and osg::ClusterViewBuffer::send().
00084 { 00085 UInt8 const *data = static_cast<UInt8 const *>(src); 00086 00087 if(_zeroCopyThreshold && size >= _zeroCopyThreshold) 00088 { 00089 if(_zeroCopyThreshold == 1) 00090 { 00091 write(const_cast<MemoryHandle>(data), size); 00092 } 00093 else 00094 { 00095 UInt8 tag = 1; 00096 00097 // we have to write a tag, to indicate the membership 00098 // of this zero copy block to the current data block 00099 put(&tag, sizeof(tag)); 00100 00101 _zeroCopyBuffers.push_back( 00102 MemoryBlock(const_cast<MemoryHandle>(data), size, size)); 00103 } 00104 } 00105 else 00106 { 00107 UInt32 copySize; 00108 00109 while(size != 0) 00110 { 00111 if(_currentWriteBuffer == writeBufEnd()) 00112 { 00113 pushBuffer(); 00114 } 00115 00116 copySize = osgMin((_currentWriteBuffer->getSize() - 00117 _currentWriteBufferPos), 00118 size); 00119 00120 memcpy(_currentWriteBuffer->getMem() + _currentWriteBufferPos, 00121 data, 00122 copySize); 00123 00124 size -= copySize; 00125 _currentWriteBufferPos += copySize; 00126 data += copySize; 00127 00128 // skip to next buffer if current buffer is full 00129 if(_currentWriteBufferPos == _currentWriteBuffer->getSize()) 00130 { 00131 _currentWriteBuffer->setDataSize(_currentWriteBufferPos); 00132 _currentWriteBuffer++; 00133 _currentWriteBufferPos = 0; 00134 } 00135 } 00136 } 00137 }
| void BinaryDataHandler::putAndFree | ( | MemoryHandle | src, | |
| UInt32 | size | |||
| ) | [inherited] |
Put data from dynamic allocated block The caller doesn't know, when the block will be written. So we are responsible for freeing this block.
Definition at line 144 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_freeMem, osg::BinaryDataHandler::_zeroCopyThreshold, and osg::BinaryDataHandler::put().
00145 { 00146 put(src, size); 00147 00148 if(_zeroCopyThreshold && size > _zeroCopyThreshold) 00149 { 00150 _freeMem.push_back(src); 00151 } 00152 else 00153 { 00154 delete [] src; 00155 } 00156 }
| void osg::BinaryDataHandler::putValue | ( | const bool & | value | ) | [inline, inherited] |
Definition at line 60 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::put().
Referenced by osg::SortFirstWindow::clientInit(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::osg::FieldDataTraits2< bool >::copyToBin(), osg::RenderNode::copyToBin(), osg::ParticleBSPTree::copyToBin(), osg::MField< FieldTypeT, fieldNameSpace >::copyToBin(), osg::FieldTraitsIntegralRecurseMapper< uint64_t >::copyToBin(), osg::FieldTraitsRecurseBase1< GLXContext >::copyToBin(), osg::FieldTraitsRecurseBase< osg::NodePtr >::copyToBin(), osg::osg::FieldTraitsRecurseMapper< FieldContainerPtr, false >::copyToBin(), osg::osg::FieldDataTraits< Plane >::copyToBin(), osg::osg::FieldDataTraits1< GLenum >::copyToBin(), osg::osg::FieldDataTraits1< BitVector >::copyToBin(), osg::osg::FieldDataTraits< DynamicVolume >::copyToBin(), osg::osg::FieldDataTraits1< Time >::copyToBin(), osg::osg::FieldDataTraits< std::string >::copyToBin(), osg::osg::FieldTraitsRecurseMapper< AttachmentMap, false >::copyToBin(), osg::BINWriter::doWriteIndexedFC(), osg::RemoteAspect::handleFCMapping(), osg::ClusterWindow::init(), osg::BinaryDataHandler::putValue(), osg::BinaryDataHandler::putValues(), osg::ClusterViewBuffer::send(), osg::RemoteAspect::sendSync(), osg::SortFirstWindow::serverInit(), osg::GroupMCastConnection::signal(), osg::ClusterServer::start(), and osg::BINWriter::writeFileHeader().
00061 { 00062 // on Mac OS X a bool is four bytes long on all other 00063 // platfroms it is one byte long. So we write now always 00064 // one byte out. 00065 // put(&value, sizeof(bool)); 00066 UInt8 temp = (UInt8) value; 00067 put(&temp, sizeof(UInt8)); 00068 }
| void osg::BinaryDataHandler::putValue | ( | const UInt8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::putValue | ( | const UInt16 & | value | ) | [inline, inherited] |
Definition at line 77 of file OSGBinaryDataHandler.inl.
References osg::osghtons(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const UInt32 & | value | ) | [inline, inherited] |
Definition at line 85 of file OSGBinaryDataHandler.inl.
References osg::osghtonl(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const UInt64 & | value | ) | [inline, inherited] |
Definition at line 93 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Int8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::putValue | ( | const Int16 & | value | ) | [inline, inherited] |
Definition at line 107 of file OSGBinaryDataHandler.inl.
References osg::osghtons(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Int32 & | value | ) | [inline, inherited] |
Definition at line 115 of file OSGBinaryDataHandler.inl.
References osg::osghtonl(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Int64 & | value | ) | [inline, inherited] |
Definition at line 123 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Real16 & | value | ) | [inline, inherited] |
Definition at line 131 of file OSGBinaryDataHandler.inl.
References osg::Real16::bits(), osg::osghtons(), and osg::BinaryDataHandler::put().
| void osg::BinaryDataHandler::putValue | ( | const Real32 & | value | ) | [inline, inherited] |
Definition at line 139 of file OSGBinaryDataHandler.inl.
References osg::osghtonl(), and osg::BinaryDataHandler::put().
00140 { 00141 UInt32 v = osghtonl( *((const UInt32 *)(&value)) ); 00142 00143 put(&v, sizeof(Real32)); 00144 }
| void osg::BinaryDataHandler::putValue | ( | const Real64 & | value | ) | [inline, inherited] |
Definition at line 147 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
00148 { 00149 UInt64 v = osghtonll( *((const UInt64 *)(&value)) ); 00150 00151 put(&v, sizeof(Real64)); 00152 }
| void osg::BinaryDataHandler::putValue | ( | const Real128 & | value | ) | [inline, inherited] |
Definition at line 155 of file OSGBinaryDataHandler.inl.
References osg::osghtonll(), and osg::BinaryDataHandler::put().
00156 { 00157 UInt64 v = osghtonll( *( (const UInt64 *)(&value)) ); 00158 UInt64 w = osghtonll( *(((const UInt64 *)(&value)) + 1) ); 00159 00160 #if BYTE_ORDER == LITTLE_ENDIAN 00161 put(&w, sizeof(UInt64)); 00162 put(&v, sizeof(UInt64)); 00163 #else 00164 put(&v, sizeof(UInt64)); 00165 put(&w, sizeof(UInt64)); 00166 #endif 00167 }
| void osg::BinaryDataHandler::putValue | ( | const std::string & | value | ) | [inline, inherited] |
Definition at line 170 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::put(), osg::BinaryDataHandler::putValue(), and osg::stringlen().
00171 { 00172 UInt32 len = stringlen(value.c_str()) + 1; 00173 00174 putValue(len); 00175 00176 if(len != 0) 00177 { 00178 put(value.c_str(), len); 00179 } 00180 }
| void osg::BinaryDataHandler::putValues | ( | const bool * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 184 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::putValue().
Referenced by osg::FieldTraitsRecurseVecStoreBase< osg::Pnt2s >::copyToBin(), osg::osg::FieldDataTraits< Quaternion >::copyToBin(), osg::osg::FieldDataTraits< Matrix4d >::copyToBin(), osg::osg::FieldDataTraits< Matrix >::copyToBin(), osg::FieldTraitsIntegralRecurseMapper< uint64_t >::copyToBin(), osg::osg::FieldDataTraits< Plane >::copyToBin(), osg::osg::FieldDataTraits< DynamicVolume >::copyToBin(), osg::osg::FieldDataTraits1< Time >::copyToBin(), osg::osg::FieldDataTraits< Color4ub >::copyToBin(), osg::osg::FieldDataTraits< Color3ub >::copyToBin(), osg::osg::FieldDataTraits< Color4f >::copyToBin(), and osg::osg::FieldDataTraits< Color3f >::copyToBin().
Definition at line 197 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00198 { 00199 #if BYTE_ORDER == LITTLE_ENDIAN 00200 00201 if(_networkOrder == true) 00202 { 00203 for(UInt32 i = 0; i < size; ++i) 00204 { 00205 putValue(value[i]); 00206 } 00207 } 00208 else 00209 #endif 00210 { 00211 put(value, size * sizeof(UInt16)); 00212 } 00213 }
Definition at line 216 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00217 { 00218 #if BYTE_ORDER == LITTLE_ENDIAN 00219 if(_networkOrder == true) 00220 { 00221 for(UInt32 i = 0; i < size; ++i) 00222 { 00223 putValue(value[i]); 00224 } 00225 } 00226 else 00227 #endif 00228 { 00229 put(value, size * sizeof(UInt32)); 00230 } 00231 }
Definition at line 234 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00235 { 00236 #if BYTE_ORDER == LITTLE_ENDIAN 00237 if(_networkOrder == true) 00238 { 00239 for(UInt32 i = 0; i < size; ++i) 00240 { 00241 putValue(value[i]); 00242 } 00243 } 00244 else 00245 #endif 00246 { 00247 put(value, size * sizeof(UInt64)); 00248 } 00249 }
Definition at line 252 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00253 { 00254 #if BYTE_ORDER == LITTLE_ENDIAN 00255 if(_networkOrder == true) 00256 { 00257 for(UInt32 i = 0; i < size; ++i) 00258 { 00259 putValue(value[i]); 00260 } 00261 } 00262 else 00263 #endif 00264 { 00265 put(value, size * sizeof(Int8)); 00266 } 00267 }
Definition at line 270 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00271 { 00272 #if BYTE_ORDER == LITTLE_ENDIAN 00273 if(_networkOrder == true) 00274 { 00275 for(UInt32 i = 0; i < size; ++i) 00276 { 00277 putValue(value[i]); 00278 } 00279 } 00280 else 00281 #endif 00282 { 00283 put(value, size * sizeof(Int16)); 00284 } 00285 }
Definition at line 288 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00289 { 00290 #if BYTE_ORDER == LITTLE_ENDIAN 00291 if(_networkOrder == true) 00292 { 00293 for(UInt32 i = 0; i < size; ++i) 00294 { 00295 putValue(value[i]); 00296 } 00297 } 00298 else 00299 #endif 00300 { 00301 put(value, size * sizeof(Int32)); 00302 } 00303 }
Definition at line 306 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00307 { 00308 #if BYTE_ORDER == LITTLE_ENDIAN 00309 if(_networkOrder == true) 00310 { 00311 for(UInt32 i = 0; i < size; ++i) 00312 { 00313 putValue(value[i]); 00314 } 00315 } 00316 else 00317 #endif 00318 { 00319 put(value, size * sizeof(Int64)); 00320 } 00321 }
Definition at line 324 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00325 { 00326 #if BYTE_ORDER == LITTLE_ENDIAN 00327 if(_networkOrder == true) 00328 { 00329 for(UInt32 i = 0; i < size; ++i) 00330 { 00331 putValue(value[i]); 00332 } 00333 } 00334 else 00335 #endif 00336 { 00337 put(value, size * sizeof(Real16)); 00338 } 00339 }
Definition at line 342 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00343 { 00344 #if BYTE_ORDER == LITTLE_ENDIAN 00345 if(_networkOrder == true) 00346 { 00347 for(UInt32 i = 0; i < size; ++i) 00348 { 00349 putValue(value[i]); 00350 } 00351 } 00352 else 00353 #endif 00354 { 00355 put(value, size * sizeof(Real32)); 00356 } 00357 }
Definition at line 360 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00361 { 00362 #if BYTE_ORDER == LITTLE_ENDIAN 00363 if(_networkOrder == true) 00364 { 00365 for(UInt32 i = 0; i < size; ++i) 00366 { 00367 putValue(value[i]); 00368 } 00369 } 00370 else 00371 #endif 00372 { 00373 put(value, size * sizeof(Real64)); 00374 } 00375 }
Definition at line 378 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::putValue().
00379 { 00380 #if BYTE_ORDER == LITTLE_ENDIAN 00381 if(_networkOrder == true) 00382 { 00383 for(UInt32 i = 0; i < size; ++i) 00384 { 00385 putValue(value[i]); 00386 } 00387 } 00388 else 00389 #endif 00390 { 00391 put(value, size * sizeof(Real128)); 00392 } 00393 }
| void osg::BinaryDataHandler::putValues | ( | const std::string * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 396 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::putValue().
| void BinaryDataHandler::get | ( | void * | dst, | |
| UInt32 | size | |||
| ) | [inherited] |
Definition at line 161 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_currentReadBufferPos, osg::BinaryDataHandler::_zeroCopyThreshold, osg::osgMin(), osg::BinaryDataHandler::pullBuffer(), osg::BinaryDataHandler::read(), and osg::BinaryDataHandler::readBufEnd().
Referenced by osg::RemoteAspect::receiveSync(), and osg::ClusterViewBuffer::recv().
00162 { 00163 MemoryHandle data = static_cast<MemoryHandle>(dst); 00164 00165 if(_zeroCopyThreshold && size >= _zeroCopyThreshold) 00166 { 00167 if(_zeroCopyThreshold > 1) 00168 { 00169 UInt8 tag; 00170 00171 // we have to read the tag, to force reading of data blocks 00172 // if the first data field was zero copied 00173 get(&tag, sizeof(tag)); 00174 } 00175 00176 // read direct into destination 00177 read(data, size); 00178 } 00179 else 00180 { 00181 UInt32 copySize; 00182 00183 while(size != 0) 00184 { 00185 // read new data if nothing left 00186 if(_currentReadBuffer == readBufEnd()) 00187 { 00188 pullBuffer(); 00189 } 00190 00191 // num bytes to copy 00192 copySize = osgMin((_currentReadBuffer->getDataSize() - 00193 _currentReadBufferPos), 00194 size); 00195 00196 // no data in buffer ? 00197 if(copySize != 0) 00198 { 00199 memcpy( data, 00200 _currentReadBuffer->getMem() + _currentReadBufferPos, 00201 copySize); 00202 00203 size -= copySize; 00204 _currentReadBufferPos += copySize; 00205 data += copySize; 00206 } 00207 00208 // skip to next buffer if current buffer is full 00209 if(_currentReadBufferPos == _currentReadBuffer->getDataSize()) 00210 { 00211 _currentReadBuffer++; 00212 _currentReadBufferPos = 0; 00213 } 00214 } 00215 } 00216 }
| void BinaryDataHandler::getAndAlloc | ( | MemoryHandle & | src, | |
| UInt32 | size | |||
| ) | [inherited] |
read data in a dynamic allocated block
If data was compressed or converted then it is not possible to write it into the destination memory. BinaryDataHandler doesn't store data in continous memory areas. If the caller needs a continuous memory then we provide a dynamic allocated block. The caller is responsible to free this block.
Definition at line 227 of file OSGBinaryDataHandler.cpp.
00228 { 00229 src = new UInt8[size]; 00230 00231 get(src, size); 00232 }
| void osg::BinaryDataHandler::getValue | ( | bool & | value | ) | [inline, inherited] |
Definition at line 405 of file OSGBinaryDataHandler.inl.
Referenced by osg::BINLoader::chargeFieldContainers(), osg::SortFirstWindow::clientInit(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::osg::FieldDataTraits2< bool >::copyFromBin(), osg::RenderNode::copyFromBin(), osg::ParticleBSPTree::copyFromBin(), osg::MField< FieldTypeT, fieldNameSpace >::copyFromBin(), osg::FieldTraitsIntegralRecurseMapper< uint64_t >::copyFromBin(), osg::FieldTraitsRecurseBase1< GLXContext >::copyFromBin(), osg::FieldTraitsRecurseBase< osg::NodePtr >::copyFromBin(), osg::osg::FieldTraitsRecurseMapper< FieldContainerPtr, false >::copyFromBin(), osg::osg::FieldDataTraits< Plane >::copyFromBin(), osg::osg::FieldDataTraits1< GLenum >::copyFromBin(), osg::osg::FieldDataTraits1< BitVector >::copyFromBin(), osg::osg::FieldDataTraits< DynamicVolume >::copyFromBin(), osg::osg::FieldDataTraits1< Time >::copyFromBin(), osg::osg::FieldDataTraits< std::string >::copyFromBin(), osg::osg::FieldTraitsRecurseMapper< AttachmentMap, false >::copyFromBin(), osg::BINLoader::createFieldContainers(), osg::BinaryDataHandler::getValue(), osg::BinaryDataHandler::getValues(), osg::ClusterWindow::init(), osg::RemoteAspect::receiveSync(), osg::ClusterViewBuffer::recv(), osg::SortFirstWindow::serverInit(), osg::ClusterServer::start(), and osg::PointMCastConnection::wait().
00406 { 00407 //get(&value, sizeof(bool)); 00408 UInt8 temp; 00409 get(&temp, sizeof(UInt8)); 00410 value = (temp!=0); 00411 }
| void osg::BinaryDataHandler::getValue | ( | UInt8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | UInt16 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | UInt32 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | UInt64 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int8 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int16 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int32 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Int64 & | value | ) | [inline, inherited] |
| void osg::BinaryDataHandler::getValue | ( | Real16 & | value | ) | [inline, inherited] |
Definition at line 474 of file OSGBinaryDataHandler.inl.
References osg::osgntohs(), and osg::Real16::setBits().
00475 { 00476 UInt16 v; 00477 00478 get(&v, sizeof(Real16)); 00479 00480 v = osgntohs(v); 00481 value.setBits(v); 00482 }
| void osg::BinaryDataHandler::getValue | ( | Real32 & | value | ) | [inline, inherited] |
Definition at line 485 of file OSGBinaryDataHandler.inl.
References osg::osgntohf(), and osg::osgntohl().
00486 { 00487 get(&value, sizeof(Real32)); 00488 00489 value = osgntohf(value); 00490 00491 #if 0 00492 // doesn't work on my 64 bit linux ... 00493 UInt32 v; 00494 00495 get(&v, sizeof(Real32)); 00496 00497 v = osgntohl(v); 00498 value = *(reinterpret_cast<Real32 *>(&v)); 00499 #endif 00500 }
| void osg::BinaryDataHandler::getValue | ( | Real64 & | value | ) | [inline, inherited] |
Definition at line 503 of file OSGBinaryDataHandler.inl.
References osg::osgntohd(), and osg::osgntohll().
00504 { 00505 get(&value, sizeof(Real64)); 00506 00507 value = osgntohd(value); 00508 00509 #if 0 00510 UInt64 v; 00511 00512 get(&v, sizeof(Real64)); 00513 00514 v = osgntohll(v); 00515 value = *(reinterpret_cast<Real64 *>(&v)); 00516 #endif 00517 }
| void osg::BinaryDataHandler::getValue | ( | Real128 & | value | ) | [inline, inherited] |
Definition at line 520 of file OSGBinaryDataHandler.inl.
References osg::osgntohdd(), and osg::osgntohll().
00521 { 00522 get(&value, sizeof(Real128)); 00523 00524 value = osgntohdd(value); 00525 00526 #if 0 00527 UInt64 v[2]; 00528 00529 #if BYTE_ORDER == LITTLE_ENDIAN 00530 get(&v[1], sizeof(UInt64)); 00531 get(&v[0], sizeof(UInt64)); 00532 #else 00533 get(&v[0], sizeof(UInt64)); 00534 get(&v[1], sizeof(UInt64)); 00535 #endif 00536 00537 v[0] = osgntohll(v[0]); 00538 v[1] = osgntohll(v[1]); 00539 value = *(reinterpret_cast<Real128 *>(&v)); 00540 #endif 00541 }
| void osg::BinaryDataHandler::getValue | ( | std::string & | value | ) | [inline, inherited] |
Definition at line 544 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::getValue().
00545 { 00546 UInt32 len; 00547 Char8 *str = NULL; 00548 00549 getValue(len); 00550 00551 if(len != 0) 00552 { 00553 str = new Char8[len]; 00554 00555 get(str, len); 00556 00557 value = str; 00558 00559 delete [] str; 00560 } 00561 else 00562 { 00563 value.erase(); 00564 } 00565 }
| void osg::BinaryDataHandler::getValues | ( | bool * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 568 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::getValue().
Referenced by osg::FieldTraitsRecurseVecStoreBase< osg::Pnt2s >::copyFromBin(), osg::osg::FieldDataTraits< Quaternion >::copyFromBin(), osg::osg::FieldDataTraits< Matrix4d >::copyFromBin(), osg::osg::FieldDataTraits< Matrix >::copyFromBin(), osg::FieldTraitsIntegralRecurseMapper< uint64_t >::copyFromBin(), osg::osg::FieldDataTraits< Plane >::copyFromBin(), osg::osg::FieldDataTraits< DynamicVolume >::copyFromBin(), osg::osg::FieldDataTraits1< Time >::copyFromBin(), osg::osg::FieldDataTraits< Color4ub >::copyFromBin(), osg::osg::FieldDataTraits< Color3ub >::copyFromBin(), osg::osg::FieldDataTraits< Color4f >::copyFromBin(), and osg::osg::FieldDataTraits< Color3f >::copyFromBin().
Definition at line 581 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohs().
00582 { 00583 get(value, size * sizeof(UInt16)); 00584 00585 #if BYTE_ORDER == LITTLE_ENDIAN 00586 if(_networkOrder == true) 00587 { 00588 for(UInt32 i = 0; i < size; ++i) 00589 { 00590 value[i] = osgntohs(value[i]); 00591 } 00592 } 00593 #endif 00594 }
Definition at line 597 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohl().
00598 { 00599 get(value, size * sizeof(UInt32)); 00600 00601 #if BYTE_ORDER == LITTLE_ENDIAN 00602 if(_networkOrder == true) 00603 { 00604 for(UInt32 i = 0; i < size; ++i) 00605 { 00606 value[i] = osgntohl(value[i]); 00607 } 00608 } 00609 #endif 00610 }
Definition at line 613 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00614 { 00615 get(value, size * sizeof(UInt64)); 00616 00617 #if BYTE_ORDER == LITTLE_ENDIAN 00618 if(_networkOrder == true) 00619 { 00620 for(UInt32 i = 0; i < size; ++i) 00621 { 00622 value[i] = osgntohll(value[i]); 00623 } 00624 } 00625 #endif 00626 }
Definition at line 635 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohs().
00636 { 00637 get(value, size * sizeof(Int16)); 00638 00639 #if BYTE_ORDER == LITTLE_ENDIAN 00640 if(_networkOrder == true) 00641 { 00642 for(UInt32 i = 0; i < size; ++i) 00643 { 00644 value[i] = osgntohs(value[i]); 00645 } 00646 } 00647 #endif 00648 }
Definition at line 651 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohl().
00652 { 00653 get(value, size * sizeof(Int32)); 00654 00655 #if BYTE_ORDER == LITTLE_ENDIAN 00656 if(_networkOrder == true) 00657 { 00658 for(UInt32 i = 0; i < size; ++i) 00659 { 00660 value[i] = osgntohl(value[i]); 00661 } 00662 } 00663 #endif 00664 }
Definition at line 667 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00668 { 00669 get(value, size * sizeof(Int64)); 00670 00671 #if BYTE_ORDER == LITTLE_ENDIAN 00672 if(_networkOrder == true) 00673 { 00674 for(UInt32 i = 0; i < size; ++i) 00675 { 00676 value[i] = osgntohll(value[i]); 00677 } 00678 } 00679 #endif 00680 }
Definition at line 683 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, osg::osgntohs(), and osg::Real16::setBits().
00684 { 00685 get(value, size * sizeof(Real16)); 00686 00687 #if BYTE_ORDER == LITTLE_ENDIAN 00688 if(_networkOrder == true) 00689 { 00690 UInt16 *intValue = reinterpret_cast<UInt16 *>(value); 00691 00692 for(UInt32 i = 0; i < size; ++i) 00693 { 00694 value[i].setBits(osgntohs(intValue[i])); 00695 } 00696 } 00697 #endif 00698 }
Definition at line 701 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohl().
00702 { 00703 get(value, size * sizeof(Real32)); 00704 00705 #if BYTE_ORDER == LITTLE_ENDIAN 00706 if(_networkOrder == true) 00707 { 00708 UInt32 *intValue = reinterpret_cast<UInt32 *>(value); 00709 00710 for(UInt32 i = 0; i < size; ++i) 00711 { 00712 intValue[i] = osgntohl(intValue[i]); 00713 } 00714 } 00715 #endif 00716 }
Definition at line 719 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00720 { 00721 get(value, size * sizeof(Real64)); 00722 00723 #if BYTE_ORDER == LITTLE_ENDIAN 00724 if(_networkOrder == true) 00725 { 00726 UInt64 *longValue = reinterpret_cast<UInt64 *>(value); 00727 00728 for(UInt32 i = 0; i < size; ++i) 00729 { 00730 longValue[i] = osgntohll(longValue[i]); 00731 } 00732 } 00733 #endif 00734 }
Definition at line 737 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_networkOrder, and osg::osgntohll().
00738 { 00739 get(value, size * sizeof(UInt64) * 2); 00740 00741 #if BYTE_ORDER == LITTLE_ENDIAN 00742 if(_networkOrder == true) 00743 { 00744 UInt64 *longValue = reinterpret_cast<UInt64 *>(value); 00745 00746 for(UInt32 i = 0; i < size; i += 2) 00747 { 00748 UInt64 l = longValue[i]; 00749 longValue[i] = osgntohll(longValue[i + 1]); 00750 longValue[i + 1] = osgntohll(longValue[l ]); 00751 } 00752 } 00753 #endif 00754 }
| void osg::BinaryDataHandler::getValues | ( | std::string * | value, | |
| UInt32 | size | |||
| ) | [inline, inherited] |
Definition at line 757 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::getValue().
| void BinaryDataHandler::forceCopy | ( | void | ) | [virtual, inherited] |
always copy memory blocks befor write forceCopy must be called for all endpoints of this connection
Definition at line 260 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_zeroCopyThreshold.
00261 { 00262 _zeroCopyThreshold = 0; 00263 }
| void BinaryDataHandler::forceDirectIO | ( | void | ) | [virtual, inherited] |
always read or write directly into or from memory blocks forceDirectIO must be called for all endpoints of this connection
Definition at line 268 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_zeroCopyThreshold.
00269 { 00270 _zeroCopyThreshold = 1; 00271 }
| void BinaryDataHandler::flush | ( | void | ) | [inherited] |
Definition at line 239 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_currentWriteBufferPos, osg::BinaryDataHandler::pushBuffer(), and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::SortFirstWindow::clientInit(), osg::ClusterNetwork::connectAllGroupToPoint(), osg::ClusterNetwork::connectAllPointToPoint(), osg::ClusterWindow::init(), osg::ClusterViewBuffer::send(), osg::RemoteAspect::sendSync(), osg::SortFirstWindow::serverInit(), osg::GroupMCastConnection::signal(), osg::ClusterServer::start(), and osg::BINWriter::write().
00240 { 00241 if(_currentWriteBuffer != writeBufEnd()) 00242 { 00243 // mark rest of buffer as empty 00244 _currentWriteBuffer->setDataSize(_currentWriteBufferPos); 00245 _currentWriteBuffer++; 00246 00247 while(_currentWriteBuffer != writeBufEnd()) 00248 { 00249 _currentWriteBuffer->setDataSize(0); 00250 _currentWriteBuffer++; 00251 } 00252 } 00253 00254 pushBuffer(); 00255 }
| void BinaryDataHandler::setNetworkOrder | ( | bool | value | ) | [inherited] |
always copy memory blocks befor write forceCopy must be called for all endpoints of this connection
Definition at line 277 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_networkOrder.
Referenced by osg::ClusterWindow::init(), and osg::ClusterServer::start().
00278 { 00279 _networkOrder = value; 00280 }
| bool BinaryDataHandler::getNetworkOrder | ( | void | ) | [inherited] |
always copy memory blocks befor write forceCopy must be called for all endpoints of this connection
Definition at line 282 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_networkOrder.
00283 { 00284 return _networkOrder; 00285 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::readBufBegin | ( | void | ) | [inline, protected, inherited] |
Definition at line 812 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_readBuffers.
Referenced by osg::BinaryDataHandler::pullBuffer(), osg::PointSockPipeline::readBuffer(), osg::PointSockConnection::readBuffer(), osg::PointMCastConnection::readBuffer(), osg::GroupSockConnection::readBuffer(), and osg::BinaryDataHandler::readBuffer().
00813 { 00814 return _readBuffers.begin(); 00815 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::readBufEnd | ( | void | ) | [inline, protected, inherited] |
Definition at line 818 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_readBuffers.
Referenced by osg::BinaryDataHandler::get(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::BinaryDataHandler::readBufAdd(), osg::BinaryDataHandler::readBufClear(), osg::BinaryDataHandler::readBuffer(), and osg::GroupSockConnection::selectChannel().
00819 { 00820 return _readBuffers.end(); 00821 }
| void BinaryDataHandler::readBufAdd | ( | MemoryHandle | mem, | |
| UInt32 | size, | |||
| UInt32 | dataSize = 0 | |||
| ) | [protected, inherited] |
Definition at line 290 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_readBuffers, and osg::BinaryDataHandler::readBufEnd().
Referenced by BinaryFileHandler(), osg::GroupSockConnection::GroupSockConnection(), osg::PointSockConnection::PointSockConnection(), and osg::GroupSockConnection::setParams().
00293 { 00294 MemoryBlock memBlock(mem, size, dataSize); 00295 00296 _readBuffers.push_back(memBlock); 00297 00298 _currentReadBuffer = readBufEnd(); 00299 }
| void BinaryDataHandler::readBufClear | ( | void | ) | [protected, inherited] |
Definition at line 301 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_readBuffers, and osg::BinaryDataHandler::readBufEnd().
Referenced by osg::GroupSockConnection::setParams().
00302 { 00303 _readBuffers.clear(); 00304 00305 _currentReadBuffer=readBufEnd(); 00306 }
| void BinaryDataHandler::readBuffer | ( | void | ) | [protected, virtual, inherited] |
default buffer read
Use direct read to implement buffer read. First read buffer size and then read rest of buffer
Reimplemented in osg::GroupSockConnection, osg::PointMCastConnection, osg::PointSockConnection, and osg::PointSockPipeline.
Definition at line 346 of file OSGBinaryDataHandler.cpp.
References osg::osgMin(), osg::osgntohl(), osg::BinaryDataHandler::read(), osg::BinaryDataHandler::readBufBegin(), osg::BinaryDataHandler::readBufEnd(), and SFATAL.
Referenced by osg::BinaryDataHandler::pullBuffer().
00347 { 00348 BuffersT::iterator i; 00349 UInt32 size,nsize; 00350 UInt32 readSize; 00351 00352 // read buffer size 00353 read((MemoryHandle) &nsize, sizeof(UInt32)); 00354 size = osgntohl(nsize); 00355 00356 // read rest of buffer 00357 for(i = readBufBegin(); size != 0; ++i) 00358 { 00359 if(i == readBufEnd()) 00360 { 00361 SFATAL << "Read buffer is to small. " << size 00362 << "bytes missing" << std::endl; 00363 00364 throw ReadError("Read buffer to small for whole block"); 00365 } 00366 00367 readSize = osgMin(size, i->getSize()); 00368 00369 read(i->getMem(), readSize); 00370 00371 i->setDataSize(readSize); 00372 00373 size -= readSize; 00374 } 00375 00376 for(; i != readBufEnd(); ++i) 00377 { 00378 i->setDataSize(0); 00379 } 00380 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::writeBufBegin | ( | void | ) | [inline, protected, inherited] |
Definition at line 824 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_writeBuffers.
Referenced by osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::writeBufAdd(), osg::PointSockConnection::writeBuffer(), osg::GroupSockPipeline::writeBuffer(), osg::GroupSockConnection::writeBuffer(), osg::GroupMCastConnection::writeBuffer(), and osg::BinaryDataHandler::writeBuffer().
00825 { 00826 return _writeBuffers.begin(); 00827 }
| BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::writeBufEnd | ( | void | ) | [inline, protected, inherited] |
Definition at line 830 of file OSGBinaryDataHandler.inl.
References osg::BinaryDataHandler::_writeBuffers.
Referenced by osg::BinaryDataHandler::flush(), osg::BinaryDataHandler::put(), osg::BinaryDataHandler::writeBufClear(), and osg::BinaryDataHandler::writeBuffer().
00831 { 00832 return _writeBuffers.end(); 00833 }
| void BinaryDataHandler::writeBufAdd | ( | MemoryHandle | mem, | |
| UInt32 | size, | |||
| UInt32 | dataSize = 0 | |||
| ) | [protected, inherited] |
Definition at line 311 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_currentWriteBufferPos, osg::BinaryDataHandler::_writeBuffers, and osg::BinaryDataHandler::writeBufBegin().
Referenced by osg::BINWriter::BinaryFileHandler::BinaryFileHandler(), osg::GroupSockConnection::GroupSockConnection(), osg::PointSockConnection::PointSockConnection(), and osg::GroupSockConnection::setParams().
00314 { 00315 MemoryBlock memBlock(mem, size, dataSize); 00316 00317 _writeBuffers.push_back(memBlock); 00318 00319 _currentWriteBuffer = writeBufBegin(); 00320 _currentWriteBufferPos = 0; 00321 }
| void BinaryDataHandler::writeBufClear | ( | void | ) | [protected, inherited] |
Definition at line 323 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentWriteBuffer, osg::BinaryDataHandler::_writeBuffers, and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::GroupSockConnection::setParams().
00324 { 00325 _writeBuffers.clear(); 00326 00327 _currentWriteBuffer = writeBufEnd(); 00328 }
| void BinaryDataHandler::write | ( | MemoryHandle | src, | |
| UInt32 | size | |||
| ) | [protected, virtual, inherited] |
direct buffer write, write data into given buffer
Reimplemented in osg::GroupMCastConnection, osg::GroupSockConnection, osg::GroupSockPipeline, osg::PointSockConnection, and osg::BINWriter::BinaryFileHandler.
Definition at line 446 of file OSGBinaryDataHandler.cpp.
References SWARNING.
Referenced by osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::writeBuffer().
00448 { 00449 SWARNING << "BinaryDataHandler::write(MemoryHandle mem,int size) called" 00450 << std::endl; 00451 }
| void BinaryDataHandler::writeBuffer | ( | void | ) | [protected, virtual, inherited] |
default buffer write, use direct write to implement buffer write.
Reimplemented in osg::GroupMCastConnection, osg::GroupSockConnection, osg::GroupSockPipeline, and osg::PointSockConnection.
Definition at line 402 of file OSGBinaryDataHandler.cpp.
References osg::osghtonl(), osg::BinaryDataHandler::write(), osg::BinaryDataHandler::writeBufBegin(), and osg::BinaryDataHandler::writeBufEnd().
Referenced by osg::BinaryDataHandler::pushBuffer().
00403 { 00404 BuffersT::iterator i; 00405 UInt32 size = 0; 00406 UInt32 nsize; 00407 00408 // calculate blocksize 00409 for(i = writeBufBegin(); i != writeBufEnd(); ++i) 00410 { 00411 size += i->getDataSize(); 00412 } 00413 00414 // write buffer size 00415 nsize = osghtonl(size); 00416 00417 write((MemoryHandle) &nsize, sizeof(UInt32)); 00418 00419 // write buffers 00420 for(i = writeBufBegin(); i != writeBufEnd(); ++i) 00421 { 00422 if(i->getDataSize() != 0) 00423 { 00424 write(i->getMem(), i->getDataSize()); 00425 } 00426 } 00427 }
| bool BinaryDataHandler::isReadBufferEmpty | ( | void | ) | [protected, inherited] |
check for data in read buffer
Definition at line 431 of file OSGBinaryDataHandler.cpp.
References osg::BinaryDataHandler::_currentReadBuffer, osg::BinaryDataHandler::_zeroCopyThreshold, and osg::BinaryDataHandler::readBufEnd().
Referenced by osg::PointMCastConnection::selectChannel().
00432 { 00433 if(_zeroCopyThreshold == 1) 00434 return true; 00435 if(_currentReadBuffer == readBufEnd()) 00436 return true; 00437 return false; 00438 }
std::vector<UInt8> osg::BINLoader::BinaryFileHandler::_readMemory [private] |
std::istream& osg::BINLoader::BinaryFileHandler::_is [private] |
BuffersT osg::BinaryDataHandler::_readBuffers [protected, inherited] |
Definition at line 220 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::readBufAdd(), osg::BinaryDataHandler::readBufBegin(), osg::BinaryDataHandler::readBufClear(), and osg::BinaryDataHandler::readBufEnd().
BuffersT osg::BinaryDataHandler::_writeBuffers [protected, inherited] |
Definition at line 221 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::writeBufAdd(), osg::BinaryDataHandler::writeBufBegin(), osg::BinaryDataHandler::writeBufClear(), and osg::BinaryDataHandler::writeBufEnd().
BuffersT osg::BinaryDataHandler::_zeroCopyBuffers [protected, inherited] |
Definition at line 222 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::pushBuffer(), and osg::BinaryDataHandler::put().
UInt32 osg::BinaryDataHandler::_zeroCopyThreshold [protected, inherited] |
Definition at line 223 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::forceCopy(), osg::BinaryDataHandler::forceDirectIO(), osg::BinaryDataHandler::get(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::BinaryDataHandler::put(), osg::BinaryDataHandler::putAndFree(), and osg::GroupSockConnection::selectChannel().
FreeMemT osg::BinaryDataHandler::_freeMem [protected, inherited] |
Definition at line 225 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::freeMem(), and osg::BinaryDataHandler::putAndFree().
BuffersT::iterator osg::BinaryDataHandler::_currentReadBuffer [protected, inherited] |
Definition at line 226 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::get(), osg::BinaryDataHandler::isReadBufferEmpty(), osg::BinaryDataHandler::pullBuffer(), osg::BinaryDataHandler::readBufAdd(), osg::BinaryDataHandler::readBufClear(), and osg::GroupSockConnection::selectChannel().
UInt32 osg::BinaryDataHandler::_currentReadBufferPos [protected, inherited] |
Definition at line 227 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::get(), and osg::BinaryDataHandler::pullBuffer().
BuffersT::iterator osg::BinaryDataHandler::_currentWriteBuffer [protected, inherited] |
Definition at line 228 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::flush(), osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::put(), osg::BinaryDataHandler::writeBufAdd(), and osg::BinaryDataHandler::writeBufClear().
UInt32 osg::BinaryDataHandler::_currentWriteBufferPos [protected, inherited] |
Definition at line 229 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::flush(), osg::BinaryDataHandler::pushBuffer(), osg::BinaryDataHandler::put(), and osg::BinaryDataHandler::writeBufAdd().
bool osg::BinaryDataHandler::_networkOrder [protected, inherited] |
Definition at line 231 of file OSGBinaryDataHandler.h.
Referenced by osg::BinaryDataHandler::getNetworkOrder(), osg::BinaryDataHandler::getValues(), osg::BinaryDataHandler::putValues(), and osg::BinaryDataHandler::setNetworkOrder().
1.5.5