unbufferedMasterCM.h

00001 
00002 /* Copyright (c) 2007-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 EQNET_UNBUFFEREDMASTERCM_H
00019 #define EQNET_UNBUFFEREDMASTERCM_H
00020 
00021 #include "objectInstanceDataOStream.h"
00022 
00023 #include <eq/net/objectCM.h>           // base class
00024 #include <eq/net/types.h>              // for NodeVector
00025 
00026 #include <deque>
00027 
00028 namespace eq
00029 {
00030 namespace net
00031 {
00032     class Node;
00033     class ObjectDeltaDataOStream;
00034 
00041     class UnbufferedMasterCM : public ObjectCM
00042     {
00043     public:
00044         UnbufferedMasterCM( Object* object );
00045         virtual ~UnbufferedMasterCM();
00046 
00047         virtual void makeThreadSafe(){}
00048 
00053         virtual uint32_t commitNB();
00054         virtual uint32_t commitSync( const uint32_t commitID );
00055 
00056         virtual void obsolete( const uint32_t version ) { EQUNIMPLEMENTED; }
00057 
00058         virtual void setAutoObsolete( const uint32_t count, 
00059                                       const uint32_t flags ) { /*nop*/ }
00060         
00061         virtual uint32_t getAutoObsoleteCount() const { return 0; }
00062 
00063         virtual uint32_t sync( const uint32_t version )
00064             { EQDONTCALL; return _version; }
00065 
00066         virtual uint32_t getHeadVersion() const { return _version; }
00067         virtual uint32_t getVersion() const     { return _version; }
00068         virtual uint32_t getOldestVersion() const { return _version; }
00070 
00071         virtual bool isMaster() const { return true; }
00072         virtual uint32_t getMasterInstanceID() const
00073             { EQDONTCALL; return EQ_ID_INVALID; }
00074 
00075         virtual void addSlave( NodePtr node, const uint32_t instanceID,
00076                                const uint32_t version );
00077         virtual void removeSlave( NodePtr node );
00078         virtual void addOldMaster( NodePtr node, const uint32_t instanceID );
00079 
00080         virtual void applyMapData() { EQDONTCALL; }
00081 
00082     private:
00084         Object* _object;
00085 
00087         NodeVector _slaves;
00088 
00090         base::UUIDHash< uint32_t > _slavesCount;
00091 
00093         uint32_t _version;
00094 
00096         uint32_t _obsoleteFlags;
00097 
00099         base::RequestHandler _requestHandler;
00100 
00101         /* The command handlers. */
00102         CommandResult _cmdCommit( Command& pkg );
00103         CommandResult _cmdDiscard( Command& pkg ) { return COMMAND_HANDLED; }
00104 
00105         CHECK_THREAD_DECLARE( _thread );
00106     };
00107 }
00108 
00109 }
00110 #endif // EQNET_UNBUFFEREDMASTERCM_H
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8