libalcommon
2.5.7.1
|
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. More... | |
typedef boost::weak_ptr< ALBroker > | WeakPtr |
Weak pointer to ALBroker. More... | |
Public Member Functions | |
boost::shared_ptr< ALBroker > | getThis () |
Getter to this. More... | |
boost::shared_ptr< const ALBroker > | getThis () const |
Getter to this. More... | |
ALBroker () | |
Default Constructor. More... | |
virtual | ~ALBroker (void) |
Destructor. More... | |
void | setBrokerManagerInstance (boost::shared_ptr< ALBrokerManager > pBrokerManager) |
Sets the brokerManager instance. More... | |
boost::shared_ptr< ALModuleCore > | getModuleByName (const std::string &pModuleName) |
Another way to get module by name. More... | |
int | unregisterModule (const std::string &pModuleName) |
Called when a module, belonging to this broker, quits. More... | |
bool | isModulePresent (const std::string &pModuleName) |
Call to know if a module is present. More... | |
int | getModuleList (boost::shared_ptr< std::vector< ALModuleInfo > > pModuleList) |
Return the registered module list. More... | |
int | getBrokerList (std::vector< ALModuleInfo > &pBrokerList) |
Return the list of registered Brokers. More... | |
int | getGlobalModuleList (boost::shared_ptr< std::vector< ALModuleInfo > > pModuleList) |
Return the registered module list in every broker (global). More... | |
bool | isExiting () const |
Check if the application is existing. More... | |
bool | isConnected () |
Return whether the broker is connected or not. More... | |
int | shutdown () |
shutdown, close all modules and send exit command to child broker. More... | |
std::string | getName () const |
Get the name of the broker. More... | |
std::string | getIP () const |
Get the IP address of the broker. More... | |
int | getPort () const |
fBorkerPort getter. More... | |
std::string | getParentIP () const |
Return the parent IP if any. More... | |
int | getParentPort () const |
Return the parent Port if any. More... | |
boost::shared_ptr< ALProxy > | getProxy (const std::string &pProxyName, int deprecated=0) |
Get an existing proxy if it exists, create a proxy with option otherwise. More... | |
template<typename T > | |
boost::shared_ptr< T > | getSpecialisedProxy (const std::string &name=std::string()) |
qi::SessionPtr | session () |
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. More... | |
static boost::shared_ptr < ALBroker > | createBroker (const std::string &name, qi::SessionPtr session) |
Public Attributes | |
boost::weak_ptr< ALBrokerManager > | fBrokerManager |
ALBrokerPrivate * | _p |
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 73 of file albroker.h.
Shared pointer to ALBroker.
Definition at line 81 of file albroker.h.
Weak pointer to ALBroker.
Definition at line 87 of file albroker.h.
AL::ALBroker::ALBroker | ( | ) |
Default Constructor.
|
virtual |
Destructor.
|
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 |
|
static |
int AL::ALBroker::getBrokerList | ( | std::vector< ALModuleInfo > & | pBrokerList | ) |
Return the list of registered Brokers.
pBrokerList | [out] list of Broker information |
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.
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 |
std::string AL::ALBroker::getName | ( | ) | const |
Get the name of the broker.
std::string AL::ALBroker::getParentIP | ( | ) | const |
Return the parent IP if any.
int AL::ALBroker::getParentPort | ( | ) | const |
Return the parent Port if any.
int AL::ALBroker::getPort | ( | ) | const |
fBorkerPort getter.
boost::shared_ptr<ALProxy> AL::ALBroker::getProxy | ( | const std::string & | pProxyName, |
int | deprecated = 0 |
||
) |
Get an existing proxy if it exists, create a proxy with option otherwise.
pProxyName | proxy's name | |
[in] | deprecated | deprecated option for the new proxy. |
|
inline |
Definition at line 218 of file albroker.h.
boost::shared_ptr<ALBroker> AL::ALBroker::getThis | ( | ) |
Getter to this.
boost::shared_ptr<const ALBroker> AL::ALBroker::getThis | ( | ) | const |
Getter to this.
bool AL::ALBroker::isConnected | ( | ) |
Return whether the broker is connected or not.
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 |
qi::SessionPtr AL::ALBroker::session | ( | ) |
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 |
ALBrokerPrivate* AL::ALBroker::_p |
Private implementation of ALBroker.
Definition at line 309 of file albroker.h.
boost::weak_ptr<ALBrokerManager> AL::ALBroker::fBrokerManager |
for compat only, useless
Definition at line 306 of file albroker.h.