Lumiera  0.pre.03
»edit your freedom«
visitor-policies.hpp
Go to the documentation of this file.
1 /*
2  VISITOR-POLICIES.hpp - Acyclic Visitor library
3 
4  Copyright (C)
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 
12 */
13 
14 
23 #ifndef LUMIERA_VISITOR_POLICIES_H
24 #define LUMIERA_VISITOR_POLICIES_H
25 
26 #include "lib/error.hpp"
27 
28 
29 namespace lib {
30 namespace visitor {
31 
37  template<class RET>
38  struct UseDefault
39  {
40  template<class TAR>
41  RET
42  onUnknown (TAR&)
43  {
44  return RET();
45  }
46  };
47 
51  template<class RET>
53  {
54  template<class TAR>
55  RET
56  onUnknown (TAR&)
57  {
58  throw lumiera::error::Config("unable to decide what tool operation to call");
59  }
60  };
61 
62 
63 
64 }} // namespace lib::visitor
65 #endif
Implementation namespace for support and library code.
Derived specific exceptions within Lumiera&#39;s exception hierarchy.
Definition: error.hpp:190
Lumiera error handling (C++ interface).
Policy to throw when encountering an unknown visiting tool.
Policy returning just the default return value in case of encountering an unknown Visitor (typically ...