Equalizer  1.4.1
iCommand.h
00001 
00002 /* Copyright (c) 2006-2012, Stefan Eilemann <eile@equalizergraphics.com>
00003  *                    2012, Daniel Nachbaur <danielnachbaur@gmail.com>
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_ICOMMAND_H
00020 #define CO_ICOMMAND_H
00021 
00022 #include <co/api.h>
00023 #include <co/commands.h>        // for enum CommandType
00024 #include <co/dataIStream.h>     // base class
00025 
00026 
00027 namespace co
00028 {
00029 namespace detail { class ICommand; }
00030 
00041     class ICommand : public DataIStream
00042     {
00043     public:
00044         CO_API ICommand(); 
00045         CO_API ICommand( LocalNodePtr local, NodePtr remote,
00046                         ConstBufferPtr buffer, const bool swap ); 
00047         CO_API ICommand( const ICommand& rhs ); 
00048 
00049         CO_API ICommand& operator = ( const ICommand& rhs ); 
00050 
00051         CO_API void clear(); 
00052 
00053         CO_API virtual ~ICommand(); 
00054 
00058         CO_API uint32_t getType() const;
00059 
00061         CO_API uint32_t getCommand() const;
00062 
00064         CO_API uint64_t getSize_() const;
00065 
00067         CO_API ConstBufferPtr getBuffer() const;
00068 
00070         template< typename T > T get()
00071         {
00072             T value;
00073             *this >> value;
00074             return value;
00075         }
00076 
00078         CO_API NodePtr getNode() const;
00079 
00081         CO_API LocalNodePtr getLocalNode() const;
00082 
00084         CO_API bool isValid() const;
00086 
00090         CO_API void setType( const CommandType type );
00091 
00093         CO_API void setCommand( const uint32_t cmd );
00094 
00096         void setDispatchFunction( const Dispatcher::Func& func );
00097 
00099         CO_API bool operator()();
00101 
00102     private:
00103         detail::ICommand* const _impl;
00104 
00105         friend CO_API std::ostream& operator << (std::ostream&,const ICommand&);
00106 
00109         CO_API virtual size_t nRemainingBuffers() const;
00110         CO_API virtual uint128_t getVersion() const;
00111         CO_API virtual NodePtr getMaster();
00112         CO_API virtual bool getNextBuffer( uint32_t& compressor,
00113                                            uint32_t& nChunks,
00114                                            const void** chunkData,
00115                                            uint64_t& size );
00117 
00118         void _skipHeader(); 
00119     };
00120 
00121     CO_API std::ostream& operator << ( std::ostream& os, const ICommand& );
00122 }
00123 #endif // CO_ICOMMAND_H
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1