Go to the documentation of this file.00001 
00008 
00009 
00010 
00011 
00012 #ifndef ECL_CONVERTERS_CONVERTER_HPP_
00013 #define ECL_CONVERTERS_CONVERTER_HPP_
00014 
00015 
00016 
00017 
00018 
00019 #include <ecl/errors/handlers.hpp>
00020 
00021 
00022 
00023 
00024 
00025 namespace ecl {
00029 namespace converters {
00030 
00031 class ConverterBase {
00032 public:
00033         ConverterBase() : error_handler(ecl::NoError) {};
00034         virtual Error error() const { return error_handler; }
00035 protected:
00036         Error error_handler;
00037 };
00038 } 
00042 
00043 
00044 
00055 template <typename Output, typename Input = void>
00056 class Converter : public converters::ConverterBase {
00057 public:
00058         virtual ~Converter() {}
00059         Output operator()(const Input &input);
00060 };
00061 
00070 template <typename Output>
00071 class Converter<Output,void> : public converters::ConverterBase {
00072 public:
00073     virtual ~Converter() {}
00074 
00075         template <typename Input>
00076         Output operator()(const Input &input);
00077 };
00078 
00079 
00080 
00081 
00090 template <typename Output, typename Input>
00091 Output Converter<Output,Input>::operator ()(const Input &input)
00092 {
00093     return typename Output::Converter()(input);
00094 };
00095 
00104 template <typename Output>
00105 template <typename Input>
00106 Output Converter<Output,void>::operator ()(const Input &input)
00107 {
00108     return typename Output::Converter()(input);
00109 };
00110 
00111 }; 
00112 
00113 
00114 #endif