libalcommon
1.12
|
ALBroker serves methods advertised by connected modules to clients participating in the network. All executables create at least one broker in main.cpp. A broker will wait for http request, remote C++ request from PC application... More...
#include <alcommon/albroker.h>
Public Types | |
typedef boost::shared_ptr < ALBroker > | Ptr |
Shared pointer to ALBroker. | |
typedef boost::weak_ptr< ALBroker > | WeakPtr |
Weak pointer to ALBroker. | |
Public Member Functions | |
boost::shared_ptr< ALBroker > | getThis () |
Getter to this. | |
boost::shared_ptr< const ALBroker > | getThis () const |
Getter to this. | |
ALBroker () | |
Default Constructor. | |
virtual | ~ALBroker (void) |
Destructor. | |
void | setBrokerManagerInstance (boost::shared_ptr< ALBrokerManager > pBrokerManager) |
Sets the brokerManager instance. | |
boost::shared_ptr< ALModuleCore > | getModuleByName (const std::string &pModuleName) |
Another way to get module by name. | |
int | registerModule (boost::shared_ptr< ALModuleCore > pModule) |
Give to naoqi all the information a module will need to get constructed. | |
int | unregisterModule (const std::string &pModuleName) |
Called when a module, belonging to this broker, quits. | |
bool | isModulePresent (const std::string &pModuleName) |
Call to know if a module is present. | |
int | getModuleList (boost::shared_ptr< std::vector< ALModuleInfo > > pModuleList) |
Return the registered module list. | |
int | getBrokerList (std::vector< ALModuleInfo > &pBrokerList) |
Return the list of registered Brokers. | |
int | getGlobalModuleList (boost::shared_ptr< std::vector< ALModuleInfo > > pModuleList) |
Return the registered module list in every broker (global). | |
bool | isExiting () const |
Check if the application is existing. | |
int | shutdown () |
shutdown, close all modules and send exit command to child broker. | |
std::string | getName () const |
Get the name of the broker. | |
std::string | getIP () const |
Get the IP address of the broker. | |
int | getPort () const |
fBorkerPort getter. | |
boost::shared_ptr< ALProxy > | getProxy (const std::string &pProxyName, int pProxyOption=0) |
Get an existing proxy if it exists, create a proxy with option otherwise. | |
const std::string | httpGet (const std::string &pPath) |
Call for http get request on server. | |
QI_API_DEPRECATED boost::shared_ptr < ALMemoryProxy > | getMemoryProxy (void) |
deprecated | |
QI_API_DEPRECATED boost::shared_ptr< ALLedsProxy > | getLedsProxy (void) |
deprecated | |
QI_API_DEPRECATED boost::shared_ptr < ALLoggerProxy > | getLoggerProxy (void) |
deprecated | |
QI_API_DEPRECATED boost::shared_ptr < ALMotionProxy > | getMotionProxy (void) |
deprecated | |
QI_API_DEPRECATED boost::shared_ptr < ALPreferencesProxy > | getPreferencesProxy (void) |
deprecated | |
QI_API_DEPRECATED boost::shared_ptr< DCMProxy > | getDcmProxy (void) |
deprecated | |
Static Public Member Functions | |
static boost::shared_ptr < ALBroker > | createBroker (const std::string &pName, const std::string &pIP, int pPort, const std::string &pParentIP, int pParentPort, int pKeepAlive=0, std::string pPath="", bool pLoadLib=true) |
CreateBroker helps to broker creation. | |
Public Attributes | |
boost::weak_ptr< ALBrokerManager > | fBrokerManager |
ALBrokerImpl * | _private |
ALBroker serves methods advertised by connected modules to clients participating in the network. All executables create at least one broker in main.cpp. A broker will wait for http request, remote C++ request from PC application...
Brokers can be connected to each other to form a tree where each broker has parent broker until the base of the tree. Typically there is one broker for each process and any number of attached modules, each with any number of advertised methods.
Brokers transparently handle directory services so that clients need not know if the module that provides a service is in the same process, on the same machine, or on the same tcp network.
Within the same process, direct method calls are used to provide optimal speed without having to change your method signatures.
Remote communication is currently handled by SOAP
In most practical usage, you will never need to explicitly create a broker. The main NAOqi process has one, and module that is compiled as 'remote' and that uses ALToolsMain, will create a broker for you if required.
Definition at line 77 of file albroker.h.
Shared pointer to ALBroker.
Definition at line 85 of file albroker.h.
Weak pointer to ALBroker.
Definition at line 91 of file albroker.h.
static boost::shared_ptr<ALBroker> AL::ALBroker::createBroker | ( | const std::string & | pName, |
const std::string & | pIP, | ||
int | pPort, | ||
const std::string & | pParentIP, | ||
int | pParentPort, | ||
int | pKeepAlive = 0 , |
||
std::string | pPath = "" , |
||
bool | pLoadLib = true |
||
) | [static] |
CreateBroker helps to broker creation.
pName | broker name |
pIP | broker IP |
pPort | broker port |
pParentIP | parent broker IP |
pParentPort | parent broker port |
pKeepAlive | true => broker will not be destroyed if parent broker is destroyed |
pPath | deprecated, do not use, will have no effect |
pLoadLib | boolean to know if the module is loaded |
int AL::ALBroker::getBrokerList | ( | std::vector< ALModuleInfo > & | pBrokerList | ) |
Return the list of registered Brokers.
pBrokerList | [out] list of Broker information |
QI_API_DEPRECATED boost::shared_ptr<DCMProxy> AL::ALBroker::getDcmProxy | ( | void | ) |
deprecated
Get pointer to DCM. See specialized proxies in AL_DIR/modules/proxies
int AL::ALBroker::getGlobalModuleList | ( | boost::shared_ptr< std::vector< ALModuleInfo > > | pModuleList | ) |
Return the registered module list in every broker (global).
pModuleList | list of module information |
std::string AL::ALBroker::getIP | ( | ) | const |
Get the IP address of the broker.
QI_API_DEPRECATED boost::shared_ptr<ALLedsProxy> AL::ALBroker::getLedsProxy | ( | void | ) |
deprecated
Get pointer to leds. See specialized proxies in AL_DIR/modules/proxies
QI_API_DEPRECATED boost::shared_ptr<ALLoggerProxy> AL::ALBroker::getLoggerProxy | ( | void | ) |
deprecated
Get pointer to logger. See specialized proxies in AL_DIR/modules/proxies
QI_API_DEPRECATED boost::shared_ptr<ALMemoryProxy> AL::ALBroker::getMemoryProxy | ( | void | ) |
deprecated
Get pointer to memory. See specialized proxies in AL_DIR/modules/proxies
boost::shared_ptr<ALModuleCore> AL::ALBroker::getModuleByName | ( | const std::string & | pModuleName | ) |
Another way to get module by name.
pModuleName | name of the module |
int AL::ALBroker::getModuleList | ( | boost::shared_ptr< std::vector< ALModuleInfo > > | pModuleList | ) |
Return the registered module list.
pModuleList | list of module information |
QI_API_DEPRECATED boost::shared_ptr<ALMotionProxy> AL::ALBroker::getMotionProxy | ( | void | ) |
deprecated
Get pointer to motion. See specialized proxies in AL_DIR/modules/proxies
std::string AL::ALBroker::getName | ( | ) | const |
Get the name of the broker.
int AL::ALBroker::getPort | ( | ) | const |
fBorkerPort getter.
QI_API_DEPRECATED boost::shared_ptr<ALPreferencesProxy> AL::ALBroker::getPreferencesProxy | ( | void | ) |
deprecated
Get pointer to preferences. See specialized proxies in AL_DIR/modules/proxies
boost::shared_ptr<ALProxy> AL::ALBroker::getProxy | ( | const std::string & | pProxyName, |
int | pProxyOption = 0 |
||
) |
Get an existing proxy if it exists, create a proxy with option otherwise.
pProxyName | proxy's name |
pProxyOption | option for new proxy |
boost::shared_ptr<const ALBroker> AL::ALBroker::getThis | ( | ) | const |
Getter to this.
boost::shared_ptr<ALBroker> AL::ALBroker::getThis | ( | ) |
Getter to this.
const std::string AL::ALBroker::httpGet | ( | const std::string & | pPath | ) |
Call for http get request on server.
pPath | The path requested by the sender |
bool AL::ALBroker::isExiting | ( | ) | const |
Check if the application is existing.
bool AL::ALBroker::isModulePresent | ( | const std::string & | pModuleName | ) |
Call to know if a module is present.
pModuleName | name of the module to search |
int AL::ALBroker::registerModule | ( | boost::shared_ptr< ALModuleCore > | pModule | ) |
Give to naoqi all the information a module will need to get constructed.
It should be called upon module declaration.
pModule | information about the module the struct al__moduleInfo is defined with these members:
|
void AL::ALBroker::setBrokerManagerInstance | ( | boost::shared_ptr< ALBrokerManager > | pBrokerManager | ) |
Sets the brokerManager instance.
pBrokerManager | A pointer to the broker manager. |
int AL::ALBroker::shutdown | ( | ) |
shutdown, close all modules and send exit command to child broker.
int AL::ALBroker::unregisterModule | ( | const std::string & | pModuleName | ) |
Called when a module, belonging to this broker, quits.
References to the module (proxies, subscriptions to ALMemory, ...) will be deleted
pModuleName | name of the module exiting |
ALBrokerImpl* AL::ALBroker::_private |
Private implementation of ALBroker.
Definition at line 315 of file albroker.h.
boost::weak_ptr<ALBrokerManager> AL::ALBroker::fBrokerManager |
Pointer on ALBrokerManager.
Definition at line 312 of file albroker.h.