Equalizer  1.6.1
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  NodePath( const uint32_t index = 0 ) : nodeIndex( index ) {}
34  uint32_t nodeIndex;
35 };
36 
37 struct PipePath : public NodePath
38 {
39  PipePath( const uint32_t index = 0 ) : pipeIndex( index ) {}
40  PipePath( const NodePath& p ) : NodePath( p ), pipeIndex( 0 ) {}
41  uint32_t pipeIndex;
42 };
43 
44 struct WindowPath : public PipePath
45 {
46  WindowPath( const uint32_t index = 0 ) : windowIndex( index ) {}
47  WindowPath( const PipePath& p ) : PipePath( p ), windowIndex( 0 ) {}
48  uint32_t windowIndex;
49 };
50 
51 struct ChannelPath : public WindowPath
52 {
53  ChannelPath( const uint32_t index = 0 ) : channelIndex( index ) {}
54  ChannelPath( const WindowPath& p ) : WindowPath( p ), channelIndex( 0 ) {}
55  uint32_t channelIndex;
56 };
57 
58 // View hierarchy
59 struct CanvasPath
60 {
61  CanvasPath( const uint32_t index = 0 ) : canvasIndex( index ) {}
62  uint32_t canvasIndex;
63 };
64 
65 struct SegmentPath : public CanvasPath
66 {
67  SegmentPath( const uint32_t index = 0 ) : segmentIndex( index ) {}
68  SegmentPath( const CanvasPath& p ) : CanvasPath( p ), segmentIndex( 0 ) {}
69  uint32_t segmentIndex;
70 };
71 
72 struct ObserverPath
73 {
74  ObserverPath( const uint32_t index = 0 ) : observerIndex( index ) {}
75  uint32_t observerIndex;
76 };
77 
78 struct LayoutPath
79 {
80  LayoutPath( const uint32_t index = 0 ) : layoutIndex( index ) {}
81  uint32_t layoutIndex;
82 };
83 
84 struct ViewPath : public LayoutPath
85 {
86  ViewPath( const uint32_t index = 0 ) : viewIndex( index ) {}
87  ViewPath( const LayoutPath& p ) : LayoutPath( p ), viewIndex( 0 ) {}
88  uint32_t viewIndex;
89 };
90 
91 // ostream operators
92 inline std::ostream& operator << ( std::ostream& os, const NodePath& path )
93 {
94  os << "node " << path.nodeIndex;
95  return os;
96 }
97 inline std::ostream& operator << ( std::ostream& os, const PipePath& path )
98 {
99  os << static_cast< const NodePath& >( path ) << " pipe " << path.pipeIndex;
100  return os;
101 }
102 inline std::ostream& operator << ( std::ostream& os, const WindowPath& path )
103 {
104  os << static_cast< const PipePath& >( path ) << " window "
105  << path.windowIndex;
106  return os;
107 }
108 inline std::ostream& operator << ( std::ostream& os, const ChannelPath& path )
109 {
110  os << static_cast< const WindowPath& >( path ) << " channel "
111  << path.channelIndex;
112  return os;
113 }
114 
115 inline std::ostream& operator << ( std::ostream& os, const ObserverPath& path )
116 {
117  os << "observer " << path.observerIndex;
118  return os;
119 }
120 
121 inline std::ostream& operator << ( std::ostream& os, const LayoutPath& path )
122 {
123  os << "layout " << path.layoutIndex;
124  return os;
125 }
126 inline std::ostream& operator << ( std::ostream& os, const ViewPath& path )
127 {
128  os << static_cast< const LayoutPath& >( path ) << " view "
129  << path.viewIndex;
130  return os;
131 }
132 
133 inline std::ostream& operator << ( std::ostream& os, const CanvasPath& path )
134 {
135  os << "canvas " << path.canvasIndex;
136  return os;
137 }
138 inline std::ostream& operator << ( std::ostream& os, const SegmentPath& path )
139 {
140  os << static_cast< const CanvasPath& >( path ) << " segment "
141  << path.segmentIndex;
142  return os;
143 }
146 }
147 }
148 #endif // EQFABRIC_PATHS_H