Fawkes API  Fawkes Development Version
hand_if_observer.h
00001 
00002 /***************************************************************************
00003  *  hand_if_observer.h - Skeleton hand interface observer
00004  *
00005  *  Created: Sat Apr 02 19:26:57 2011 (RoboCup German Open 2011, Magdeburg)
00006  *  Copyright  2006-2011  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_OPENNI_UTILS_HAND_IF_OBSERVER_H_
00024 #define __PLUGINS_OPENNI_UTILS_HAND_IF_OBSERVER_H_
00025 
00026 #include <plugins/openni/utils/types.h>
00027 #include <blackboard/interface_observer.h>
00028 
00029 #include <queue>
00030 #include <string>
00031 
00032 namespace fawkes {
00033   class BlackBoard;
00034   class Mutex;
00035 
00036   namespace openni {
00037 #if 0 /* just to make Emacs auto-indent happy */
00038   }
00039 }
00040 #endif
00041 
00042 class HandIfObserver : public BlackBoardInterfaceObserver
00043 {
00044  public:
00045   HandIfObserver(BlackBoard *bb, HandMap &hands);
00046   ~HandIfObserver();
00047 
00048   virtual void bb_interface_created(const char *type, const char *id) throw();
00049 
00050   void process_queue();
00051 
00052  private:
00053   HandMap &__hands;
00054   BlackBoard *__bb;
00055   Mutex *__queue_lock;
00056   unsigned int __active_queue;
00057   std::queue<std::string> __queues[2];
00058 };
00059 
00060 } // end namespace fawkes::openni
00061 } // end namespace fawkes
00062 
00063 #endif