Main Page   Class Hierarchy   Compound List   Compound Members  

Aria Class Reference

This class performs global initialization and deinitialization. More...

#include <ariaInternal.h>

List of all members.

Public Types

enum  SigHandleMethod { SIGHANDLE_SINGLE, SIGHANDLE_THREAD, SIGHANDLE_NONE }

Static Public Methods

void init (SigHandleMethod method=SIGHANDLE_SINGLE, bool initSockets=true)
 Performs OS-specific initialization. More...

void uninit ()
 Performs OS-specific deinitialization. More...

void addInitCallBack (ArFunctor *cb, ArListPos::Pos position)
 Adds a callback to call when Aria is inited. More...

void addUninitCallBack (ArFunctor *cb, ArListPos::Pos position)
 Adds a callback to call when Aria is uninited. More...

void shutdown ()
 Shutdown all Aria processes/threads. More...

void exit ()
 Force an exit of all Aria processes/threads. More...

void addRobot (ArRobot *robot)
 Add a robot to the global list of robots.

void delRobot (ArRobot *robot)
 Remove a robot from the global list of robots.

ArRobotfindRobot (char *name)
 Finds a robot in the global list of robots, by name. More...

std::list< ArRobot *> * getRobotList ()
 Get a copy of the global robot list.

void setDirectory (const char *directory)
 Sets the directory that ARIA resides in. More...

std::string getDirectory (void)
 Gets the directory that ARIA resides in. More...

void setKeyHandler (ArKeyHandler *keyHandler)
 Sets the key handler, so that other classes can find it.

ArKeyHandlergetKeyHandler (void)
 Gets the key handler if one has been set.

void signalHandlerCB (int sig)
 Internal, the callback for the signal handling.


Detailed Description

This class performs global initialization and deinitialization.


Member Enumeration Documentation

enum Aria::SigHandleMethod
 

Enumeration values:
SIGHANDLE_SINGLE  Setup signal handlers in a global, non-thread way.
SIGHANDLE_THREAD  Setup a dedicated signal handling thread.
SIGHANDLE_NONE  Do no signal handling.


Member Function Documentation

void Aria::addInitCallBack ArFunctor   cb,
ArListPos::Pos    position
[static]
 

Adds a callback to call when Aria is inited.

This will add a callback to the list of callbacks to call when Aria has been initialized. It can be called before anything else.

void Aria::addUninitCallBack ArFunctor   cb,
ArListPos::Pos    position
[static]
 

Adds a callback to call when Aria is uninited.

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.

void Aria::exit   [static]
 

Force an exit of all Aria processes/threads.

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.

ArRobot * Aria::findRobot char *    name [static]
 

Finds a robot in the global list of robots, by name.

Parameters:
name  the name of the robot you want to find
Returns:
NULL if there is no robot of that name, otherwise the robot with that name

std::string Aria::getDirectory void    [static]
 

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.

Returns:
the directory ARIA is located in
See also:
setDirectory

void Aria::init SigHandleMethod    method = SIGHANDLE_SINGLE,
bool    initSockets = true
[static]
 

Performs OS-specific initialization.

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 from the ARIA environmental variable, for a description of this see getDirectory and setDirectory.

For Linux the default signal handling method is to cleanly close down the program, cause 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.

Parameters:
method  the method in which to handle signals. Defaulted to SIGHANDLE_SINGLE.
initSockets  specify whether or not to initialize the socket layer. This is only meaningfull for Windows. Defaulted to true.
See also:
ArSignalHandler , ArSocket

void Aria::setDirectory const char *    directory [static]
 

Sets the directory that ARIA resides in.

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.

Parameters:
directory  the directory Aria is located in
See also:
getDirectory

void Aria::shutdown   [static]
 

Shutdown all Aria processes/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.

void Aria::uninit   [static]
 

Performs OS-specific deinitialization.

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.


The documentation for this class was generated from the following files:
Generated on Tue Nov 12 17:43:57 2002 for Aria by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001