Equalizer  1.13.0
Parallel Rendering Framework
fabric/node.h
1 
2 /* Copyright (c) 2010-2014, Stefan Eilemann <eile@eyescale.ch>
3  * 2010, Cedric Stalder<cedric.stalder@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef EQFABRIC_NODE_H
20 #define EQFABRIC_NODE_H
21 
22 #include <eq/fabric/object.h> // base class
23 #include <eq/fabric/types.h>
24 
25 namespace eq
26 {
27 namespace fabric
28 {
30 // cppcheck-suppress noConstructor
31 template< class C, class N, class P, class V > class Node : public Object
32 {
33 public:
35  typedef std::vector< P* > Pipes;
36 
40  C* getConfig() { return _config; }
41 
43  const C* getConfig() const { return _config; }
44 
46  const Pipes& getPipes() const { return _pipes; }
47 
53  bool isApplicationNode() const { return _isAppNode; }
54 
56  EQFABRIC_INL void setApplicationNode( const bool isAppNode );
57 
59  EQFABRIC_INL NodePath getPath() const;
60  P* findPipe( const uint128_t& id );
61 
69  EQFABRIC_INL VisitorResult accept( V& visitor );
70 
72  EQFABRIC_INL VisitorResult accept( V& visitor ) const;
74 
77  // Note: also update string array initialization in node.ipp
80  {
84  IATTR_HINT_AFFINITY,
85  IATTR_LAST,
86  IATTR_ALL = IATTR_LAST + 5
87  };
88 
90  EQFABRIC_INL void setIAttribute( const IAttribute attr,
91  const int32_t value );
92 
94  EQFABRIC_INL int32_t getIAttribute( const IAttribute attr ) const;
95 
97  static const std::string& getIAttributeString( const IAttribute attr );
99 
102  EQFABRIC_INL virtual void backup();
103  EQFABRIC_INL virtual void restore();
104  void create( P** pipe );
105  void release( P* pipe );
106  virtual void output( std::ostream& ) const {}
107  EQFABRIC_INL virtual uint128_t commit( const uint32_t incarnation =
108  CO_COMMIT_NEXT );
110 
111 protected:
113  explicit Node( C* parent );
114 
116  EQFABRIC_INL virtual ~Node();
117 
119  EQFABRIC_INL virtual void serialize( co::DataOStream& os,
120  const uint64_t dirtyBits );
122  EQFABRIC_INL virtual void deserialize( co::DataIStream& is,
123  const uint64_t dirtyBits );
124 
125  EQFABRIC_INL virtual void notifyDetach();
126 
128  EQFABRIC_INL virtual void setDirty( const uint64_t bits );
129 
131  virtual ChangeType getChangeType() const { return UNBUFFERED; }
132 
133  enum DirtyBits
134  {
135  DIRTY_ATTRIBUTES = Object::DIRTY_CUSTOM << 0,
136  DIRTY_PIPES = Object::DIRTY_CUSTOM << 1,
137  DIRTY_MEMBER = Object::DIRTY_CUSTOM << 2,
138  DIRTY_NODE_BITS =
139  DIRTY_ATTRIBUTES | DIRTY_PIPES | DIRTY_MEMBER |
140  DIRTY_OBJECT_BITS
141  };
142 
144  virtual uint64_t getRedistributableBits() const
145  { return DIRTY_NODE_BITS; }
146 
147 private:
149  Pipes _pipes;
150 
152  C* const _config;
153 
154  struct BackupData
155  {
156  BackupData();
158  int32_t iAttributes[IATTR_ALL];
159  }
160  _data, _backup;
161 
162  bool _isAppNode;
163 
164  template< class, class, class, class > friend class Pipe;
165  void _addPipe( P* pipe );
166  bool _removePipe( P* pipe );
167 
169  bool _mapNodeObjects() { return _config->mapNodeObjects(); }
170 };
171 
172 template< class C, class N, class P, class V > EQFABRIC_INL
173 std::ostream& operator << ( std::ostream&, const Node< C, N, P, V >& );
174 }
175 }
176 
177 #endif // EQFABRIC_NODE_H
IAttribute
Possible values for integer attributes.
Definition: iAttribute.h:30
const Pipes & getPipes() const
Definition: fabric/node.h:46
EQFABRIC_INL int32_t getIAttribute(const IAttribute attr) const
A Node represents a single computer in the cluster.
Definition: node.h:48
const C * getConfig() const
Definition: fabric/node.h:43
std::vector< P * > Pipes
A vector of pointers to pipes.
Definition: fabric/node.h:35
Base data transport class for nodes.
Definition: fabric/node.h:31
EQFABRIC_INL VisitorResult accept(V &visitor)
Perform a depth-first traversal of this node.
virtual EQFABRIC_INL void setDirty(const uint64_t bits)
The Equalizer client library.
Definition: eq/agl/types.h:23
Timeout when auto-launching the node.
Definition: fabric/node.h:83
Internal base class for all distributed, inheritable Equalizer objects.
Definition: object.h:41