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