client/object.h

00001 
00002 /* Copyright (c) 2009, 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 #ifndef EQ_OBJECT_H
00019 #define EQ_OBJECT_H
00020 
00021 #include <eq/net/object.h>        // base class
00022 
00023 namespace eq
00024 {
00033     class Object : public net::Object
00034     {
00035     public:
00037         EQ_EXPORT Object();
00038         
00040         EQ_EXPORT virtual ~Object();
00041 
00043         EQ_EXPORT void setName( const std::string& name );
00044 
00046         EQ_EXPORT const std::string& getName() const;
00047 
00049         EQ_EXPORT uint64_t getDirty() const { return _dirty; }
00050 
00051     protected:
00053         virtual bool isDirty() const { return ( _dirty != DIRTY_NONE ); }
00054 
00066         EQ_EXPORT virtual void serialize( net::DataOStream& os,
00067                                           const uint64_t dirtyBits );
00068 
00078         EQ_EXPORT virtual void deserialize( net::DataIStream& is, 
00079                                             const uint64_t dirtyBits );
00080 
00081         virtual ChangeType getChangeType() const { return UNBUFFERED; }
00082 
00088         enum DirtyBits
00089         {
00090             DIRTY_NONE       = 0,
00091             DIRTY_NAME       = 1 << 0,
00092             DIRTY_FILL1      = 1 << 1, // Leave room for binary-compatible patch
00093             DIRTY_FILL2      = 1 << 2,
00094             DIRTY_CUSTOM     = 1 << 3,
00095             DIRTY_ALL        = 0xffffffffffffffffull
00096         };
00097 
00099         EQ_EXPORT void setDirty( const uint64_t bits );
00100 
00102         EQ_EXPORT virtual void attachToSession( const uint32_t id, 
00103                                                 const uint32_t instanceID, 
00104                                                 net::Session* session );
00105 
00106     private:
00107         EQ_EXPORT virtual void getInstanceData( net::DataOStream& os );
00108         EQ_EXPORT virtual void pack( net::DataOStream& os );
00109         EQ_EXPORT virtual void applyInstanceData( net::DataIStream& is );
00110 
00112         uint64_t _dirty;
00113 
00115         std::string _name;
00116 
00117         union // placeholder for binary-compatible changes
00118         {
00119             char dummy[8];
00120         };
00121     };
00122 }
00123 #endif // EQ_OBJECT_H
Generated on Mon Aug 10 18:58:40 2009 for Equalizer 0.9 by  doxygen 1.5.8