osg::PointSockPipeline Class Reference
[Network]

#include <OSGPointSockPipeline.h>

Inheritance diagram for osg::PointSockPipeline:

osg::PointSockConnection osg::PointConnection osg::Connection osg::BinaryDataHandler

List of all members.

Public Types

public types


typedef Int32 Channel

Public Member Functions

Constructors


 PointSockPipeline (void)
virtual ~PointSockPipeline (void)
type info


virtual const ConnectionTypegetType (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 &params)
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 PointConnectioncreate (void)
 create conneciton

Protected Types

typedef std::vector< MemoryBlockBuffersT
typedef std::list< MemoryHandleFreeMemT

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)
PointSockPipelineoperator= (const PointSockPipeline &source)
private helpers


void initialize (void)

Static Private Attributes

static type


static ConnectionType _type


Detailed Description

Definition at line 62 of file OSGPointSockPipeline.h.


Member Typedef Documentation

Reimplemented from osg::PointSockConnection.

Definition at line 147 of file OSGPointSockPipeline.h.

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.


Constructor & Destructor Documentation

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().

00080 {
00081     _prev.close();
00082     _next.close();
00083 }

osg::PointSockPipeline::PointSockPipeline ( const PointSockPipeline source  )  [private]


Member Function Documentation

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().

00109 {
00110     _socket.close();
00111 }

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 }

bool PointSockConnection::wait ( Time  timeout  )  throw (ReadError ) [virtual, inherited]

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

Parameters:
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().

00348 {
00349     _socket.send(mem,size);
00350 }

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]

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::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]

Definition at line 71 of file OSGBinaryDataHandler.inl.

References osg::BinaryDataHandler::put().

00072 {
00073     put(&value, sizeof(UInt8));
00074 }

void osg::BinaryDataHandler::putValue ( const UInt16 value  )  [inline, inherited]

Definition at line 77 of file OSGBinaryDataHandler.inl.

References osg::osghtons(), and osg::BinaryDataHandler::put().

00078 {
00079     UInt16 z = osghtons(value);
00080 
00081     put(&z, sizeof(UInt16));
00082 }

void osg::BinaryDataHandler::putValue ( const UInt32 value  )  [inline, inherited]

Definition at line 85 of file OSGBinaryDataHandler.inl.

References osg::osghtonl(), and osg::BinaryDataHandler::put().

00086 {
00087     UInt32 z = osghtonl(value);
00088 
00089     put(&z, sizeof(UInt32));
00090 }

void osg::BinaryDataHandler::putValue ( const UInt64 value  )  [inline, inherited]

Definition at line 93 of file OSGBinaryDataHandler.inl.

References osg::osghtonll(), and osg::BinaryDataHandler::put().

00094 {
00095     UInt64 z = osghtonll(value);
00096 
00097     put(&z, sizeof(UInt64));
00098 }

void osg::BinaryDataHandler::putValue ( const Int8 value  )  [inline, inherited]

Definition at line 101 of file OSGBinaryDataHandler.inl.

References osg::BinaryDataHandler::put().

00102 {
00103     put(&value, sizeof(Int8));
00104 }

void osg::BinaryDataHandler::putValue ( const Int16 value  )  [inline, inherited]

Definition at line 107 of file OSGBinaryDataHandler.inl.

References osg::osghtons(), and osg::BinaryDataHandler::put().

00108 {
00109     Int16 z = osghtons(value);
00110 
00111     put(&z, sizeof(Int16));
00112 }

void osg::BinaryDataHandler::putValue ( const Int32 value  )  [inline, inherited]

Definition at line 115 of file OSGBinaryDataHandler.inl.

References osg::osghtonl(), and osg::BinaryDataHandler::put().

00116 {
00117     Int32 z = osghtonl(value);
00118 
00119     put(&z, sizeof(Int32));
00120 }

void osg::BinaryDataHandler::putValue ( const Int64 value  )  [inline, inherited]

Definition at line 123 of file OSGBinaryDataHandler.inl.

References osg::osghtonll(), and osg::BinaryDataHandler::put().

00124 {
00125     Int64 z = osghtonll(value);
00126     put(&z, sizeof(Int64));
00127 
00128 }

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().

00132 {
00133     UInt16 v = osghtons(value.bits());
00134 
00135     put(&v, sizeof(Real16));
00136 }

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]

void osg::BinaryDataHandler::putValues ( const UInt8 value,
UInt32  size 
) [inline, inherited]

Definition at line 191 of file OSGBinaryDataHandler.inl.

References osg::BinaryDataHandler::put().

00192 {
00193     put(value, size * sizeof(UInt8));
00194 }

void osg::BinaryDataHandler::putValues ( const UInt16 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const UInt32 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const UInt64 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Int8 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Int16 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Int32 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Int64 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Real16 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Real32 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Real64 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::putValues ( const Real128 value,
UInt32  size 
) [inline, inherited]

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().

00397 {
00398     for(UInt32 i = 0; i<size; ++i)
00399     {
00400         putValue(value[i]);    
00401     }
00402 }

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]

