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

ArModule.h

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

Generated on Wed Oct 19 12:56:36 2005 for Aria by  doxygen 1.4.0