Example demonstrating how to load an ArModuleThis is a simple program that loads the module moduleExample_Mod, which is defined in moduleExample_Mod.cpp. The program simply calls ArModuleLoader::load() with a short message argument and ArModuleLoader::reload with no argument and finally calls ArModuleLoader::close(). The return status of the load(), reload(), and close() are checked and printed out. ArModuleLoader uses the name of the module file without the platform-specific suffix (i.e. ".dll" on Windows and ".so" on Linux) to load the module.
- See also
- moduleExample_Mod.cpp.
-
ArModuleLoader in the reference manual.
#include "Aria.h"
{
else
}
int main(int argc, char **argv)
{
if (!simpleConnector.connectRobot(&robot))
{
printf("Could not connect to robot... exiting\n");
}
std::string str;
ArLog::log(
ArLog::Terse,
"moduleExample: Loading the module \"moduleExample_Mod\" with a string argument...");
printStatus(status);
return(0);
}
Module already loaded.
Definition: ArModuleLoader.h:57
static Status load(const char *modName, ArRobot *robot, void *modArgument=NULL, bool quiet=false)
Load an ArModule.
Definition: ArModuleLoader.cpp:99
Use terse logging.
Definition: ArLog.h:61
Legacy connector for robot and laser.
Definition: ArSimpleConnector.h:51
static void exit(int exitCode=0)
Shutdown all Aria processes/threads, call exit callbacks, and exit the program.
Definition: Aria.cpp:367
static void log(LogLevel level, const char *str,...)
Log a message, with formatting and variable number of arguments.
Definition: ArLog.cpp:93
Invalid module file format.
Definition: ArModuleLoader.h:59
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 sign...
Definition: Aria.cpp:128
Central class for communicating with and operating the robot.
Definition: ArRobot.h:82
Parse and store program command-line arguments for use by other ARIA classes.
Definition: ArArgumentParser.h:64
Could not find or open the module.
Definition: ArModuleLoader.h:58
void runAsync(bool stopRunIfNotConnected, bool runNonThreadedPacketReader=false)
Starts the instance to do processing in its own new thread.
Definition: ArRobot.cpp:301
static void sleep(unsigned int ms)
Sleep for the given number of milliseconds.
Definition: ariaUtil.cpp:151
Load succeded.
Definition: ArModuleLoader.h:56
The module was not found.
Definition: ArModuleLoader.h:62
The module failed its exit stage.
Definition: ArModuleLoader.h:61
Status
Definition: ArModuleLoader.h:55
The module failed its init stage.
Definition: ArModuleLoader.h:60