client/object.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "object.h"
00019
00020 #include <eq/net/dataOStream.h>
00021 #include <eq/net/dataIStream.h>
00022
00023 namespace eq
00024 {
00025
00026 Object::Object()
00027 : _dirty( DIRTY_NONE )
00028 {}
00029
00030 Object::~Object()
00031 {
00032 }
00033
00034 void Object::getInstanceData( net::DataOStream& os )
00035 {
00036 os << static_cast< uint64_t >( DIRTY_ALL );
00037 serialize( os, DIRTY_ALL );
00038 }
00039
00040 void Object::pack( net::DataOStream& os )
00041 {
00042 if( _dirty == DIRTY_NONE )
00043 return;
00044
00045 os << _dirty;
00046 serialize( os, _dirty );
00047 _dirty = DIRTY_NONE;
00048 }
00049
00050 void Object::applyInstanceData( net::DataIStream& is )
00051 {
00052 if( is.getRemainingBufferSize() == 0 && is.nRemainingBuffers() == 0 )
00053 return;
00054
00055 is >> _dirty;
00056 deserialize( is, _dirty );
00057 }
00058
00059 void Object::serialize( net::DataOStream& os, const uint64_t dirtyBits )
00060 {
00061 if( dirtyBits & DIRTY_NAME )
00062 os << _name;
00063 }
00064
00065 void Object::deserialize( net::DataIStream& is, const uint64_t dirtyBits )
00066 {
00067 if( dirtyBits & DIRTY_NAME )
00068 is >> _name;
00069 }
00070
00071 void Object::setDirty( const uint64_t bits )
00072 {
00073 _dirty |= bits;
00074 }
00075
00076 void Object::attachToSession( const uint32_t id, const uint32_t instanceID,
00077 net::Session* session )
00078 {
00079 net::Object::attachToSession( id, instanceID, session );
00080 _dirty = DIRTY_NONE;
00081 }
00082
00083 void Object::setName( const std::string& name )
00084 {
00085 _name = name;
00086 setDirty( DIRTY_NAME );
00087 }
00088
00089 const std::string& Object::getName() const
00090 {
00091 return _name;
00092 }
00093
00094
00095 }