Loading...
Searching...
No Matches
Visitor.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file terralib/common/Visitor.h
22
23 \brief A generic class for visitors.
24*/
25
26#ifndef __TERRALIB_COMMON_INTERNAL_VISITOR_H
27#define __TERRALIB_COMMON_INTERNAL_VISITOR_H
28
29namespace te
30{
31 namespace common
32 {
33 /*!
34 \class Visitor
35
36 \brief A generic class for visitors.
37
38 This class defines a pure virtual function for visiting an object of type T.
39
40 This function may return a value (see the R type in template declaration).
41
42 Requirements on types:
43 <ul>
44 <li>T: the type of visitable;</li>
45 <li>R: the return type for the visit method.</li>
46 </ul>
47
48 \ingroup common
49
50 \sa BaseVisitor, BaseVisitable
51 */
52 template<class T, class R = void> class Visitor //: public BaseVisitor
53 {
54 public:
55
56 typedef R ReturnType;
57
58 /*!
59 \brief Pure virtual function that visitors must implement in order to visit some other object of type T.
60
61 \param visited The object to be visited.
62 */
63 virtual ReturnType visit(T& visited) = 0;
64 };
65
66 } // end namespace common
67} // end namespace te
68
69#endif // __TERRALIB_COMMON_INTERNAL_VISITOR_H
70
71
72
A generic class for visitors.
Definition: Visitor.h:53
virtual ReturnType visit(T &visited)=0
Pure virtual function that visitors must implement in order to visit some other object of type T.
TerraLib.