Definition at line 414 of file OSGBinaryDataHandler.inl.

00415 {
00416     get(&value, sizeof(UInt8));
00417 }

void osg::BinaryDataHandler::getValue ( UInt16 value  )  [inline, inherited]

Definition at line 420 of file OSGBinaryDataHandler.inl.

References osg::osgntohs().

00421 {
00422     get(&value, sizeof(UInt16));
00423 
00424     value = osgntohs(value);
00425 }

void osg::BinaryDataHandler::getValue ( UInt32 value  )  [inline, inherited]

Definition at line 428 of file OSGBinaryDataHandler.inl.

References osg::osgntohl().

00429 {
00430     get(&value, sizeof(UInt32));
00431 
00432     value = osgntohl(value);
00433 }

void osg::BinaryDataHandler::getValue ( UInt64 value  )  [inline, inherited]

Definition at line 436 of file OSGBinaryDataHandler.inl.

References osg::osgntohll().

00437 {
00438     get(&value, sizeof(UInt64));
00439 
00440     value = osgntohll(value);
00441 }

void osg::BinaryDataHandler::getValue ( Int8 value  )  [inline, inherited]

Definition at line 444 of file OSGBinaryDataHandler.inl.

00445 {
00446     get(&value, sizeof(Int8));
00447 }

void osg::BinaryDataHandler::getValue ( Int16 value  )  [inline, inherited]

Definition at line 450 of file OSGBinaryDataHandler.inl.

References osg::osgntohs().

00451 {
00452     get(&value, sizeof(Int16));
00453 
00454     value = osgntohs(value);
00455 }

void osg::BinaryDataHandler::getValue ( Int32 value  )  [inline, inherited]

Definition at line 458 of file OSGBinaryDataHandler.inl.

References osg::osgntohl().

00459 {
00460     get(&value, sizeof(Int32));
00461 
00462     value = osgntohl(value);
00463 }

void osg::BinaryDataHandler::getValue ( Int64 value  )  [inline, inherited]

Definition at line 466 of file OSGBinaryDataHandler.inl.

References osg::osgntohll().

00467 {
00468     get(&value, sizeof(Int64));
00469 
00470     value = osgntohll(value);
00471 }

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]

void osg::BinaryDataHandler::getValues ( UInt8 value,
UInt32  size 
) [inline, inherited]

Definition at line 575 of file OSGBinaryDataHandler.inl.

00576 {
00577     get(value, size * sizeof(UInt8));
00578 }

void osg::BinaryDataHandler::getValues ( UInt16 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( UInt32 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( UInt64 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Int8 value,
UInt32  size 
) [inline, inherited]

Definition at line 629 of file OSGBinaryDataHandler.inl.

00630 {
00631     get(value, size * sizeof(Int8));
00632 }

void osg::BinaryDataHandler::getValues ( Int16 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Int32 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Int64 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Real16 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Real32 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Real64 value,
UInt32  size 
) [inline, inherited]

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 }

void osg::BinaryDataHandler::getValues ( Real128 value,
UInt32  size 
) [inline, inherited]

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().

00758 {
00759     for(UInt32 i = 0; i < size; ++i)
00760     {
00761         getValue(value[i]);
00762     }
00763 }

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]

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]

BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::readBufEnd ( void   )  [inline, protected, inherited]

void BinaryDataHandler::readBufAdd ( MemoryHandle  mem,
UInt32  size,
UInt32  dataSize = 0 
) [protected, inherited]

void BinaryDataHandler::readBufClear ( void   )  [protected, inherited]

BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::writeBufBegin ( void   )  [inline, protected, inherited]

BinaryDataHandler::BuffersT::iterator osg::BinaryDataHandler::writeBufEnd ( void   )  [inline, protected, inherited]

void BinaryDataHandler::writeBufAdd ( MemoryHandle  mem,
UInt32  size,
UInt32  dataSize = 0 
) [protected, inherited]

void BinaryDataHandler::writeBufClear ( void   )  [protected, inherited]

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 }


Member Data Documentation

Definition at line 124 of file OSGPointSockPipeline.h.

Referenced by initialize(), read(), and readBuffer().

Definition at line 125 of file OSGPointSockPipeline.h.

Referenced by initialize(), read(), readBuffer(), and selectChannel().

Reimplemented from osg::PointSockConnection.

Definition at line 143 of file OSGPointSockPipeline.h.

Referenced by getType().

std::vector<UInt8> osg::PointSockConnection::_socketReadBuffer [protected, inherited]

std::vector<UInt8> osg::PointSockConnection::_socketWriteBuffer [protected, inherited]

bool osg::PointConnection::_pointToPoint [protected, inherited]

std::string osg::Connection::_interface [protected, inherited]

BuffersT::iterator osg::BinaryDataHandler::_currentReadBuffer [protected, inherited]

BuffersT::iterator osg::BinaryDataHandler::_currentWriteBuffer [protected, inherited]

bool osg::BinaryDataHandler::_networkOrder [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Mon Mar 17 12:03:55 2008 for OpenSG by  doxygen 1.5.5