imagebase.h
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  Brian Gerkey et al
00004  *                      gerkey@usc.edu
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00022 //
00023 // Desc: base driver for image processing and transform drivers
00024 // Author: Toby Collett
00025 // Date: 15 Feb 2004
00026 // CVS: $Id: imagebase.h 8003 2009-07-13 10:34:37Z thjc $
00027 //
00029 
00030 
00058 #include <libplayercore/playercore.h>
00059 
00060 // Driver for detecting laser retro-reflectors.
00061 class ImageBase : public ThreadedDriver
00062 {
00063         public:
00064                 // Constructor
00065                 ImageBase(ConfigFile *cf, int section, bool overwrite_cmds, size_t queue_maxlen, int interf);
00066                 ImageBase(ConfigFile *cf, int section, bool overwrite_cmds = true, size_t queue_maxlen = PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
00067                 virtual ~ImageBase()
00068                 {
00069                   if (stored_data.image) delete [](stored_data.image);
00070                   PLAYER_WARN("image deleted from the memory");
00071                 }
00072 
00073                 // Process incoming messages from clients
00074                 int ProcessMessage (QueuePointer &resp_queue, player_msghdr * hdr, void * data);
00075 
00076         private:
00077                 ImageBase(); // no default constructor
00078                 ImageBase(const ImageBase &); // no copy constructor
00079 
00080         protected:
00081                 virtual int ProcessFrame() = 0;
00082                 // Main functions for device thread.
00083                 virtual void Main();
00084                 virtual int MainSetup();
00085                 virtual void MainQuit();
00086 
00087                 // Input camera stuff
00088                 Device *camera_driver;
00089                 player_devaddr_t camera_addr;
00090                 player_camera_data_t stored_data;
00091                 bool HaveData;
00092 };