objectInstanceDataOStream.cpp

00001 
00002 /* Copyright (c) 2007, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #include "objectInstanceDataOStream.h"
00019 
00020 #include "log.h"
00021 #include "object.h"
00022 #include "packets.h"
00023 #include "session.h"
00024 
00025 #include <eq/base/idPool.h>
00026 
00027 using namespace std;
00028 
00029 namespace eq
00030 {
00031 namespace net
00032 {
00033 ObjectInstanceDataOStream::ObjectInstanceDataOStream( const Object* object)
00034         : ObjectDataOStream( object )
00035         , _sequence( 0 )
00036 {}
00037 
00038 ObjectInstanceDataOStream::~ObjectInstanceDataOStream()
00039 {}
00040 
00041 void ObjectInstanceDataOStream::sendBuffer( const void* buffer,
00042                                             const uint64_t size )
00043 {
00044     ObjectInstanceDataPacket dataPacket;
00045     dataPacket.dataSize   = size;
00046     dataPacket.sessionID  = _object->getSession()->getID();
00047     dataPacket.objectID   = _object->getID();
00048     dataPacket.instanceID = _instanceID;
00049     dataPacket.sequence   = _sequence++;
00050 
00051     EQLOG( LOG_OBJECTS ) << "send " << &dataPacket << " to " 
00052                          << _connections.size() << " receivers " << endl;
00053     Connection::send( _connections, dataPacket, buffer, size, true );
00054 }
00055 
00056 void ObjectInstanceDataOStream::sendFooter( const void* buffer, 
00057                                             const uint64_t size )
00058 {
00059     ObjectInstancePacket instancePacket;
00060     instancePacket.version    = _version;
00061     instancePacket.dataSize   = size;
00062     instancePacket.sessionID  = _object->getSession()->getID();
00063     instancePacket.objectID   = _object->getID();
00064     instancePacket.instanceID = _instanceID;
00065     instancePacket.sequence   = _sequence++;
00066 
00067     EQLOG( LOG_OBJECTS ) << "send " << &instancePacket << " to " 
00068                          << _connections.size() << " receivers " << endl;
00069     Connection::send( _connections, instancePacket, buffer, size, true );
00070 }
00071 }
00072 }
Generated on Mon Aug 10 18:58:40 2009 for Equalizer 0.9 by  doxygen 1.5.8