Equalizer 1.0

fabric/layout.h

00001 
00002 /* Copyright (c) 2009-2011, 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 EQFABRIC_LAYOUT_H
00019 #define EQFABRIC_LAYOUT_H
00020 
00021 #include <eq/fabric/object.h>         // base class
00022 #include <eq/fabric/types.h>
00023 #include <eq/fabric/visitorResult.h>  // enum
00024 
00025 #include <string>
00026 
00027 namespace eq
00028 {
00029 namespace fabric
00030 {
00032     template< class C, class L, class V > class Layout : public Object
00033     {
00034     public:
00038         typedef std::vector< V* > Views;
00040         typedef ElementVisitor< L, LeafVisitor< V > > Visitor;
00041 
00043         C* getConfig() { return _config; }
00044 
00046         const C* getConfig() const { return _config; }
00047 
00049         const Views& getViews() const { return _views; }
00050 
00052         V* getView( const ViewPath& path );
00053 
00055         V* findView( const std::string& name );
00056 
00058         LayoutPath getPath() const;
00060 
00070         EQFABRIC_INL VisitorResult accept( Visitor& visitor );
00071 
00073         EQFABRIC_INL VisitorResult accept( Visitor& visitor )
00074             const;
00075 
00076         void create( V** view ); 
00077         void release( V* view ); 
00078 
00079         
00080     protected:
00082         EQFABRIC_INL Layout( C* config );
00083 
00085         EQFABRIC_INL virtual ~Layout();
00086 
00088         EQFABRIC_INL virtual void attach( const co::base::UUID& id,
00089                                           const uint32_t instanceID );
00090 
00092         EQFABRIC_INL virtual void serialize( co::DataOStream& os, 
00093                                                 const uint64_t dirtyBits );
00095         EQFABRIC_INL virtual void deserialize( co::DataIStream& is, 
00096                                                   const uint64_t dirtyBits );
00097 
00098         EQFABRIC_INL virtual void notifyDetach(); 
00099 
00101         EQFABRIC_INL virtual void setDirty( const uint64_t bits );
00102 
00104         enum DirtyBits
00105         {
00106             DIRTY_VIEWS      = Object::DIRTY_CUSTOM << 0,
00107             DIRTY_LAYOUT_BITS = DIRTY_VIEWS | DIRTY_OBJECT_BITS
00108         };
00109 
00111         virtual uint64_t getRedistributableBits() const
00112             { return DIRTY_LAYOUT_BITS; }
00113 
00114     private:
00116         C* const _config;
00117 
00119         Views _views;
00120 
00121         struct Private;
00122         Private* _private; // placeholder for binary-compatible changes
00123 
00124         template< class, class, class > friend class View;
00125         friend class Object;
00126         void _addChild( V* view );
00127         bool _removeChild( V* view );
00128 
00130         EQFABRIC_INL virtual uint32_t commitNB( const uint32_t incarnation );
00131 
00132         template< class O > void _removeObserver( const O* observer );
00133         template< class, class, class, class, class, class,
00134                   class > friend class Config;
00135 
00136         typedef co::CommandFunc< Layout< C, L, V > > CmdFunc;
00137         bool _cmdNewView( co::Command& command );
00138         bool _cmdNewViewReply( co::Command& command );
00139     };
00140 
00141     template< class C, class L, class V >
00142     std::ostream& operator << ( std::ostream&, const Layout< C, L, V >& );
00143 }
00144 }
00145 #endif // EQFABRIC_LAYOUT_H
Generated on Sun May 8 2011 19:11:07 for Equalizer 1.0 by  doxygen 1.7.3