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