Equalizer  2.1.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>
32 class Node : public Object
33 {
34 public:
36  typedef std::vector<P*> Pipes;
37 
41  C* getConfig() { return _config; }
43  const C* getConfig() const { return _config; }
45  const Pipes& getPipes() const { return _pipes; }
51  bool isApplicationNode() const { return _isAppNode; }
53  EQFABRIC_INL void setApplicationNode(const bool isAppNode);
54 
56  EQFABRIC_INL NodePath getPath() const;
57  P* findPipe(const uint128_t& id);
58 
66  EQFABRIC_INL VisitorResult accept(V& visitor);
67 
69  EQFABRIC_INL VisitorResult accept(V& visitor) const;
71 
74  // Note: also update string array initialization in node.ipp
77  {
83  IATTR_HINT_AFFINITY,
84  IATTR_LAST,
85  IATTR_ALL = IATTR_LAST + 5
86  };
87 
89  EQFABRIC_INL void setIAttribute(const IAttribute attr, const int32_t value);
90 
92  EQFABRIC_INL int32_t getIAttribute(const IAttribute attr) const;
93 
95  static const std::string& getIAttributeString(const IAttribute attr);
97 
100  EQFABRIC_INL virtual void backup();
101  EQFABRIC_INL virtual void restore();
102  void create(P** pipe);
103  void release(P* pipe);
104  virtual void output(std::ostream&) const {}
105  EQFABRIC_INL virtual uint128_t commit(
106  const uint32_t incarnation = CO_COMMIT_NEXT);
108 
109 protected:
111  explicit Node(C* parent);
112 
114  EQFABRIC_INL virtual ~Node();
115 
117  EQFABRIC_INL virtual void serialize(co::DataOStream& os,
118  const uint64_t dirtyBits);
120  EQFABRIC_INL virtual void deserialize(co::DataIStream& is,
121  const uint64_t dirtyBits);
122 
123  EQFABRIC_INL virtual void notifyDetach();
124 
126  EQFABRIC_INL virtual void setDirty(const uint64_t bits);
127 
129  virtual ChangeType getChangeType() const { return UNBUFFERED; }
130  enum DirtyBits
131  {
132  DIRTY_ATTRIBUTES = Object::DIRTY_CUSTOM << 0,
133  DIRTY_PIPES = Object::DIRTY_CUSTOM << 1,
134  DIRTY_MEMBER = Object::DIRTY_CUSTOM << 2,
135  DIRTY_NODE_BITS =
136  DIRTY_ATTRIBUTES | DIRTY_PIPES | DIRTY_MEMBER | DIRTY_OBJECT_BITS
137  };
138 
140  virtual uint64_t getRedistributableBits() const { return DIRTY_NODE_BITS; }
141 private:
143  Pipes _pipes;
144 
146  C* const _config;
147 
148  struct BackupData
149  {
150  BackupData();
152  int32_t iAttributes[IATTR_ALL];
153  } _data, _backup;
154 
155  bool _isAppNode;
156 
157  template <class, class, class, class>
158  friend class Pipe;
159  void _addPipe(P* pipe);
160  bool _removePipe(P* pipe);
161 
163  bool _mapNodeObjects() { return _config->mapNodeObjects(); }
164 };
165 
166 template <class C, class N, class P, class V>
167 EQFABRIC_INL std::ostream& operator<<(std::ostream&, const Node<C, N, P, V>&);
168 }
169 }
170 
171 #endif // EQFABRIC_NODE_H
const Pipes & getPipes() const
Definition: fabric/node.h:45
EQFABRIC_INL int32_t getIAttribute(const IAttribute attr) const
DirtyBits
The changed parts of the object since the last pack().
Definition: object.h:107
Base data transport class for pipes.
Definition: fabric/pipe.h:32
const C * getConfig() const
Definition: fabric/node.h:43
Base data transport class for nodes.
Definition: fabric/node.h:32
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
std::vector< P * > Pipes
A vector of pointers to pipes.
Definition: fabric/node.h:36
Timeout when auto-launching the node.
Definition: fabric/node.h:82
Internal base class for all distributed, inheritable Equalizer objects.
Definition: object.h:44