#include <ariaInternal.h>
Public Types | |
enum | SigHandleMethod { SIGHANDLE_SINGLE, SIGHANDLE_THREAD, SIGHANDLE_NONE } |
Static Public Member Functions | |
static void | addExitCallback (ArFunctor *functor, int position=50) |
Adds a functor to by called before program exit by Aria::exit(). | |
static void | addInitCallBack (ArFunctor *cb, ArListPos::Pos position) |
Adds a callback to call when Aria is initialized using init(). | |
static void | addLogOptionsCB (ArFunctor *functor, int position=50) |
Adds a callback for when we log options. | |
static void | addParseArgsCB (ArRetFunctor< bool > *functor, int position=50) |
Adds a callback for when we parse arguments. | |
static void | addRobot (ArRobot *robot) |
Add a robot to the global list of robots. | |
static void | addUninitCallBack (ArFunctor *cb, ArListPos::Pos position) |
Adds a callback to call when Aria is uninititialized using uninit(). | |
static void | callExitCallbacks (void) |
Internal, calls the exit callbacks. | |
static void | delRobot (ArRobot *robot) |
Remove a robot from the global list of robots. | |
static bool | deviceConnectionAddCreator (const char *deviceConnectionType, ArRetFunctor3< ArDeviceConnection *, const char *, const char *, const char * > *creator) |
Adds a type of deviceConnection for Aria to be able to create. | |
static ArDeviceConnection * | deviceConnectionCreate (const char *deviceConnectionType, const char *port, const char *defaultInfo, const char *prefix="Aria::deviceConnectionCreate") |
Creates a deviceConnection of the given type. | |
static const char * | deviceConnectionGetTypes (void) |
Gets a list of the possible deviceConnection types. | |
static void | exit (int exitCode=0) |
Shutdown all Aria processes/threads, call exit callbacks, and exit the program. | |
static void | exitOld (int exitCode=0) |
Force an exit of all Aria processes/threads (the old way). | |
static ArRobot * | findRobot (char *name) |
Finds a robot in the global list of robots, by name. | |
static ArConfig * | getConfig (void) |
Gets the ArConfig for this program. | |
static const char * | getDirectory (void) |
Gets the directory that ARIA resides in. | |
static ArStringInfoGroup * | getInfoGroup (void) |
Gets the ArStringInfoGroup for this program. | |
static ArJoyHandler * | getJoyHandler (void) |
Get a pointer to the joystick handler if one has been set with setJoyHandler(). | |
static ArKeyHandler * | getKeyHandler (void) |
Gets a pointer to the global key handler, if one has been set with setKeyHandler(). | |
static int | getMaxNumLasers (void) |
Gets the maximum number of lasers to use. | |
static ArRobotJoyHandler * | getRobotJoyHandler (void) |
Gets the robot joystick handler if one has been set. | |
static std::list< ArRobot * > * | getRobotList () |
Get a copy of the global robot list. | |
static bool | getRunning (void) |
Sees if Aria is still running (mostly for the thread in main). | |
static void | init (SigHandleMethod method=SIGHANDLE_THREAD, bool initSockets=true, bool sigHandleExitNotShutdown=true) |
Initialize Aria global data struture and perform OS-specific initialization, including adding OS signal handlers on Linux, initializing sockets library on Windows, etc. | |
static bool | laserAddCreator (const char *laserType, ArRetFunctor2< ArLaser *, int, const char * > *creator) |
Adds a type of laser for Aria to be able to create. | |
static ArLaser * | laserCreate (const char *laserType, int laserNumber, const char *prefix="Aria::laserCreate") |
Creates a laser of the given type. | |
static const char * | laserGetTypes (void) |
Gets a list of the possible laser types. | |
static void | logOptions (void) |
Logs all the options for the program (Calls all the callbacks added with addLogOptionsCB()). | |
static bool | parseArgs (void) |
Parses the arguments for the program (calls all the callbacks added with addParseArgsCB()). | |
static void | remExitCallback (ArFunctor *functor) |
Removes a functor to by called before program exit by Aria::exit(). | |
static void | setDirectory (const char *directory) |
Sets the directory that ARIA resides in, to override default. | |
static void | setExitCallbacksLogLevel (ArLog::LogLevel level) |
Sets the log level for the exit callbacks. | |
static void | setJoyHandler (ArJoyHandler *joyHandler) |
Sets the joystick handler, so that other classes can find it using getJoyHandler(). | |
static void | setKeyHandler (ArKeyHandler *keyHandler) |
Sets the key handler, so that other classes can find it using getKeyHandler(). | |
static void | setMaxNumLasers (int maxNumLasers) |
Sets the maximum number of lasers to use. | |
static void | setParseArgLogLevel (ArLog::LogLevel level) |
Sets the log level for the parsing function. | |
static void | setRobotJoyHandler (ArRobotJoyHandler *robotJoyHandler) |
Sets the robot joystick handler, so that other classes can find it. | |
static void | shutdown () |
Shutdown all Aria processes/threads. | |
static void | signalHandlerCB (int sig) |
Internal, the callback for the signal handling. | |
static void | uninit () |
Performs OS-specific deinitialization, used by shutdown() and exit(). | |
Static Protected Attributes | |
static ArConfig | ourConfig |
static std::map< std::string, ArRetFunctor3< ArDeviceConnection *, const char *, const char *, const char * > *, ArStrCaseCmpOp > | ourDeviceConnectionCreatorMap |
static std::string | ourDeviceConnectionTypes |
static std::string | ourDirectory = "" |
static std::multimap< int, ArFunctor * > | ourExitCallbacks |
static ArLog::LogLevel | ourExitCallbacksLogLevel = ArLog::Verbose |
static ArMutex | ourExitCallbacksMutex |
static bool | ourExiting = false |
static ArStringInfoGroup | ourInfoGroup |
static std::list< ArFunctor * > | ourInitCBs |
static bool | ourInited = false |
static ArJoyHandler * | ourJoyHandler = NULL |
static ArKeyHandler * | ourKeyHandler = NULL |
static std::map< std::string, ArRetFunctor2< ArLaser *, int, const char * > *, ArStrCaseCmpOp > | ourLaserCreatorMap |
static std::string | ourLaserTypes |
static std::multimap< int, ArFunctor * > | ourLogOptionsCBs |
static int | ourMaxNumLasers = 9 |
static std::multimap< int, ArRetFunctor< bool > * > | ourParseArgCBs |
static ArLog::LogLevel | ourParseArgsLogLevel = ArLog::Verbose |
static ArRobotJoyHandler * | ourRobotJoyHandler = NULL |
static std::list< ArRobot * > | ourRobots |
static bool | ourRunning = false |
static bool | ourShuttingDown = false |
static ArMutex | ourShuttingDownMutex |
static bool | ourSigHandleExitNotShutdown = true |
static ArGlobalFunctor1< int > | ourSignalHandlerCB |
static std::list< ArFunctor * > | ourUninitCBs |
|
|
|
Adds a functor to by called before program exit by Aria::exit(). Note, an exit callback may be called at any time; it should not block or wait on any locked mutexes or similar.
|
|
Adds a callback to call when Aria is initialized using init(). This will add a callback to the list of callbacks to call when Aria has been initialized. It can be called before anything else. |
|
Adds a callback to call when Aria is uninititialized using uninit(). This will add a callback to the list of callbacks to call right before Aria is un-initialized. It can be called before anything else. This facilitates code that in operating system signal handlers simply calls Aria::uninit() and packages that are based on Aria are unitited as well. It simplifies the entire uninit process. |
|
Adds a type of deviceConnection for Aria to be able to create. This adds a functor which can create a deviceConnection of a given type.
|
|
Creates a deviceConnection of the given type. Creates a device connection of a given type, connecting to a given port, with the given defaultInfo, logging messages with the given prefix. This is mostly for internal use by ArLaserConnector
|
|
Gets a list of the possible deviceConnection types. Gets a string that is the types of device connections that can be created separated by | characters. Mostly for internal use by ArLaserConnector. |
|
Shutdown all Aria processes/threads, call exit callbacks, and exit the program. This will call the list of Aria exit callbacks (added by addExitCallback()) and then exit with the given exit code. Note that this could be called from anywhere, mutexes may be locked when called-- the exit callbacks MUST exit and cannot wait for a lock.
|
|
Force an exit of all Aria processes/threads (the old way). This method is roughly obsolete, it simply forces all the threads to die immediately and then exits... The new method exit() is preferred. This calls cancel() on all AtThread's and ArASyncTask's. It forces each thread to exit and should only be used in the case of a thread hanging or getting stuck in an infinite loop. This works fine in Linux. In Windows it is not recommended at all that this function be called. Windows can not handle cleanly killing off a thread. See the help in the VC++ compiler on the WIN32 function TerminateThread. The biggest problem is that the state of DLL's can be destroyed.
|
|
Finds a robot in the global list of robots, by name.
|
|
Gets the ArConfig for this program. This gets the global config aria uses.
|
|
Gets the directory that ARIA resides in. This gets the directory that ARIA is located in, this is so ARIA can find param files and the like.
|
|
Gets the ArStringInfoGroup for this program. This gets the global string group aria uses. |
|
Gets the maximum number of lasers to use. Gets the maximum number of lasers to check for and use |
|
Sees if Aria is still running (mostly for the thread in main). returns true if ARIA is initialized (Aria::init() has been called) and has not been shut down by a call to Aria::shutdown() or Aria::exit() and an operating system signal has not occured (e.g. external KILL signal) |
|
Initialize Aria global data struture and perform OS-specific initialization, including adding OS signal handlers on Linux, initializing sockets library on Windows, etc. This must be called first before any other Aria functions. It initializes the thread layer and the signal handling method. For Windows it iniatializes the socket layer as well. This also sets the directory Aria is located in using ARIA environmental variable (or Aria registry key on Windows). For more about Aria's directory see getDirectory() and setDirectory(). For Linux the default signal handling method is to intercept OS signals in a dedicated "signal handling thread", which cleanly closes down the program, causes all the instances of ArRobot to stop their run loop and disconnect from their robot. The program will exit on the following signals: SIGHUP, SIGINT, SIGQUIT, and SIGTERM. For Windows, there is no signal handling. This method also adds the file /etc/Aria.args and the environment variable ARIAARGS as locations for ArArgumentParser to obtain default argument values from.
|
|
Adds a type of laser for Aria to be able to create. This adds a functor which can create a laser of a given type.
|
|
Creates a laser of the given type. Creates a laser of a given type, with the given laserNumber, and uses the logPrefix for logging what happens. This is mostly for internal use by ArLaserConnector.
|
|
Gets a list of the possible laser types. Gets a string that is the types of lasers that can be created separated by | characters. Mostly for internal use by ArLaserConnector. |
|
Logs all the options for the program (Calls all the callbacks added with addLogOptionsCB()).
|
|
Parses the arguments for the program (calls all the callbacks added with addParseArgsCB()).
|
|
Removes a functor to by called before program exit by Aria::exit(). Note, an exit callback may be called at any time; it should not * block or wait on any locked mutexes or similar. Also note that this will not actually happen if it is called while aria is exiting (ie it is walking through the list). |
|
Sets the directory that ARIA resides in, to override default. This sets the directory that ARIA is located in, so ARIA can find param files and the like. This can also be controlled by the environment variable ARIA, which this is set to (if it exists) when Aria::init is done. So for setDirectory to be effective, it must be done after the Aria::init.
|
|
Sets the maximum number of lasers to use. Sets the maximum number of lasers to check for and use, if you are going to set this you should do it after the Aria::init before you start making laser connectors or robots or robot params. |
|
Shutdown all Aria processes/threads. Use this function to clean up or uninitialize Aria, in particular, to stop background threads. This calls stop() on all ArThread's and ArASyncTask's. It will block until all ArThread's and ArASyncTask's exit. It is expected that all the tasks will obey the ArThread::myRunning variable and exit when it is false. (Note, this only stop Aria's background threads, it does not exit the program. Use exit() to do some cleanup and exit the program.)
|
|
Performs OS-specific deinitialization, used by shutdown() and exit(). This must be called last, after all other Aria functions. For both Linux and Windows, it closes all the open ArModules. For Windows it deinitializes the socket layer as well.
|