Equalizer  1.8.0
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
fabric/layout.h
1 
2 /* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_LAYOUT_H
19 #define EQFABRIC_LAYOUT_H
20 
21 #include <eq/fabric/object.h> // base class
22 #include <eq/fabric/types.h>
23 #include <string>
24 
25 namespace eq
26 {
27 namespace fabric
28 {
30  template< class C, class L, class V > class Layout : public Object
31  {
32  public:
36  typedef std::vector< V* > Views;
39 
41  C* getConfig() { return _config; }
42 
44  const C* getConfig() const { return _config; }
45 
47  const Views& getViews() const { return _views; }
48 
53  EQFABRIC_INL bool isActive() const;
54 
56  V* getView( const ViewPath& path );
57 
59  V* findView( const std::string& name );
60 
62  LayoutPath getPath() const;
64 
74  EQFABRIC_INL VisitorResult accept( Visitor& visitor );
75 
77  EQFABRIC_INL VisitorResult accept( Visitor& visitor )
78  const;
79 
80  void create( V** view );
81  void release( V* view );
82 
83 
84  protected:
86  EQFABRIC_INL Layout( C* config );
87 
89  EQFABRIC_INL virtual ~Layout();
90 
92  EQFABRIC_INL virtual void attach( const uint128_t& id,
93  const uint32_t instanceID );
94 
96  EQFABRIC_INL virtual void serialize( co::DataOStream& os,
97  const uint64_t dirtyBits );
99  EQFABRIC_INL virtual void deserialize( co::DataIStream& is,
100  const uint64_t dirtyBits );
101 
102  EQFABRIC_INL virtual void notifyDetach();
103 
105  EQFABRIC_INL virtual void setDirty( const uint64_t bits );
106 
108  enum DirtyBits
109  {
110  DIRTY_VIEWS = Object::DIRTY_CUSTOM << 0,
111  DIRTY_LAYOUT_BITS = DIRTY_VIEWS | DIRTY_OBJECT_BITS
112  };
113 
115  virtual uint64_t getRedistributableBits() const
116  { return DIRTY_LAYOUT_BITS; }
117 
118  private:
120  C* const _config;
121 
123  Views _views;
124 
125  struct Private;
126  Private* _private; // placeholder for binary-compatible changes
127 
128  template< class, class, class > friend class View;
129  friend class Object;
130  void _addChild( V* view );
131  bool _removeChild( V* view );
132 
134  EQFABRIC_INL virtual uint128_t commit( const uint32_t incarnation );
135 
136  template< class O > void _removeObserver( const O* observer );
137  template< class, class, class, class, class, class,
138  class > friend class Config;
139 
140  typedef co::CommandFunc< Layout< C, L, V > > CmdFunc;
141  bool _cmdNewView( co::ICommand& command );
142  bool _cmdNewViewReply( co::ICommand& command );
143  };
144 
145  template< class C, class L, class V >
146  std::ostream& operator << ( std::ostream&, const Layout< C, L, V >& );
147 }
148 }
149 #endif // EQFABRIC_LAYOUT_H
const C * getConfig() const
Definition: fabric/layout.h:44
EQFABRIC_INL VisitorResult accept(Visitor &visitor)
Traverse this layout and all children using a layout visitor.
A visitor to traverse non-leaf elements and their children in a tree.
std::vector< V * > Views
A vector of pointers to views.
Definition: fabric/layout.h:36
Base data transport class for layouts.
Definition: fabric/layout.h:30
EQFABRIC_INL bool isActive() const
ElementVisitor< L, LeafVisitor< V > > Visitor
The layout visitor type.
Definition: fabric/layout.h:38
Internal base class for all distributed, inheritable Equalizer objects.
Definition: object.h:41
EQFABRIC_API Object()
Construct a new Object.
const Views & getViews() const
Get the list of views.
Definition: fabric/layout.h:47