converter.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** PreProcessor
10 *****************************************************************************/
11 
12 #ifndef ECL_CONVERTERS_CONVERTER_HPP_
13 #define ECL_CONVERTERS_CONVERTER_HPP_
14 
15 /*****************************************************************************
16 ** Include
17 *****************************************************************************/
18 
19 #include <ecl/errors/handlers.hpp>
20 
21 /*****************************************************************************
22 ** Namespaces
23 *****************************************************************************/
24 
25 namespace ecl {
29 namespace converters {
30 
31 class ConverterBase {
32 public:
33  ConverterBase() : error_handler(ecl::NoError) {};
34  virtual Error error() const { return error_handler; }
35 protected:
36  Error error_handler;
37 };
38 } // namespace converters
42 /*****************************************************************************
43 ** Converter Interface
44 *****************************************************************************/
55 template <typename Output, typename Input = void>
56 class Converter : public converters::ConverterBase {
57 public:
58  virtual ~Converter() {}
59  Output operator()(const Input &input);
60 };
61 
70 template <typename Output>
71 class Converter<Output,void> : public converters::ConverterBase {
72 public:
73  virtual ~Converter() {}
74 
75  template <typename Input>
76  Output operator()(const Input &input);
77 };
78 
79 /*****************************************************************************
80 ** Converter Implementation
81 *****************************************************************************/
90 template <typename Output, typename Input>
91 Output Converter<Output,Input>::operator ()(const Input &input)
92 {
93  return typename Output::Converter()(input);
94 };
95 
104 template <typename Output>
105 template <typename Input>
106 Output Converter<Output,void>::operator ()(const Input &input)
107 {
108  return typename Output::Converter()(input);
109 };
110 
111 }; // Namespace ecl
112 
113 
114 #endif /* ECL_CONVERTERS_CONVERTER_HPP_ */
virtual ~Converter()
Definition: converter.hpp:58
Primary template and general fallback for converter classes.
Definition: converter.hpp:56
Output operator()(const Input &input)
Definition: converter.hpp:91


ecl_converters
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:08:21