imagebase.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey et al
4  * gerkey@usc.edu
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
22 //
23 // Desc: base driver for image processing and transform drivers
24 // Author: Toby Collett
25 // Date: 15 Feb 2004
26 // CVS: $Id: imagebase.h 8003 2009-07-13 10:34:37Z thjc $
27 //
29 
30 
58 #include <libplayercore/playercore.h>
59 
60 // Driver for detecting laser retro-reflectors.
61 class ImageBase : public ThreadedDriver
62 {
63  public:
64  // Constructor
65  ImageBase(ConfigFile *cf, int section, bool overwrite_cmds, size_t queue_maxlen, int interf);
66  ImageBase(ConfigFile *cf, int section, bool overwrite_cmds = true, size_t queue_maxlen = PLAYER_MSGQUEUE_DEFAULT_MAXLEN);
67  virtual ~ImageBase()
68  {
69  if (stored_data.image) delete [](stored_data.image);
70  PLAYER_WARN("image deleted from the memory");
71  }
72 
73  // Process incoming messages from clients
74  int ProcessMessage (QueuePointer &resp_queue, player_msghdr * hdr, void * data);
75 
76  private:
77  ImageBase(); // no default constructor
78  ImageBase(const ImageBase &); // no copy constructor
79 
80  protected:
81  virtual int ProcessFrame() = 0;
82  // Main functions for device thread.
83  virtual void Main();
84  virtual int MainSetup();
85  virtual void MainQuit();
86 
87  // Input camera stuff
88  Device *camera_driver;
89  player_devaddr_t camera_addr;
90  player_camera_data_t stored_data;
91  bool HaveData;
92 };

Last updated 12 September 2005 21:38:45