vbvisitor.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 VBVISITOR_HPP_
00012 #define VBVISITOR_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 VBEnum {COMPUTE, WRITEON};
00028 
00035 typedef boost::variant<IplImage>        VariantImgArg;
00036 
00040 template<enum VBEnum e>
00041 class VBVisitor : public boost::static_visitor<> {
00042 public:
00043   template <class T>
00044   void  operator()(VisionBehavior<T>* vb,
00045                    IplImage& src) const {
00046     std::cerr << "Error: VBVisitor(IplImage) called " <<
00047       "with unknown enum" << std::endl;
00048   }
00049 };
00050 
00056 template<>
00057 class VBVisitor<COMPUTE> : public boost::static_visitor<> {
00058 public:
00059   template <class T>
00060   void  operator()(VisionBehavior<T>* vb,
00061                    IplImage& src) const {
00062     vb->doComputations(src);
00063   }
00064 };
00065 
00071 template<>
00072 class VBVisitor<WRITEON> : public boost::static_visitor<> {
00073 public:
00074   template <class T>
00075   void  operator()(VisionBehavior<T>* vb,
00076                    IplImage& src) const {
00077     vb->writeOn(src);
00078   }
00079 };
00080 
00081 #endif /* !VBVISITOR_HPP_ */

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