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

ariaInternal.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 ARIAINTERNAL_H
00028 #define ARIAINTERNAL_H
00029 
00030 
00031 #include "ArMutex.h"
00032 #include "ArFunctor.h"
00033 #include "ArConfig.h"
00034 
00035 class ArRobot;
00036 class ArKeyHandler;
00037 class ArJoyHandler;
00038 class ArRobotJoyHandler;
00039 
00041 class Aria
00042 {
00043 public:
00044 
00045   typedef enum {
00046     SIGHANDLE_SINGLE, 
00047     SIGHANDLE_THREAD, 
00048     SIGHANDLE_NONE 
00049   } SigHandleMethod;
00050 
00052   static void init(SigHandleMethod method = SIGHANDLE_THREAD,
00053                             bool initSockets = true, 
00054                             bool sigHandleExitNotShutdown = true);
00055 
00057   static void uninit();
00058 
00060   static void addInitCallBack(ArFunctor *cb, ArListPos::Pos position);
00061 
00063   static void addUninitCallBack(ArFunctor *cb,
00064                                          ArListPos::Pos position);
00065 
00067   static void shutdown();
00068 
00070   static void exit(int exitCode = 0);
00071 
00073   static bool getRunning(void);
00074 
00076   static void setDirectory(const char * directory);
00077 
00079   static const char *getDirectory(void);
00080 
00082   static void setKeyHandler(ArKeyHandler *keyHandler);
00083 
00085   static ArKeyHandler *getKeyHandler(void);
00086 
00088   static void setJoyHandler(ArJoyHandler *joyHandler);
00089 
00091   static ArJoyHandler *getJoyHandler(void);
00092 
00094   static void setRobotJoyHandler(ArRobotJoyHandler *robotJoyHandler);
00095 
00097   static ArRobotJoyHandler *getRobotJoyHandler(void);
00098 
00100   static ArConfig *getConfig(void);
00101 
00103   static void addRobot(ArRobot *robot);
00104 
00106   static void delRobot(ArRobot *robot);
00107 
00109   static ArRobot *findRobot(char *name);
00110 
00112   static std::list<ArRobot*> * getRobotList();
00113   
00115   static void addExitCallback(ArFunctor *functor, int position = 50);
00116 
00118   static void exitOld(int exitCode = 0);
00119 
00121   static void signalHandlerCB(int sig);
00122 
00124   static void callExitCallbacks(void);
00125 
00126 protected:
00127   static bool ourInited;
00128   static ArGlobalFunctor1<int> ourSignalHandlerCB;
00129   static bool ourRunning;
00130   static std::list<ArRobot*> ourRobots;
00131   static ArMutex ourShuttingDownMutex;
00132   static bool ourShuttingDown;
00133   static std::string ourDirectory;
00134   static std::list<ArFunctor*> ourInitCBs;
00135   static std::list<ArFunctor*> ourUninitCBs;
00136   static ArKeyHandler *ourKeyHandler;
00137   static ArJoyHandler *ourJoyHandler;
00138   static ArRobotJoyHandler *ourRobotJoyHandler;
00139   static ArConfig ourConfig;
00140   static ArMutex ourExitCallbacksMutex;
00141   static std::multimap<int, ArFunctor *> ourExitCallbacks;
00142   static bool ourSigHandleExitNotShutdown;
00143 };
00144 
00145 
00146 #endif // ARIAINTERNAL_H

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