Equalizer  1.10.1
Parallel Rendering Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
paths.h
1 
2 /* Copyright (c) 2009-2010, 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_PATHS_H
19 #define EQFABRIC_PATHS_H
20 
21 #include "types.h"
22 
24 namespace eq
25 {
26 namespace fabric
27 {
28 
29 //----- defines path types with are used to reference entities
30 // node...channel hierarchy
31 struct NodePath
32 {
33  explicit NodePath( const uint32_t index = 0 ) : nodeIndex( index ) {}
34  uint32_t nodeIndex;
35 };
36 
37 struct PipePath : public NodePath
38 {
39  explicit PipePath( const uint32_t index = 0 ) : pipeIndex( index ) {}
40  explicit PipePath( const NodePath& p ) : NodePath( p ), pipeIndex( 0 ) {}
41  uint32_t pipeIndex;
42 };
43 
44 struct WindowPath : public PipePath
45 {
46  explicit WindowPath( const uint32_t index = 0 ) : windowIndex( index ) {}
47  explicit WindowPath( const PipePath& p )
48  : PipePath( p ), windowIndex( 0 ) {}
49  uint32_t windowIndex;
50 };
51 
52 struct ChannelPath : public WindowPath
53 {
54  explicit ChannelPath( const uint32_t index = 0 ) : channelIndex( index ) {}
55  explicit ChannelPath( const WindowPath& p )
56  : WindowPath( p ), channelIndex( 0 ) {}
57  uint32_t channelIndex;
58 };
59 
60 // View hierarchy
61 struct CanvasPath
62 {
63  explicit CanvasPath( const uint32_t index = 0 ) : canvasIndex( index ) {}
64  uint32_t canvasIndex;
65 };
66 
67 struct SegmentPath : public CanvasPath
68 {
69  explicit SegmentPath( const uint32_t index = 0 ) : segmentIndex( index ) {}
70  explicit SegmentPath( const CanvasPath& p )
71  : CanvasPath( p ), segmentIndex( 0 ) {}
72  uint32_t segmentIndex;
73 };
74 
75 struct ObserverPath
76 {
77  explicit ObserverPath( const uint32_t index = 0 )
78  : observerIndex( index ) {}
79  uint32_t observerIndex;
80 };
81 
82 struct LayoutPath
83 {
84  explicit LayoutPath( const uint32_t index = 0 ) : layoutIndex( index ) {}
85  uint32_t layoutIndex;
86 };
87 
88 struct ViewPath : public LayoutPath
89 {
90  explicit ViewPath( const uint32_t index = 0 ) : viewIndex( index ) {}
91  explicit ViewPath( const LayoutPath& p )
92  : LayoutPath( p ), viewIndex( 0 ) {}
93  uint32_t viewIndex;
94 };
95 
96 // ostream operators
97 inline std::ostream& operator << ( std::ostream& os, const NodePath& path )
98 {
99  os << "node " << path.nodeIndex;
100  return os;
101 }
102 inline std::ostream& operator << ( std::ostream& os, const PipePath& path )
103 {
104  os << static_cast< const NodePath& >( path ) << " pipe " << path.pipeIndex;
105  return os;
106 }
107 inline std::ostream& operator << ( std::ostream& os, const WindowPath& path )
108 {
109  os << static_cast< const PipePath& >( path ) << " window "
110  << path.windowIndex;
111  return os;
112 }
113 inline std::ostream& operator << ( std::ostream& os, const ChannelPath& path )
114 {
115  os << static_cast< const WindowPath& >( path ) << " channel "
116  << path.channelIndex;
117  return os;
118 }
119 
120 inline std::ostream& operator << ( std::ostream& os, const ObserverPath& path )
121 {
122  os << "observer " << path.observerIndex;
123  return os;
124 }
125 
126 inline std::ostream& operator << ( std::ostream& os, const LayoutPath& path )
127 {
128  os << "layout " << path.layoutIndex;
129  return os;
130 }
131 inline std::ostream& operator << ( std::ostream& os, const ViewPath& path )
132 {
133  os << static_cast< const LayoutPath& >( path ) << " view "
134  << path.viewIndex;
135  return os;
136 }
137 
138 inline std::ostream& operator << ( std::ostream& os, const CanvasPath& path )
139 {
140  os << "canvas " << path.canvasIndex;
141  return os;
142 }
143 inline std::ostream& operator << ( std::ostream& os, const SegmentPath& path )
144 {
145  os << static_cast< const CanvasPath& >( path ) << " segment "
146  << path.segmentIndex;
147  return os;
148 }
151 }
152 }
153 #endif // EQFABRIC_PATHS_H