Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
Loading...
Searching...
No Matches
visitor.hpp
Go to the documentation of this file.
1//This file is part of Bertini 2.
2//
3//visitor.hpp is free software: you can redistribute it and/or modify
4//it under the terms of the GNU General Public License as published by
5//the Free Software Foundation, either version 3 of the License, or
6//(at your option) any later version.
7//
8//visitor.hpp is distributed in the hope that it will be useful,
9//but WITHOUT ANY WARRANTY; without even the implied warranty of
10//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11//GNU General Public License for more details.
12//
13//You should have received a copy of the GNU General Public License
14//along with visitor.hpp. If not, see <http://www.gnu.org/licenses/>.
15//
16// Copyright(C) Bertini2 Development Team
17//
18// See <http://www.gnu.org/licenses/> for a copy of the license,
19// as well as COPYING. Bertini2 is provided with permitted
20// additional terms in the b2/licenses/ directory.
21
27
28#ifndef BERTINI_DETAIL_VISITOR_HPP
29#define BERTINI_DETAIL_VISITOR_HPP
30#include <boost/type_index.hpp>
31
32namespace bertini{
33
42 { BOOST_TYPE_INDEX_REGISTER_CLASS
43 public:
44 virtual ~VisitorBase() = default;
45 };
46
47
56 template<class VisitedT, typename RetT = void>
57 class Visitor
58 { BOOST_TYPE_INDEX_REGISTER_CLASS
59 public:
60 typedef RetT ReturnType;
62 virtual ReturnType Visit(VisitedT const &) = 0;
63 virtual ~Visitor() = default;
64 };
65
66
67
68}
69
70#endif
A strawman class for implementing the visitor pattern.
Definition visitor.hpp:42
virtual ~VisitorBase()=default
The first non-trivial visitor class.
Definition visitor.hpp:58
virtual ~Visitor()=default
RetT ReturnType
The type returned when visiting.
Definition visitor.hpp:60
virtual ReturnType Visit(VisitedT const &)=0
Visit an object of the visited type.
Definition algorithm_builder.hpp:36