00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef VBKEYVISITOR_HPP_
00012 #define VBKEYVISITOR_HPP_
00013
00014 #include <iostream>
00015 #include <cv.h>
00016 #include <cxcore.h>
00017 #include <highgui.h>
00018 #include <vector>
00019 #include <string>
00020 #include <boost/variant.hpp>
00021 #include "visionbehavior.hpp"
00022
00027 enum VBKeyEnum {KEYPRESSED};
00028
00035 typedef boost::variant<char> VariantKeyArg;
00036
00041 template<enum VBKeyEnum e>
00042 class VBKeyVisitor : public boost::static_visitor<> {
00043 public:
00044 template <class T>
00045 void operator()(VisionBehavior<T>* vb,
00046 char& c) const {
00047 switch (e) {
00048 case KEYPRESSED:
00049 vb->actOnKeyPressed(c);
00050 break;
00051 default:
00052 std::cerr << "Error: VBKeyVisitor called " <<
00053 "with unknown enum" << std::endl;
00054 }
00055 }
00056
00057 template <class T>
00058 void operator()(VisionBehavior<T>* vb) const {
00059 std::cerr << "Error: VBKeyVisitor called " <<
00060 "with bad enum" << std::endl;
00061 }
00062 };
00063
00064 #endif