Collage  0.6.1
objectMap.h
00001 
00002 /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@googlemail.com>
00003  *               2012, Stefan Eilemann <eile@eyescale.ch>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #ifndef CO_OBJECTMAP_H
00020 #define CO_OBJECTMAP_H
00021 
00022 #include <co/serializable.h>      // base class
00023 
00024 namespace co
00025 {
00026 namespace detail { class ObjectMap; }
00027 
00029     class ObjectMap : public Serializable
00030     {
00031     public:
00039         CO_API ObjectMap( ObjectHandler& handler, ObjectFactory& factory );
00040 
00048         CO_API virtual ~ObjectMap();
00049 
00061         CO_API bool register_( Object* object, const uint32_t type );
00062 
00076         CO_API Object* get( const uint128_t& identifier, Object* instance=0 );
00077 
00079         CO_API virtual uint128_t commit( const uint32_t incarnation =
00080                                          CO_COMMIT_NEXT );
00081 
00082     protected:
00083         CO_API virtual bool isDirty() const;
00084 
00085         CO_API virtual void serialize( DataOStream& os,
00086                                        const uint64_t dirtyBits );
00087         CO_API virtual void deserialize( DataIStream& is,
00088                                          const uint64_t dirtyBits );
00089 
00090         virtual ChangeType getChangeType() const { return DELTA; }
00091 
00092         CO_API virtual void notifyAttached();
00093 
00095         enum DirtyBits
00096         {
00097             DIRTY_ADDED       = Serializable::DIRTY_CUSTOM << 0, // 1
00098             DIRTY_CHANGED     = Serializable::DIRTY_CUSTOM << 1, // 2
00099             DIRTY_CUSTOM      = Serializable::DIRTY_CUSTOM << 2  // 4
00100         };        
00101 
00102     private:
00103         detail::ObjectMap* const _impl;
00104 
00106         void _commitMasters( const uint32_t incarnation );
00107     };
00108 }
00109 #endif // CO_OBJECTMAP_H
Generated on Mon Nov 26 2012 14:41:44 for Collage 0.6.1 by  doxygen 1.7.6.1