-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_gr_shwr.h
210 lines (180 loc) · 6.01 KB
/
_gr_shwr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#ifndef __GR_SHWR_H
#define __GR_SHWR_H
// Copyright David Lawrence Bien 1997 - 2021.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt).
// _gr_shwr.h
// This module implements wrappers for shadow graph elements.
__DGRAPH_BEGIN_NAMESPACE
template < class t_TyLinkEl, class t_TyNodeEl, class t_TyGraphLinkBase,
class t_TyShadowNode, class t_TyShadowLink,
class t_TyShadowEl = _sgraph_element< t_TyShadowLink > >
class _sgraph_link : public t_TyGraphLinkBase
{
typedef t_TyGraphLinkBase _TyBase;
typedef _sgraph_link< t_TyLinkEl, t_TyNodeEl, t_TyGraphLinkBase,
t_TyShadowNode, t_TyShadowLink, t_TyShadowEl > _TyThis;
public:
typedef t_TyLinkEl _TyLinkEl;
typedef t_TyNodeEl _TyNodeEl;
typedef t_TyGraphLinkBase _TyGraphLinkBase;
typedef typename t_TyGraphLinkBase::_TyGraphLinkBase _TyGraphLinkBaseBase;
typedef typename _TyGraphLinkBase::_TyGraphNodeBase _TyGraphNodeBase;
typedef typename _TyGraphNodeBase::_TyGraphNodeBase _TyGraphNodeBaseBase;
typedef _sgraph_node< _TyNodeEl, _TyLinkEl, _TyGraphNodeBase,
t_TyShadowNode, t_TyShadowLink,
_sgraph_element< t_TyShadowNode > > _TyGraphNode;
typedef t_TyShadowEl _TyShadowEl;
public:
_sgraph_link( )
{
}
// This accesses the constructable object within the _graph_link.
_TyShadowEl & RElObject() noexcept(true)
{
return m_tElShadow;
}
// Element access:
_TyLinkEl & REl() noexcept(true)
{
return m_tElShadow.REl();
}
const _TyLinkEl & REl() const noexcept(true)
{
return m_tElShadow.REl();
}
_TyLinkEl & RElNonConst() noexcept(true)
{
return m_tElShadow.RElNonConst();
}
const _TyLinkEl & RElConst() const noexcept(true)
{
return m_tElShadow.RElConst();
}
operator _TyLinkEl & () noexcept(true)
{
return RElNonConst();
}
operator const _TyLinkEl & () const noexcept(true)
{
return RElConst();
}
// typed child/parent node access:
_TyGraphNode * PGNChild()
{
return static_cast< _TyGraphNode* >( PGNBChild() );
}
_TyGraphNode * PGNParent()
{
return static_cast< _TyGraphNode* >( PGNBParent() );
}
_TyThis ** PPGLGetNextChild()
{
return (_TyThis**)PPGLBGetNextChild();
}
_TyThis ** PPGLGetNextParent()
{
return (_TyThis**)PPGLBGetNextParent();
}
_TyThis ** PPGLGetThisChild()
{
return (_TyThis**)PPGLBGetThisChild();
}
_TyThis ** PPGLGetThisParent()
{
return (_TyThis**)PPGLBGetThisParent();
}
void InsertParent( _TyThis ** _ppgl )
{
_TyGraphLinkBase::InsertParent( (_TyGraphLinkBase**)_ppgl );
}
void InsertChild( _TyThis ** _ppgl )
{
_TyGraphLinkBase::InsertChild( (_TyGraphLinkBase**)_ppgl );
}
protected:
_TyShadowEl m_tElShadow;
};
template < class t_TyNodeEl, class t_TyLinkEl, class t_TyGraphNodeBase,
class t_TyShadowNode, class t_TyShadowLink,
class t_TyShadowEl = _sgraph_element< t_TyShadowNode > >
class _sgraph_node : public t_TyGraphNodeBase
{
typedef t_TyGraphNodeBase _TyBase;
typedef _sgraph_node< t_TyNodeEl, t_TyLinkEl, t_TyGraphNodeBase,
t_TyShadowNode, t_TyShadowLink, t_TyShadowEl > _TyThis;
public:
typedef t_TyNodeEl _TyNodeEl;
typedef t_TyLinkEl _TyLinkEl;
typedef t_TyGraphNodeBase _TyGraphNodeBase;
typedef typename t_TyGraphNodeBase::_TyGraphNodeBase _TyGraphNodeBaseBase;
typedef typename _TyGraphNodeBase::_TyGraphLinkBase _TyGraphLinkBase;
typedef typename _TyGraphLinkBase::_TyGraphLinkBase _TyGraphLinkBaseBase;
typedef _sgraph_link< _TyLinkEl, _TyNodeEl, _TyGraphLinkBase,
t_TyShadowNode, t_TyShadowLink,
_sgraph_element< t_TyShadowLink > > _TyGraphLink;
typedef t_TyShadowEl _TyShadowEl;
public:
_sgraph_node()
{
}
_TyShadowEl & RElObject() noexcept(true)
{
return m_tElShadow;
}
// Element access:
_TyNodeEl & REl() noexcept(true)
{
return m_tElShadow.REl();
}
const _TyNodeEl & REl() const noexcept(true)
{
return m_tElShadow.REl();
}
_TyNodeEl & RElNonConst() noexcept(true)
{
return m_tElShadow.RElNonConst();
}
const _TyNodeEl & RElConst() const noexcept(true)
{
return m_tElShadow.RElConst();
}
operator _TyNodeEl & () noexcept(true)
{
return RElNonConst();
}
operator const _TyNodeEl & () const noexcept(true)
{
return RElConst();
}
// child/parent typed link list access:
_TyGraphLink ** PPGLChildHead() noexcept(true)
{
return (_TyGraphLink**)PPGLBChildHead();
}
_TyGraphLink * const * PPGLChildHead() const noexcept(true)
{
return (_TyGraphLink* const *)PPGLBChildHead();
}
_TyGraphLink ** PPGLParentHead() noexcept(true)
{
return (_TyGraphLink**)PPGLBParentHead();
}
_TyGraphLink * const * PPGLParentHead() const noexcept(true)
{
return (_TyGraphLink* const *)PPGLBParentHead();
}
_TyGraphLink ** PPGLRelationHead( bool _fChild ) noexcept(true)
{
return (_TyGraphLink**)PPGLBRelationHead( _fChild );
}
_TyGraphLink * const * PPGLRelationHead( bool _fChild ) const noexcept(true)
{
return (_TyGraphLink* const *)PPGLBRelationHead( _fChild );
}
protected:
_TyShadowEl m_tElShadow;
};
__DGRAPH_END_NAMESPACE
#endif //__GR_SHWR_H