Equalizer  1.4.1
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 
00055         EQFABRIC_INL bool isActive() const;
00056 
00058         V* getView( const ViewPath& path );
00059 
00061         V* findView( const std::string& name );
00062 
00064         LayoutPath getPath() const;
00066 
00076         EQFABRIC_INL VisitorResult accept( Visitor& visitor );
00077 
00079         EQFABRIC_INL VisitorResult accept( Visitor& visitor )
00080             const;
00081 
00082         void create( V** view ); 
00083         void release( V* view ); 
00084 
00085         
00086     protected:
00088         EQFABRIC_INL Layout( C* config );
00089 
00091         EQFABRIC_INL virtual ~Layout();
00092 
00094         EQFABRIC_INL virtual void attach( const UUID& id,
00095                                           const uint32_t instanceID );
00096 
00098         EQFABRIC_INL virtual void serialize( co::DataOStream& os, 
00099                                                 const uint64_t dirtyBits );
00101         EQFABRIC_INL virtual void deserialize( co::DataIStream& is, 
00102                                                   const uint64_t dirtyBits );
00103 
00104         EQFABRIC_INL virtual void notifyDetach(); 
00105 
00107         EQFABRIC_INL virtual void setDirty( const uint64_t bits );
00108 
00110         enum DirtyBits
00111         {
00112             DIRTY_VIEWS      = Object::DIRTY_CUSTOM << 0,
00113             DIRTY_LAYOUT_BITS = DIRTY_VIEWS | DIRTY_OBJECT_BITS
00114         };
00115 
00117         virtual uint64_t getRedistributableBits() const
00118             { return DIRTY_LAYOUT_BITS; }
00119 
00120     private:
00122         C* const _config;
00123 
00125         Views _views;
00126 
00127         struct Private;
00128         Private* _private; // placeholder for binary-compatible changes
00129 
00130         template< class, class, class > friend class View;
00131         friend class Object;
00132         void _addChild( V* view );
00133         bool _removeChild( V* view );
00134 
00136         EQFABRIC_INL virtual uint128_t commit( const uint32_t incarnation );
00137 
00138         template< class O > void _removeObserver( const O* observer );
00139         template< class, class, class, class, class, class,
00140                   class > friend class Config;
00141 
00142         typedef co::CommandFunc< Layout< C, L, V > > CmdFunc;
00143         bool _cmdNewView( co::Command& command );
00144         bool _cmdNewViewReply( co::Command& command );
00145     };
00146 
00147     template< class C, class L, class V >
00148     std::ostream& operator << ( std::ostream&, const Layout< C, L, V >& );
00149 }
00150 }
00151 #endif // EQFABRIC_LAYOUT_H
Generated on Mon Nov 26 2012 14:41:49 for Equalizer 1.4.1 by  doxygen 1.7.6.1