Home
FAQ
Player
Stage
Gazebo
Contrib
Documentation
Publications
Contributors
Users

Project
Download
Bugs/Feedback
Mailing lists

Radish

Old news
Old stuff

drivertable.h

Go to the documentation of this file.
00001 /*
00002  *  Player - One Hell of a Robot Server
00003  *  Copyright (C) 2000  
00004  *     Brian Gerkey, Kasper Stoy, Richard Vaughan, & Andrew Howard
00005  *                      
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU General Public License as published by
00009  *  the Free Software Foundation; either version 2 of the License, or
00010  *  (at your option) any later version.
00011  *
00012  *  This program is distributed in the hope that it will be useful,
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  *  GNU General Public License for more details.
00016  *
00017  *  You should have received a copy of the GNU General Public License
00018  *  along with this program; if not, write to the Free Software
00019  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 /*
00024  * $Id: drivertable.h,v 1.7 2004/11/11 07:40:44 inspectorg Exp $
00025  *
00026  *   class to keep track of available drivers.  
00027  */
00028 
00029 #ifndef _DRIVERTABLE_H
00030 #define _DRIVERTABLE_H
00031 
00032 #include <pthread.h>
00033 #include "device.h"
00034 #include "configfile.h"
00035 
00036 
00037 // Forward declarations
00038 class DriverTable;
00039 class ConfigFile;
00040 
00041 
00043 typedef Driver* (*DriverInitFn) (ConfigFile *cf, int section);
00044 
00046 typedef int (*PluginInitFn) (DriverTable* table);
00047 
00048 
00050 class DriverEntry
00051 {
00052   public:
00053 
00054   // factory creation function
00055   DriverInitFn initfunc;
00056 
00057   // the string name for the driver
00058   char name[PLAYER_MAX_DEVICE_STRING_LEN]; 
00059 
00060   // next in list
00061   DriverEntry* next;  
00062 
00063   DriverEntry() { name[0]='\0'; next = NULL; }
00064 };
00065 
00066 
00071 class DriverTable
00072 {
00073   private:
00074 
00075   // we'll keep the driver info here.
00076   DriverEntry* head;
00077   int numdrivers;
00078 
00079   public:
00080 
00081   DriverTable();
00082   ~DriverTable();
00083 
00087   int AddDriver(char* name, DriverInitFn initfunc);
00088 
00091   DriverEntry* GetDriverEntry(const char* name);
00092 
00094   int Size() { return(numdrivers); }
00095 
00099   char* GetDriverName(int idx);
00100 
00104   char** SortDrivers();
00105 };
00106 
00107 #endif

Generated on Tue May 3 14:15:34 2005 for Player by doxygen 1.3.6