multi_copy.h

00001 
00002 /***************************************************************************
00003  *  multi_copy.h - Fawkes WorldModel Multi Interface Copy Fuser
00004  *
00005  *  Created: Tue Jan 13 11:49:20 2009
00006  *  Copyright  2006-2009  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_WORLDMODEL_FUSER_MULTI_COPY_H_
00024 #define __PLUGINS_WORLDMODEL_FUSER_MULTI_COPY_H_
00025 
00026 #include "fuser.h"
00027 
00028 #include <blackboard/interface_observer.h>
00029 #include <core/utils/lock_map.h>
00030 #include <string>
00031 
00032 namespace fawkes
00033 {
00034   class BlackBoard;
00035   class Interface;
00036 }
00037 
00038 class WorldModelMultiCopyFuser
00039 : public WorldModelFuser,
00040   public fawkes::BlackBoardInterfaceObserver
00041 {
00042  public:
00043   WorldModelMultiCopyFuser(fawkes::BlackBoard *blackboard, const char *type,
00044                            const char *from_id_pattern, const char *to_id_format);
00045   ~WorldModelMultiCopyFuser();
00046 
00047 
00048   virtual void fuse();
00049 
00050   virtual void bb_interface_created(const char *type, const char *id) throw();
00051 
00052  private:
00053   fawkes::BlackBoard *__blackboard;
00054 
00055   std::string __from_id_pattern;
00056   std::string __to_id_format;
00057 
00058   fawkes::LockMap<fawkes::Interface *, fawkes::Interface *> __ifmap;
00059   fawkes::LockMap<fawkes::Interface *, fawkes::Interface *>::iterator __imi;
00060 };
00061 
00062 
00063 #endif