vbkeyvisitor.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) Gostai S.A.S., 2007.  All rights reserved.
00003  *
00004  * This software is provided "as is" without warranty of any kind,
00005  * either expressed or implied, including but not limited to the
00006  * implied warranties of fitness for a particular purpose.
00007  *
00008  * See the LICENSE file for more information.
00009  * For comments, bug reports and feedback: http://www.urbiforge.com
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 /* !VBKEYVISITOR_HPP_ */

Generated on Mon Dec 31 13:33:37 2007 for Vision by  doxygen 1.5.3