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 4367 2008-02-18 19:42:49Z thjc $ 00027 // 00029 00030 00058 #include <libplayercore/playercore.h> 00059 #include <libplayercore/error.h> 00060 00061 // Driver for detecting laser retro-reflectors. 00062 class ImageBase : public Driver 00063 { 00064 public: 00065 // Constructor 00066 ImageBase(ConfigFile *cf, int section, bool overwrite_cmds, size_t queue_maxlen, int interf); 00067 ImageBase(ConfigFile *cf, int section, bool overwrite_cmds = true, size_t queue_maxlen = PLAYER_MSGQUEUE_DEFAULT_MAXLEN); 00068 virtual ~ImageBase() 00069 { 00070 if (stored_data.image) delete [](stored_data.image); 00071 PLAYER_WARN("image deleted from the memory"); 00072 } 00073 00074 // Setup/shutdown routines. 00075 virtual int Setup(); 00076 virtual int Shutdown(); 00077 00078 // Process incoming messages from clients 00079 int ProcessMessage (QueuePointer &resp_queue, player_msghdr * hdr, void * data); 00080 00081 private: 00082 ImageBase(); // no default constructor 00083 ImageBase(const ImageBase &); // no copy constructor 00084 00085 protected: 00086 virtual int ProcessFrame() = 0; 00087 // Main function for device thread. 00088 virtual void Main(); 00089 00090 // Input camera stuff 00091 Device *camera_driver; 00092 player_devaddr_t camera_addr; 00093 player_camera_data_t stored_data; 00094 bool HaveData; 00095 };