-
Notifications
You must be signed in to change notification settings - Fork 30
/
PrimitiveShapeVisitor.h
68 lines (56 loc) · 1.44 KB
/
PrimitiveShapeVisitor.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
#ifndef PRIMITIVESHAPEVISITOR_HEADER
#define PRIMITIVESHAPEVISITOR_HEADER
#ifndef DLL_LINKAGE
#define DLL_LINKAGE
#endif
class DLL_LINKAGE PlanePrimitiveShape;
class DLL_LINKAGE SpherePrimitiveShape;
class DLL_LINKAGE CylinderPrimitiveShape;
class DLL_LINKAGE ConePrimitiveShape;
class DLL_LINKAGE TorusPrimitiveShape;
class DLL_LINKAGE PrimitiveShapeVisitor
{
public:
virtual ~PrimitiveShapeVisitor() {}
virtual void Visit(const PlanePrimitiveShape &plane) = 0;
virtual void Visit(const SpherePrimitiveShape &sphere) = 0;
virtual void Visit(const CylinderPrimitiveShape &cylinder) = 0;
virtual void Visit(const ConePrimitiveShape &cone) = 0;
virtual void Visit(const TorusPrimitiveShape &torus) = 0;
};
template< class BaseT >
class PrimitiveShapeVisitorShell
: public BaseT
{
public:
PrimitiveShapeVisitorShell() {}
template< class T >
PrimitiveShapeVisitorShell(const T &t)
: BaseT(t)
{}
template< class A, class B >
PrimitiveShapeVisitorShell(const A &a, const B &b)
: BaseT(a, b)
{}
void Visit(const PlanePrimitiveShape &plane)
{
BaseT::Visit(plane);
}
void Visit(const SpherePrimitiveShape &sphere)
{
BaseT::Visit(sphere);
}
void Visit(const CylinderPrimitiveShape &cylinder)
{
BaseT::Visit(cylinder);
}
void Visit(const ConePrimitiveShape &cone)
{
BaseT::Visit(cone);
}
void Visit(const TorusPrimitiveShape &torus)
{
BaseT::Visit(torus);
}
};
#endif