Equalizer  1.4.1
serializable.h
00001 
00002 /* Copyright (c) 2009-2012, 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 CO_SERIALIZABLE_H
00019 #define CO_SERIALIZABLE_H
00020 
00021 #include <co/object.h>        // base class
00022 
00023 namespace co
00024 {
00025 namespace detail { class Serializable; }
00026 
00035     class Serializable : public Object
00036     {
00037     public:
00039         CO_API uint64_t getDirty() const;
00040 
00042         CO_API virtual bool isDirty() const;
00043 
00045         CO_API virtual bool isDirty( const uint64_t dirtyBits ) const;
00046 
00047         CO_API virtual uint128_t commit( const uint32_t incarnation =
00048                                          CO_COMMIT_NEXT );
00049 
00050     protected:
00052         CO_API Serializable();
00053         
00058         CO_API Serializable( const Serializable& );
00059         
00061         CO_API virtual ~Serializable();
00062 
00075         virtual void serialize( co::DataOStream&, const uint64_t ){}
00076 
00087         virtual void deserialize( co::DataIStream&, const uint64_t ){}
00088 
00089         virtual ChangeType getChangeType() const { return DELTA; }
00090 
00097         enum DirtyBits
00098         {
00099             DIRTY_NONE       = 0,
00100             DIRTY_CUSTOM     = 1,
00101             DIRTY_ALL        = 0xFFFFFFFFFFFFFFFFull
00102         };
00103 
00105         CO_API virtual void setDirty( const uint64_t bits );
00106 
00108         CO_API virtual void unsetDirty( const uint64_t bits );
00109 
00110         CO_API virtual void notifyAttached();
00111 
00112     private:
00113         detail::Serializable* const _impl;
00114         friend class detail::Serializable;
00115 
00116         virtual void getInstanceData( co::DataOStream& os )
00117             { serialize( os, DIRTY_ALL ); }
00118 
00119         CO_API virtual void applyInstanceData( co::DataIStream& is );
00120 
00121         CO_API virtual void pack( co::DataOStream& os );
00122         CO_API virtual void unpack( co::DataIStream& is );
00123     };
00124 }
00125 #endif // CO_SERIALIZABLE_H
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1