Equalizer  1.4.1
include/eq/client/pipe.h
00001 
00002 /* Copyright (c) 2005-2012, Stefan Eilemann <eile@equalizergraphics.com>
00003  *                    2010, Cedric Stalder <cedric.stalder@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 EQ_PIPE_H
00020 #define EQ_PIPE_H
00021 
00022 #include <eq/client/api.h>
00023 #include <eq/client/eye.h>            // Eye enum
00024 #include <eq/client/types.h>
00025 #include <eq/client/visitorResult.h>  // enum
00026 
00027 #include <eq/fabric/pipe.h>           // base class
00028 #include <co/objectVersion.h>
00029 
00030 namespace eq
00031 {
00032 namespace detail { class Pipe; class RenderThread; }
00033 
00044     class Pipe : public fabric::Pipe< Node, Pipe, eq::Window, PipeVisitor >
00045     {
00046     public:
00048         EQ_API Pipe( Node* parent );
00049 
00051         EQ_API virtual ~Pipe();
00052 
00055         EQ_API co::CommandQueue* getPipeThreadQueue(); 
00056         co::CommandQueue* getMainThreadQueue(); 
00057         co::CommandQueue* getCommandThreadQueue(); 
00058         co::CommandQueue* getTransferThreadQueue(); 
00059 
00060 
00062         EQ_API Config* getConfig();
00064         EQ_API const Config* getConfig() const;
00065 
00067         EQ_API ClientPtr getClient();
00068 
00070         EQ_API ServerPtr getServer();
00071 
00076         bool isRunning() const;
00077 
00082         EQ_API bool isStopped() const;
00083 
00091         EQ_API uint32_t getCurrentFrame() const;
00092         EQ_API uint32_t getFinishedFrame() const; 
00093 
00104         EQ_API WindowSystem getWindowSystem() const;
00106 
00120         Frame* getFrame( const co::ObjectVersion& frameVersion, 
00121                          const Eye eye, const bool output );
00122 
00124         co::QueueSlave* getQueue( const co::ObjectVersion& queueVersion );
00125 
00127         void flushFrames( ObjectManager* om );
00128 
00130         const View* getView( const co::ObjectVersion& viewVersion ) const;
00131 
00133         View* getView( const co::ObjectVersion& viewVersion );
00135 
00136         void waitExited() const; 
00137         void notifyMapped(); 
00138 
00146         EQ_API void waitFrameFinished( const uint32_t frameNumber ) const;
00147 
00155         EQ_API void waitFrameLocal( const uint32_t frameNumber ) const;
00156 
00158         void startThread();
00159 
00161         void exitThread();
00162 
00163         void cancelThread(); 
00164 
00166         bool startTransferThread();
00167 
00169         bool hasTransferThread() const;
00170 
00183         EQ_API void setSystemPipe( SystemPipe* pipe );
00184 
00186         EQ_API SystemPipe* getSystemPipe();
00187 
00189         EQ_API const SystemPipe* getSystemPipe() const;
00191 
00198         EQ_API void setComputeContext( ComputeContext* ctx );
00199 
00201         EQ_API const ComputeContext* getComputeContext() const;
00202 
00204         EQ_API ComputeContext* getComputeContext();
00206 
00221         EQ_API virtual MessagePump* createMessagePump();
00222 
00224         MessagePump* getMessagePump();
00226 
00228         EQ_API virtual void setDirty( const uint64_t bits );
00229 
00230     protected:
00239         EQ_API void startFrame( const uint32_t frameNumber );
00240 
00247         EQ_API void releaseFrame( const uint32_t frameNumber );
00248 
00255         EQ_API void releaseFrameLocal( const uint32_t frameNumber );
00257 
00265 #ifndef EQ_2_0_API
00266 
00277         EQ_API virtual bool supportsWindowSystem( const WindowSystem ws ) const;
00278 #endif
00279 
00288         EQ_API virtual WindowSystem selectWindowSystem() const;
00289 
00296         EQ_API virtual bool configInit( const uint128_t& initID );
00297 
00304         EQ_API virtual bool configInitSystemPipe( const uint128_t& initID );
00305 
00310         EQ_API virtual bool configExit();
00311 
00329         EQ_API virtual void frameStart( const uint128_t& frameID, 
00330                                         const uint32_t frameNumber );
00331 
00346         EQ_API virtual void frameFinish( const uint128_t& frameID, 
00347                                          const uint32_t frameNumber );
00348 
00359         EQ_API virtual void frameDrawFinish( const uint128_t& frameID, 
00360                                              const uint32_t frameNumber );
00361 
00363         EQ_API virtual void attach( const UUID& id, const uint32_t instanceID );
00364 
00365     private:
00366         detail::Pipe* const _impl;
00367         friend class detail::RenderThread;
00368 
00369         //-------------------- Methods --------------------
00370         void _setupCommandQueue();
00371         void _setupAffinity();
00372         void _exitCommandQueue();
00373 
00375         int32_t _getAutoAffinity() const;
00376 
00377         //friend class Window;
00378 
00379         void _stopTransferThread();
00380 
00382         void _releaseViews();
00383 
00385         void _flushViews();
00386 
00388         void _flushQueues();
00389 
00390         /* The command functions. */
00391         bool _cmdCreateWindow( co::Command& command );
00392         bool _cmdDestroyWindow( co::Command& command );
00393         bool _cmdConfigInit( co::Command& command );
00394         bool _cmdConfigExit( co::Command& command );
00395         bool _cmdFrameStartClock( co::Command& command );
00396         bool _cmdFrameStart( co::Command& command );
00397         bool _cmdFrameFinish( co::Command& command );
00398         bool _cmdFrameDrawFinish( co::Command& command );
00399         bool _cmdExitThread( co::Command& command );
00400         bool _cmdDetachView( co::Command& command );
00401         bool _cmdExitTransferThread( co::Command& command );
00402 
00403         LB_TS_VAR( _pipeThread );
00404     };
00405 }
00406 
00407 #endif // EQ_PIPE_H
00408 
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1