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

ariaInternal.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 ARIAINTERNAL_H
00027 #define ARIAINTERNAL_H
00028 
00029 
00030 #include "ArMutex.h"
00031 #include "ArFunctor.h"
00032 #include "ArConfig.h"
00033 
00034 #ifndef ARINTERFACE
00035 #include "ArStringInfoGroup.h"
00036 class ArRobot;
00037 class ArRobotJoyHandler;
00038 #endif // ARINTERFACE
00039 
00040 class ArKeyHandler;
00041 class ArJoyHandler;
00042 
00043 
00045 class Aria
00046 {
00047 public:
00048 
00049   typedef enum {
00050     SIGHANDLE_SINGLE, 
00051     SIGHANDLE_THREAD, 
00052     SIGHANDLE_NONE 
00053   } SigHandleMethod;
00054 
00056   AREXPORT static void init(SigHandleMethod method = SIGHANDLE_THREAD,
00057                 bool initSockets = true, 
00058                 bool sigHandleExitNotShutdown = true);
00059 
00061   AREXPORT static void uninit();
00062 
00064   AREXPORT static void addInitCallBack(ArFunctor *cb, ArListPos::Pos position);
00065 
00067   AREXPORT static void addUninitCallBack(ArFunctor *cb,
00068                      ArListPos::Pos position);
00069 
00071   AREXPORT static void shutdown();
00072 
00074   AREXPORT static void exit(int exitCode = 0);
00075 
00077   AREXPORT static bool getRunning(void);
00078 
00080   AREXPORT static void setDirectory(const char * directory);
00081 
00083   AREXPORT static const char *getDirectory(void);
00084 
00086   AREXPORT static bool parseArgs(void);
00087 
00089   AREXPORT static void logOptions(void);
00090 
00092   AREXPORT static void setKeyHandler(ArKeyHandler *keyHandler);
00093 
00095   AREXPORT static ArKeyHandler *getKeyHandler(void);
00096 
00098   AREXPORT static void setJoyHandler(ArJoyHandler *joyHandler);
00099 
00101   AREXPORT static ArJoyHandler *getJoyHandler(void);
00102 
00104   AREXPORT static void addExitCallback(ArFunctor *functor, int position = 50);
00105 
00107   AREXPORT static void exitOld(int exitCode = 0);
00108 
00110   AREXPORT static void signalHandlerCB(int sig);
00111 
00113   AREXPORT static void callExitCallbacks(void);
00114 
00116   AREXPORT static void addParseArgsCB(ArRetFunctor<bool> *functor, 
00117                       int position = 50);
00118 
00120   AREXPORT static void setParseArgLogLevel(ArLog::LogLevel level);
00121 
00123   AREXPORT static void addLogOptionsCB(ArFunctor *functor, int position = 50);
00124 
00125 #ifndef ARINTERFACE
00126 
00127   AREXPORT static void setRobotJoyHandler(ArRobotJoyHandler *robotJoyHandler);
00128 
00130   AREXPORT static ArRobotJoyHandler *getRobotJoyHandler(void);
00131 
00133   AREXPORT static ArConfig *getConfig(void);
00134 
00136   AREXPORT static ArStringInfoGroup *getInfoGroup(void);
00137 
00139   AREXPORT static void addRobot(ArRobot *robot);
00140 
00142   AREXPORT static void delRobot(ArRobot *robot);
00143 
00145   AREXPORT static ArRobot *findRobot(char *name);
00146 
00148   AREXPORT static std::list<ArRobot*> * getRobotList();
00149 #endif // ARINTERFACE
00150 protected:
00151   static bool ourInited;
00152   static ArGlobalFunctor1<int> ourSignalHandlerCB;
00153   static bool ourRunning;
00154   static ArMutex ourShuttingDownMutex;
00155   static bool ourShuttingDown;
00156   static bool ourExiting;
00157   static std::string ourDirectory;
00158   static std::list<ArFunctor*> ourInitCBs;
00159   static std::list<ArFunctor*> ourUninitCBs;
00160   static ArKeyHandler *ourKeyHandler;
00161   static ArJoyHandler *ourJoyHandler;
00162 #ifndef ARINTERFACE
00163   static std::list<ArRobot*> ourRobots;
00164   static ArRobotJoyHandler *ourRobotJoyHandler;
00165   static ArConfig ourConfig;
00166   static ArStringInfoGroup ourInfoGroup;
00167 #endif // ARINTERFACE
00168   static ArMutex ourExitCallbacksMutex;
00169   static std::multimap<int, ArFunctor *> ourExitCallbacks;
00170   static bool ourSigHandleExitNotShutdown;
00171   static std::multimap<int, ArRetFunctor<bool> *> ourParseArgCBs;
00172   static ArLog::LogLevel ourParseArgsLogLevel;
00173   static std::multimap<int, ArFunctor *> ourLogOptionsCBs;
00174 };
00175 
00176 
00177 #endif // ARIAINTERNAL_H

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