00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
00113
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