Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArModule.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
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 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARMODULE_H
00027 #define ARMODULE_H
00028 
00029 
00030 #include "ariaTypedefs.h"
00031 #include "ArRobot.h"
00032 
00033 
00035 
00073 class ArModule
00074 {
00075 public:
00076 
00078   AREXPORT ArModule();
00080   AREXPORT virtual ~ArModule();
00081 
00083 
00092   AREXPORT virtual bool init(ArRobot *robot, 
00093                  void *argument = NULL) = 0;
00094 
00096   AREXPORT virtual bool exit() = 0;
00097 
00099   AREXPORT ArRobot * getRobot() {return(myRobot);}
00100 
00102   AREXPORT void setRobot(ArRobot *robot) {myRobot=robot;}
00103 
00104 protected:
00105 
00107   ArRobot *myRobot;
00108 };
00109 
00110 
00111 /*
00112   Beware ye all who pass beyond this point. Ugly macros abound and you might
00113   get eaten by a gru if your light fails.  */
00114 
00115 
00116 #ifdef ARIA_STATIC
00117 
00118 #define ARDEF_MODULE(mod)
00119 
00120 #else
00121 
00122 #ifdef WIN32
00123 
00124 #define ARDEF_MODULE(mod) \
00125 extern "C" {\
00126 ArModule *__AriaModule__=&mod; \
00127 _declspec(dllexport) bool \
00128 ariaInitModule(ArRobot *robot, void *argument = NULL) \
00129 { \
00130   if (__AriaModule__) \
00131   { \
00132     __AriaModule__->setRobot(robot); \
00133     return(__AriaModule__->init(robot, argument)); \
00134   } \
00135   else \
00136     return(false); \
00137 } \
00138 _declspec(dllexport) bool ariaExitModule() \
00139 { \
00140   if (__AriaModule__) \
00141     return(__AriaModule__->exit()); \
00142   return(false); \
00143 } \
00144 }
00145 #else // WIN32
00146 
00147 #define ARDEF_MODULE(mod) \
00148 ArModule *__AriaModule__=&mod; \
00149 extern "C" {\
00150 bool ariaInitModule(ArRobot *robot, void *argument = NULL) \
00151 { \
00152   if (__AriaModule__) \
00153   { \
00154     __AriaModule__->setRobot(robot); \
00155     return(__AriaModule__->init(robot, argument)); \
00156   } \
00157   else \
00158     return(false); \
00159 } \
00160 bool ariaExitModule() \
00161 { \
00162   if (__AriaModule__) \
00163     return(__AriaModule__->exit()); \
00164   return(false); \
00165 } \
00166 }
00167 
00168 #endif // WIN32
00169 
00170 #endif // ARIA_STATIC
00171 
00172 
00173 #endif // ARMODULE_H

Generated on Tue Feb 20 10:51:40 2007 for Aria by  doxygen 1.4.0