ALModule API

Overview | API

Namespace : AL

#include <alcommon/almodule.h>

Bound Methods - Task Management

bool ALModule::isRunning(const int& id)

Determines if the method created with a ‘post’ is still running.

Parameters:
  • id – The id of the method that was returned by ‘post’
Returns:

true if the method is still running, false otherwise

bool ALModule::wait(const int& id, const int& timeout)

Waits until the end of a long running method using the ID that was returned from a method started with ‘post’

Parameters:
  • id – The id of the method that was returned by ‘post’
  • timeout – The wait timeout period in ms. If 0 wait indefinately.
Returns:

true if the timeout period expired, false otherwise

void ALModule::stop(const int& id)

Stops a module’s method using the ID given returned by a ‘post’ call. Module authors are encouraged to implement this if they have long running methods that they wish to allow users to interrupt.

Parameters:
  • id – The id of the method that was returned by ‘post’

Bound Methods - Introspection

std::string ALModule::getBrokerName()

Gets the name of the parent broker

Returns:The name of the parent broker
std::vector<std::string> ALModule::getMethodList()

Retrieves the module’s method list

Returns:A vector of method names
AL::ALValue ALModule::getMethodHelp(const std::string& methodName)

Retrieves a method’s description

Parameters:
  • methodName – The name of the method
Returns:

A structure containing the method’s description

[
  std::string methodName,
  [ parameter, ...],
  std::string returnName,
  std::string returnDescription
]

Where parameter is

[
  std::string parameterName,
  std::string parameterDescription
]
AL::ALValue ALModule::getModuleHelp()

Retrieves a structure containing the module’s description:

Returns:A structure describing the module
[
  std::string moduleDescription,
  [ moduleExample, ...]
]

Where moduleExample is

[
  std::string language,
  std::string example
]
std::string ALModule::getUsage(const std::string& methodName)

Gets the method usage string. This summarises how to use the method.

Parameters:
  • methodName – The name of the method
Returns:

A string that summarises the usage of the method

bool ALModule::ping()

Just a ping to test connectivity. Always returns true

Returns:returns true
std::string ALModule::version()

Returns the version of the module

Returns:The version as a string