iri_base_driver.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 Institut de Robotica i Informatica Industrial, CSIC-UPC.
00002 // Author Sergi Hernandez & Joan Perez
00003 // All rights reserved.
00004 //
00005 // This file is part of iri-ros-pkg
00006 // iri-ros-pkg is free software: you can redistribute it and/or modify
00007 // it under the terms of the GNU Lesser General Public License as published by
00008 // the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 
00019 #ifndef _IRI_BASE_DRIVER_H
00020 #define _IRI_BASE_DRIVER_H
00021 
00022 // ros base driver class
00023 #include "driver_base/driver.h"
00024 #include "ros/ros.h"
00025 
00026 namespace iri_base_driver
00027 {
00028 
00051 class IriBaseDriver : public driver_base::Driver
00052 {
00053   protected:
00060     std::string driver_id_;
00061 
00070     pthread_mutex_t access_;
00071 
00081     void setDriverId(const std::string & id);
00082 
00083 //     typedef boost::function< void() > hookFunction;
00084     hookFunction preCloseHook;
00085 
00086   public:
00093     IriBaseDriver();
00094 
00100     void lock(void);
00101 
00107     void unlock(void);
00108 
00116     bool try_enter(void);
00117 
00125     void doOpen(void);
00126 
00134     void doClose(void);
00135 
00143     void doStart(void);
00144 
00152     void doStop(void);
00153 
00163     std::string getID(void);
00164 
00174     virtual bool openDriver(void) = 0;
00175 
00184     virtual bool closeDriver(void) = 0;
00185 
00195     virtual bool startDriver(void) = 0;
00196 
00205     virtual bool stopDriver(void) = 0;
00206     
00207     
00208     void setPreCloseHook(hookFunction f);
00209 
00216     ~IriBaseDriver();
00217 };
00218 
00219 }
00220 
00221 #endif


iri_base_driver
Author(s): Joan Perez, jnperez at iri.upc.edu
autogenerated on Fri Dec 6 2013 19:58:57