#include <OSGPointSockPipeline.h>

Public Types | |
public types | |
| typedef Int32 | Channel |
Public Member Functions | |
Constructors | |
| PointSockPipeline (void) | |
| virtual | ~PointSockPipeline (void) |
type info | |
| virtual const ConnectionType * | getType (void) |
connection | |
| virtual Channel | connectGroup (const std::string &address, Time timeout=-1) |
| virtual void | disconnect (void) |
| virtual Channel | acceptGroup (Time timeout=-1) |
channel handling | |
| virtual Channel | selectChannel (Time timeout=-1) throw (ReadError) |
connection | |
| virtual Channel | connectPoint (const std::string &address, Time timeout=-1) |
| virtual Channel | acceptPoint (Time timeout=-1) |
| virtual std::string | bind (const std::string &interf) |
synchronisation | |
| virtual bool | wait (Time timeout) throw (ReadError ) |
| virtual void | signal (void) throw (WriteError) |
params | |
| virtual void | setParams (const std::string ¶ms) |
interface | |
| const std::string & | getInterface (void) |
| void | setInterface (const std::string &interf) |
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) |
Static Public Member Functions | |
create | |
| static PointConnection * | create (void) |
| create conneciton | |
Protected Types | |
| typedef std::vector< MemoryBlock > | BuffersT |
| typedef std::list< MemoryHandle > | FreeMemT |
Protected Member Functions | |
IO Implementation | |
| virtual void | read (MemoryHandle mem, UInt32 size) |
| virtual void | readBuffer (void) |
IO Implementation | |
| virtual void | write (MemoryHandle mem, UInt32 size) |
| virtual void | writeBuffer (void) |
Read | |
| BuffersT::iterator | readBufBegin (void) |
| BuffersT::iterator | readBufEnd (void) |
| void | readBufAdd (MemoryHandle mem, UInt32 size, UInt32 dataSize=0) |
| void | readBufClear (void) |
Write | |
| BuffersT::iterator | writeBufBegin (void) |
| BuffersT::iterator | writeBufEnd (void) |
| void | writeBufAdd (MemoryHandle mem, UInt32 size, UInt32 dataSize=0) |
| void | writeBufClear (void) |
Helper | |
| bool | isReadBufferEmpty (void) |
Protected Attributes | |
members | |
| StreamSocket | _next |
| StreamSocket | _prev |
| bool | _last |
| bool | _initialized |
members | |
| StreamSocket | _acceptSocket |
| StreamSocket | _socket |
| SocketAddress | _remoteAddress |
| std::vector< UInt8 > | _socketReadBuffer |
| std::vector< UInt8 > | _socketWriteBuffer |
members | |
| bool | _pointToPoint |
protected members | |
| std::string | _interface |
Member | |
| BuffersT | _readBuffers |
| BuffersT | _writeBuffers |
| BuffersT | _zeroCopyBuffers |
| UInt32 | _zeroCopyThreshold |
| FreeMemT | _freeMem |
| BuffersT::iterator | _currentReadBuffer |
| UInt32 | _currentReadBufferPos |
| BuffersT::iterator | _currentWriteBuffer |
| UInt32 | _currentWriteBufferPos |
| bool | _networkOrder |
Private Types | |
| typedef PointSockConnection | Inherited |
Private Member Functions | |
| PointSockPipeline (const PointSockPipeline &source) | |
| PointSockPipeline & | operator= (const PointSockPipeline &source) |
private helpers | |
| void | initialize (void) |
Static Private Attributes | |
static type | |
| static ConnectionType | _type |
Definition at line 62 of file OSGPointSockPipeline.h.
typedef PointSockConnection osg::PointSockPipeline::Inherited [private] |
typedef Int32 osg::Connection::Channel [inherited] |
Definition at line 69 of file OSGConnection.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.
| PointSockPipeline::PointSockPipeline | ( | void | ) |
Constructor
Definition at line 69 of file OSGPointSockPipeline.cpp.
References _next, _prev, and osg::StreamSocket::open().
Referenced by create().
00069 : 00070 Inherited(), 00071 _initialized(false) 00072 { 00073 _prev.open(); 00074 _next.open(); 00075 }
| PointSockPipeline::~PointSockPipeline | ( | void | ) | [virtual] |
Destructor
Definition at line 79 of file OSGPointSockPipeline.cpp.
References _next, _prev, and osg::StreamSocket::close().
| osg::PointSockPipeline::PointSockPipeline | ( | const PointSockPipeline & | source | ) | [private] |
| const ConnectionType * PointSockPipeline::getType | ( | void | ) | [virtual] |
get connection type
Reimplemented from osg::PointSockConnection.
Definition at line 87 of file OSGPointSockPipeline.cpp.
References _type.
00088 { 00089 return &_type; 00090 }
| Connection::Channel PointSockPipeline::connectGroup | ( | const std::string & | address, | |
| Time | timeout = -1 | |||
| ) | [virtual] |
connect to the given group. If timeout is reached, -1 is returned
Reimplemented from osg::PointSockConnection.
Definition at line 98 of file OSGPointSockPipeline.cpp.
References osg::PointSockConnection::connectGroup().
00101 { 00102 Channel channel = Inherited::connectGroup(address,timeout); 00103 return channel; 00104 }
| void PointSockPipeline::disconnect | ( | void | ) | [virtual] |
disconnect the given channel
Reimplemented from osg::PointSockConnection.
Definition at line 108 of file OSGPointSockPipeline.cpp.
References osg::PointSockConnection::_socket, and osg::StreamSocket::close().
| Connection::Channel PointSockPipeline::acceptGroup | ( | Time | timeout = -1 |
) | [virtual] |
accept an icomming grop connection. If timeout is reached, -1 is returned. If timeout is -1 then wait without timeout
Reimplemented from osg::PointSockConnection.
Definition at line 116 of file OSGPointSockPipeline.cpp.
References osg::PointSockConnection::acceptGroup().
00117 { 00118 Channel channel = Inherited::acceptGroup(timeout); 00119 return channel; 00120 }
| Connection::Channel PointSockPipeline::selectChannel | ( | Time | timeout = -1 |
) | throw (ReadError) [virtual] |
select the next channel for reading. If timeout is not -1 then -1 is returned if timeout is reached
Reimplemented from osg::PointSockConnection.
Definition at line 128 of file OSGPointSockPipeline.cpp.
References _initialized, _prev, initialize(), osg::Socket::waitReadable(), and osg::Exception::what().
00130 { 00131 if(!_initialized) 00132 initialize(); 00133 try 00134 { 00135 if(_prev.waitReadable(timeout)) 00136 return 0; 00137 } 00138 catch(SocketError &e) 00139 { 00140 throw ReadError(e.what()); 00141 } 00142 return -1; 00143 }
| ConnectionType PointSockPipeline::_type & PointSockPipeline::create | ( | void | ) | [static] |
Reimplemented from osg::PointSockConnection.
Definition at line 150 of file OSGPointSockPipeline.cpp.
References PointSockPipeline().
00151 { 00152 return new PointSockPipeline(); 00153 }
| void PointSockPipeline::read | ( | MemoryHandle | mem, | |
| UInt32 | size | |||
| ) | [protected, virtual] |
Read data into given memory
Read data form the current read socket. The read socket is that socket, that was selectet in selectChannel.
Reimplemented from osg::PointSockConnection.
Definition at line 165 of file OSGPointSockPipeline.cpp.
References _initialized, _last, _next, _prev, initialize(), osg::Socket::recv(), and osg::Socket::send().
00166 { 00167 int len; 00168 00169 if(!_initialized) 00170 initialize(); 00171 // read data 00172 len=_prev.recv(mem,size); 00173 if(len==0) 00174 { 00175 throw ReadError("read got 0 bytes!"); 00176 } 00177 // send to next in chain 00178 if(!_last) 00179 _next.send(mem,size); 00180 }
| void PointSockPipeline::readBuffer | ( | void | ) | [protected, virtual] |
Read next data block
The stream connection uses only BinaryDataHandler buffer. If more then one buffer is present, then this methode must be changed!
Reimplemented from osg::PointSockConnection.
Definition at line 189 of file OSGPointSockPipeline.cpp.
References _initialized, _last, _next, _prev, osg::PointSockConnection::_socketReadBuffer, initialize(), osg::osgntohl(), osg::BinaryDataHandler::readBufBegin(), osg::Socket::recv(), and osg::Socket::send().
00190 { 00191 int size; 00192 int len; 00193 00194 if(!_initialized) 00195 initialize(); 00196 00197 // read buffer header 00198 len=_prev.recv(&_socketReadBuffer[0],sizeof(SocketBufferHeader)); 00199 if(len==0) 00200 throw ReadError("peek got 0 bytes!"); 00201 // read remaining data 00202 size=osgntohl(((SocketBufferHeader*)&_socketReadBuffer[0])->size); 00203 len=_prev.recv(&_socketReadBuffer[sizeof(SocketBufferHeader)], 00204 size); 00205 if(len==0) 00206 throw ReadError("read got 0 bytes!"); 00207 readBufBegin()->setDataSize(size); 00208 // send to next in chain 00209 if(!_last) 00210 _next.send(&_socketReadBuffer[0], 00211 sizeof(SocketBufferHeader)+size); 00212 }
| void PointSockPipeline::initialize | ( | void | ) | [private] |
initialize pipeline
Definition at line 219 of file OSGPointSockPipeline.cpp.
References _initialized, _last, _next, _prev, osg::PointSockConnection::_socket, osg::StreamSocket::accept(), osg::Socket::bind(), osg::StreamSocket::close(), osg::Socket::connect(), osg::Socket::getAddress(), osg::Connection::getInterface(), osg::SocketAddress::getPort(), osg::BinaryMessage::getString(), osg::BinaryMessage::getUInt32(), osg::Socket::listen(), osg::StreamSocket::open(), osg::osgGetHostname(), osg::BinaryMessage::putString(), osg::BinaryMessage::putUInt32(), osg::Socket::recv(), and osg::Socket::send().
Referenced by read(), readBuffer(), and selectChannel().
00220 { 00221 BinaryMessage message; 00222 StreamSocket sock; 00223 UInt32 nextPort; 00224 std::string nextHost; 00225 UInt32 len; 00226 char localhost[256]; 00227 std::string interf; 00228 00229 // get local host name 00230 osgGetHostname(localhost,255); 00231 if(!getInterface().empty()) 00232 interf = getInterface(); 00233 else 00234 interf = localhost; 00235 00236 sock.open(); 00237 sock.bind(SocketAddress(interf.c_str(),0)); 00238 sock.listen(); 00239 00240 // send my own address 00241 message.putString(interf); 00242 message.putUInt32(sock.getAddress().getPort()); 00243 _socket.send(message); 00244 // accept prev 00245 _prev = sock.accept(); 00246 sock.close(); 00247 00248 len = _socket.recv(message); 00249 if(len == 0) 00250 throw ReadError("Channel closed\n"); 00251 _last = message.getUInt32(); 00252 if(!_last) 00253 { 00254 nextHost = message.getString(); 00255 nextPort = message.getUInt32(); 00256 for(;;) 00257 { 00258 try 00259 { 00260 _next.connect(SocketAddress(nextHost.c_str(), 00261 nextPort)); 00262 break; 00263 } 00264 catch(...) 00265 { 00266 } 00267 } 00268 } 00269 00270 _initialized = true; 00271 }
| PointSockPipeline& osg::PointSockPipeline::operator= | ( | const PointSockPipeline & | source | ) | [private] |
| Connection::Channel PointSockConnection::connectPoint | ( | const std::string & | address, | |
| Time | timeout = -1 | |||
| ) | [virtual, inherited] |
connect to the given point. If timeout is reached, -1 is returned
Implements osg::Connection.
Definition at line 101 of file OSGPointSockConnection.cpp.
References osg::PointConnection::_pointToPoint, osg::PointSockConnection::_remoteAddress, osg::PointSockConnection::_socket, and osg::GroupSockConnection::connectSocket().
00104 { 00105 StreamSocket socket; 00106 if(GroupSockConnection::connectSocket(socket,address,_remoteAddress,timeout)) 00107 { 00108 _socket = socket; 00109 _pointToPoint = true; 00110 return true; 00111 } 00112 else 00113 { 00114 return false; 00115 } 00116 }
| Connection::Channel PointSockConnection::acceptPoint | ( | Time | timeout = -1 |
) | [virtual, inherited] |
accept an icomming point connection. If timeout is reached, -1 is returned. If timeout is -1 then wait without timeout
Implements osg::Connection.
Definition at line 148 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_acceptSocket, osg::PointConnection::_pointToPoint, osg::PointSockConnection::_remoteAddress, osg::PointSockConnection::_socket, and osg::GroupSockConnection::acceptSocket().
00149 { 00150 if(GroupSockConnection::acceptSocket(_acceptSocket,_socket,_remoteAddress,timeout)) 00151 { 00152 _pointToPoint = true; 00153 return 0; 00154 } 00155 else 00156 { 00157 return -1; 00158 } 00159 }
| std::string PointSockConnection::bind | ( | const std::string & | address | ) | [virtual, inherited] |
bind the connection to a network interface. The address is returned, on wich the port could be connected. The interface is determined by the connection interface filed and the address parameter. Address can be empty, wich means to use a free port or address can contain a port number.
Implements osg::Connection.
Definition at line 183 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_acceptSocket, osg::SocketAddress::ANY, osg::Socket::bind(), osg::Socket::getAddress(), osg::SocketAddress::getHost(), osg::Connection::getInterface(), osg::SocketAddress::getPort(), osg::Socket::listen(), osg::osgGetHostname(), osg::Socket::setReusePort(), and SINFO.
00184 { 00185 int port=0; 00186 char localhost[256]; 00187 char host[256]; 00188 char portStr[256]; 00189 std::string interf; 00190 00191 // get local host name 00192 osgGetHostname(localhost,255); 00193 if(!getInterface().empty()) 00194 interf = getInterface(); 00195 else 00196 interf = localhost; 00197 00198 // parse address 00199 if(!address.empty()) 00200 if(sscanf(address.c_str(),"%*[^:]:%d",&port) != 1) 00201 if(sscanf(address.c_str(),":%d",&port) != 1) 00202 port = 0; 00203 // bind port 00204 _acceptSocket.setReusePort(true); 00205 if(!getInterface().empty()) 00206 _acceptSocket.bind(SocketAddress(getInterface().c_str(),port)); 00207 else 00208 _acceptSocket.bind(SocketAddress(SocketAddress::ANY,port)); 00209 00210 SINFO << "Connection bound to " 00211 << _acceptSocket.getAddress().getHost() << ":" 00212 << _acceptSocket.getAddress().getPort() << std::endl; 00213 _acceptSocket.listen(); 00214 // create address 00215 sprintf(portStr,"%d",_acceptSocket.getAddress().getPort()); 00216 return interf + ":" + portStr; 00217 }
wait for signal
Implements osg::PointConnection.
Reimplemented in osg::PointMCastConnection.
Definition at line 245 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, FFATAL, osg::osgntohl(), osg::Socket::recv(), osg::Socket::waitReadable(), and osg::Exception::what().
Referenced by osg::PointMCastConnection::wait().
00246 { 00247 UInt32 tag; 00248 try 00249 { 00250 if(!_socket.waitReadable(timeout)) 00251 return false; 00252 if(!_socket.recv(&tag,sizeof(tag))) 00253 throw ReadError("Channel closed"); 00254 tag = osgntohl(tag); 00255 if(tag != 314156) 00256 { 00257 FFATAL(("Stream out of sync in SockConnection\n")); 00258 throw ReadError("Stream out of sync"); 00259 } 00260 } 00261 catch(SocketError &e) 00262 { 00263 throw ReadError(e.what()); 00264 } 00265 return true; 00266 }
| void PointSockConnection::signal | ( | void | ) | throw (WriteError) [virtual, inherited] |
send signal
Implements osg::PointConnection.
Definition at line 270 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, osg::osghtonl(), osg::Socket::send(), and osg::Exception::what().
00271 { 00272 UInt32 tag=osghtonl(314156); 00273 try 00274 { 00275 _socket.send(&tag,sizeof(tag)); 00276 } 00277 catch(SocketError &e) 00278 { 00279 throw ReadError(e.what()); 00280 } 00281 }
| void PointSockConnection::write | ( | MemoryHandle | mem, | |
| UInt32 | size | |||
| ) | [protected, virtual, inherited] |
Write data to destinations
| mem | Pointer to data buffer | |
| size | Size of bytes to write |
Reimplemented from osg::BinaryDataHandler.
Definition at line 347 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, and osg::Socket::send().
| void PointSockConnection::writeBuffer | ( | void | ) | [protected, virtual, inherited] |
Write buffer
Write blocksize and data.
Reimplemented from osg::BinaryDataHandler.
Definition at line 357 of file OSGPointSockConnection.cpp.
References osg::PointSockConnection::_socket, osg::PointSockConnection::_socketWriteBuffer, osg::osghtonl(), osg::Socket::send(), and osg::BinaryDataHandler::writeBufBegin().
00358 { 00359 Int32 index; 00360 UInt32 size = writeBufBegin()->getDataSize(); 00361 // write size to header 00362 ((SocketBufferHeader*)&_socketWriteBuffer[0])->size=osghtonl(size); 00363 if(size) 00364 { 00365 // write whole block 00366 _socket.send(&_socketWriteBuffer[0], 00367 size+sizeof(SocketBufferHeader)); 00368 } 00369 }
| void Connection::setParams | ( | const std::string & | params | ) | [virtual, inherited] |
set connections parameters, a comma separated list e.g. "TTL=255"
Reimplemented in osg::GroupMCastConnection, and osg::GroupSockConnection.
Definition at line 91 of file OSGConnection.cpp.
Referenced by osg::ClusterWindow::init().
00092 { 00093 // do nothing this is implemented in the derived classes e.g. OSGGroupMCastConnection.cpp 00094 }
| const std::string & Connection::getInterface | ( | void | ) | [inherited] |
get network interface
Definition at line 98 of file OSGConnection.cpp.
References osg::Connection::_interface.
Referenced by osg::PointSockConnection::bind(), osg::GroupSockConnection::bind(), initialize(), osg::PointMCastConnection::initialize(), and osg::GroupMCastConnection::initialize().
00099 { 00100 return _interface; 00101 }
| void Connection::setInterface | ( | const std::string & | interf | ) | [inherited] |
set network interface
Definition at line 105 of file OSGConnection.cpp.
References osg::Connection::_interface.
Referenced by osg::ClusterServer::acceptClient(), and osg::ClusterWindow::init().
00106 { 00107 _interface = interf; 00108 }
| 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::RenderNode::copyToBin(), osg::MField< FieldTypeT, fieldNameSpace >::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().
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::RenderNode::copyFromBin(), osg::MField< FieldTypeT, fieldNameSpace >::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().
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(), 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 osg::BINLoader::BinaryFileHandler::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 }
| 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 }
| 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 }
StreamSocket osg::PointSockPipeline::_next [protected] |
Definition at line 122 of file OSGPointSockPipeline.h.
Referenced by initialize(), PointSockPipeline(), read(), readBuffer(), and ~PointSockPipeline().
StreamSocket osg::PointSockPipeline::_prev [protected] |
Definition at line 123 of file OSGPointSockPipeline.h.
Referenced by initialize(), PointSockPipeline(), read(), readBuffer(), selectChannel(), and ~PointSockPipeline().
bool osg::PointSockPipeline::_last [protected] |
Definition at line 124 of file OSGPointSockPipeline.h.
Referenced by initialize(), read(), and readBuffer().
bool osg::PointSockPipeline::_initialized [protected] |
Definition at line 125 of file OSGPointSockPipeline.h.
Referenced by initialize(), read(), readBuffer(), and selectChannel().
ConnectionType osg::PointSockPipeline::_type [static, private] |
Reimplemented from osg::PointSockConnection.
Definition at line 143 of file OSGPointSockPipeline.h.
Referenced by getType().
StreamSocket osg::PointSockConnection::_acceptSocket [protected, inherited] |
Definition at line 142 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::bind(), osg::PointMCastConnection::PointMCastConnection(), osg::PointSockConnection::PointSockConnection(), osg::PointMCastConnection::~PointMCastConnection(), and osg::PointSockConnection::~PointSockConnection().
StreamSocket osg::PointSockConnection::_socket [protected, inherited] |
Definition at line 143 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::connectGroup(), osg::PointSockConnection::connectPoint(), disconnect(), osg::PointSockConnection::disconnect(), osg::PointMCastConnection::disconnect(), initialize(), osg::PointMCastConnection::initialize(), osg::PointSockConnection::read(), osg::PointSockConnection::readBuffer(), osg::PointMCastConnection::recvQueue(), osg::PointSockConnection::selectChannel(), osg::PointSockConnection::signal(), osg::PointSockConnection::wait(), osg::PointSockConnection::write(), and osg::PointSockConnection::writeBuffer().
SocketAddress osg::PointSockConnection::_remoteAddress [protected, inherited] |
Definition at line 144 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::connectGroup(), osg::PointSockConnection::connectPoint(), and osg::PointMCastConnection::initialize().
std::vector<UInt8> osg::PointSockConnection::_socketReadBuffer [protected, inherited] |
Definition at line 145 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::PointSockConnection(), readBuffer(), and osg::PointSockConnection::readBuffer().
std::vector<UInt8> osg::PointSockConnection::_socketWriteBuffer [protected, inherited] |
Definition at line 146 of file OSGPointSockConnection.h.
Referenced by osg::PointSockConnection::PointSockConnection(), and osg::PointSockConnection::writeBuffer().
bool osg::PointConnection::_pointToPoint [protected, inherited] |
Definition at line 103 of file OSGPointConnection.h.
Referenced by osg::PointSockConnection::acceptGroup(), osg::PointSockConnection::acceptPoint(), osg::PointSockConnection::connectGroup(), osg::PointSockConnection::connectPoint(), osg::PointMCastConnection::read(), osg::PointMCastConnection::readBuffer(), osg::PointMCastConnection::selectChannel(), and osg::PointMCastConnection::wait().
std::string osg::Connection::_interface [protected, inherited] |
Definition at line 139 of file OSGConnection.h.
Referenced by osg::Connection::getInterface(), and osg::Connection::setInterface().
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