Main Page   Class Hierarchy   Compound List   Compound Members  

ArModuleLoader Class Reference

Dynamic ArModule loader. More...

#include <ArModuleLoader.h>

List of all members.

Public Types

enum  Status {
  STATUS_SUCCESS = 0, STATUS_ALREADY_LOADED, STATUS_FAILED_OPEN, STATUS_INVALID,
  STATUS_INIT_FAILED, STATUS_EXIT_FAILED, STATUS_NOT_FOUND
}

Static Public Methods

Status load (const char *modName, ArRobot *robot, void *modArgument=NULL, bool quiet=false)
 Load an ArModule. More...

Status reload (const char *modName, ArRobot *robot, void *modArgument=NULL, bool quiet=false)
 Close and then reload an ArModule. More...

Status close (const char *modName, bool quiet=false)
 Close an ArModule. More...

void closeAll ()
 Close all open ArModule.


Detailed Description

Dynamic ArModule loader.

The ArModuleLoader is used to load ArModules into a program and invoke them.

See also ArModule to see how to define an ArModule.

See also the example programs simpleMod.cpp and simpleModule.cpp. For a more complete example, see the example programs joydriveActionMod.cpp and joydriveActionModule.cpp.


Member Enumeration Documentation

enum ArModuleLoader::Status
 

Enumeration values:
STATUS_SUCCESS  Load succeded.
STATUS_ALREADY_LOADED  Module already loaded.
STATUS_FAILED_OPEN  Could not find or open the module.
STATUS_INVALID  Invalid module file format.
STATUS_INIT_FAILED  The module failed its init stage.
STATUS_EXIT_FAILED  The module failed its exit stage.
STATUS_NOT_FOUND  The module was not found.


Member Function Documentation

ArModuleLoader::Status ArModuleLoader::close const char *    modName,
bool    quiet = false
[static]
 

Close an ArModule.

Calls ArModule::exit() on the module, then closes the library.

Parameters:
modName  filename of the module without the extension (.dll or .so)
quiet  whether to print out a message if this fails or not, defaults to false

ArModuleLoader::Status ArModuleLoader::load const char *    modName,
ArRobot   robot,
void *    modArgument = NULL,
bool    quiet = false
[static]
 

Load an ArModule.

THIS ONLY LOADS one init on the module right now, if its called again it'll load the same init over. I'll fix it later... read the more verbose description in ArModule.h.

Takes a string name of the module which is just the file name of the module without the extension (.dll or .so). It will figure out the correct extension based on wheter its a Linux or Windows build. It will also uses the standard operating systems ability to find the library. So the library must be located within the PATH variable for Windows and the LD_LIBRARY_PATH for Linux. You can also just give the absolute path to the library, or the relative path from the directory the program was started in (ie ./simpleMod). The ArModule will be passed the ArRobot reference that load() takes. This is the ArRobot that the ArModule will use for its processing.

Parameters:
modName  filename of the module without the extension (.dll or .so)
robot  ArRobot reference which the module is to use, this can be NULL
modArgument  A void pointer argument to pass to the module, if its a const value you'll need to cast it to a non-const value to get it to work (for example if you were using a constant string). This value defaults to NULL.
quiet  whether to print out a message if this fails or not, defaults to false

ArModuleLoader::Status ArModuleLoader::reload const char *    modName,
ArRobot   robot,
void *    modArgument = NULL,
bool    quiet = false
[static]
 

Close and then reload an ArModule.

reload() is similiar to load(), except that it will call close() on the module and then call load().

Parameters:
modName  filename of the module without the extension (.dll or .so)


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