cisst-saw
|
#include <mtsManagerGlobal.h>
Classes | |
struct | CleanupElementType |
struct | InterfaceMapType |
Public Member Functions | |
mtsManagerGlobal () | |
~mtsManagerGlobal () | |
void | SetMCS (mtsManagerComponentServer *mcs) |
bool | AddProcess (const std::string &processName) |
Register process. More... | |
bool | AddProcessObject (mtsManagerLocalInterface *localManagerObject, const bool isManagerProxyServer=false) |
bool | FindProcess (const std::string &processName) const |
Find process. More... | |
bool | RemoveProcess (const std::string &processName, const bool networkDisconnect=false) |
Remove process. More... | |
bool | AddComponent (const std::string &processName, const std::string &componentName) |
Register component. More... | |
bool | FindComponent (const std::string &processName, const std::string &componentName) const |
Find component using process name and component name. More... | |
bool | RemoveComponent (const std::string &processName, const std::string &componentName, const bool lock=true) |
Remove component. More... | |
bool | AddInterfaceProvidedOrOutput (const std::string &processName, const std::string &componentName, const std::string &interfaceName) |
Register provided interface. Can be called at run-time. More... | |
bool | AddInterfaceRequiredOrInput (const std::string &processName, const std::string &componentName, const std::string &interfaceName) |
Register required interface. Can be called at run-time. More... | |
bool | FindInterfaceProvidedOrOutput (const std::string &processName, const std::string &componentName, const std::string &interfaceName) const |
Find provided interface using process name, component name, and interface name. More... | |
bool | FindInterfaceRequiredOrInput (const std::string &processName, const std::string &componentName, const std::string &interfaceName) const |
Find required interface using process name, component name, and interface name. More... | |
bool | RemoveInterfaceProvidedOrOutput (const std::string &processName, const std::string &componentName, const std::string &interfaceName, const bool lock=true) |
Remove provided interface. Can be called at run-time. More... | |
bool | RemoveInterfaceRequiredOrInput (const std::string &processName, const std::string &componentName, const std::string &interfaceName, const bool lock=true) |
Remove required interface. Can be called at run-time. More... | |
ConnectionIDType | Connect (const std::string &requestProcessName, const std::string &clientProcessName, const std::string &clientComponentName, const std::string &clientInterfaceName, const std::string &serverProcessName, const std::string &serverComponentName, const std::string &serverInterfaceName) |
Connect two interfaces. More... | |
bool | ConnectConfirm (const ConnectionIDType connectionID) |
Confirm that connection has been successfully established. More... | |
bool | Disconnect (const ConnectionIDType connectionID) |
Disconnect two interfaces. More... | |
bool | Disconnect (const mtsDescriptionConnection &connection) |
bool | Disconnect (const std::string &clientProcessName, const std::string &clientComponentName, const std::string &clientInterfaceName, const std::string &serverProcessName, const std::string &serverComponentName, const std::string &serverInterfaceName) |
Disconnect two interfaces. More... | |
bool | InitiateConnect (const ConnectionIDType connectionID) |
Initiate connection process. More... | |
bool | ConnectServerSideInterfaceRequest (const ConnectionIDType connectionID) |
Request the global component manager to connect interfaces at server side. More... | |
void | GetListOfConnections (std::vector< mtsDescriptionConnection > &list) const |
std::vector< std::string > | GetIPAddress (void) const |
void | GetIPAddress (std::vector< std::string > &ipAddresses) const |
void | GetNamesOfProcesses (std::vector< std::string > &namesOfProcesses) const |
void | GetNamesOfComponents (const std::string &processName, std::vector< std::string > &namesOfComponents) const |
void | GetNamesOfInterfacesProvidedOrOutput (const std::string &processName, const std::string &componentName, std::vector< std::string > &namesOfInterfacesProvided) const |
void | GetNamesOfInterfacesRequiredOrInput (const std::string &processName, const std::string &componentName, std::vector< std::string > &namesOfInterfacesRequired) const |
void | GetNamesOfCommands (const std::string &processName, const std::string &componentName, const std::string &providedInterfaceName, std::vector< std::string > &namesOfCommands) const |
void | GetNamesOfEventGenerators (const std::string &processName, const std::string &componentName, const std::string &providedInterfaceName, std::vector< std::string > &namesOfEventGenerators) const |
void | GetNamesOfFunctions (const std::string &processName, const std::string &componentName, const std::string &requiredInterfaceName, std::vector< std::string > &namesOfFunctions) const |
void | GetNamesOfEventHandlers (const std::string &processName, const std::string &componentName, const std::string &requiredInterfaceName, std::vector< std::string > &namesOfEventHandlers) const |
void | GetDescriptionOfCommand (const std::string &processName, const std::string &componentName, const std::string &providedInterfaceName, const std::string &commandName, std::string &description) const |
void | GetDescriptionOfEventGenerator (const std::string &processName, const std::string &componentName, const std::string &providedInterfaceName, const std::string &eventGeneratorName, std::string &description) const |
void | GetDescriptionOfFunction (const std::string &processName, const std::string &componentName, const std::string &requiredInterfaceName, const std::string &functionName, std::string &description) const |
void | GetDescriptionOfEventHandler (const std::string &processName, const std::string &componentName, const std::string &requiredInterfaceName, const std::string &eventHandlerName, std::string &description) const |
mtsManagerLocalInterface * | GetProcessObject (const std::string &processName) const |
bool | StartServer (void) |
bool | StopServer (void) |
bool | SetInterfaceProvidedProxyAccessInfo (const ConnectionIDType connectionID, const std::string &endpointInfo) |
bool | GetInterfaceProvidedProxyAccessInfo (const ConnectionIDType connectionID, std::string &endpointInfo) |
bool | GetInterfaceProvidedProxyAccessInfo (const std::string &clientProcessName, const std::string &serverProcessName, const std::string &serverComponentName, const std::string &serverInterfaceName, std::string &endpointInfo) |
Get access information of the provided interface proxy. More... | |
void | CheckConnectConfirmTimeout (void) |
![]() | |
virtual | ~cmnGenericObject (void) |
virtual const cmnClassServicesBase * | Services (void) const =0 |
bool | ReconstructFrom (const cmnGenericObject &other) |
std::string | ToString (void) const |
virtual void | ToStream (std::ostream &outputStream) const |
virtual void | ToStreamRaw (std::ostream &outputStream, const char delimiter= ' ', bool headerOnly=false, const std::string &headerPrefix="") const |
virtual bool | FromStreamRaw (std::istream &inputStream, const char delimiter= ' ') |
virtual void | SerializeRaw (std::ostream &outputStream) const |
virtual void | DeSerializeRaw (std::istream &inputStream) |
virtual cmnLogger::StreamBufType * | GetLogMultiplexer (void) const |
virtual size_t | ScalarNumber (void) const |
virtual bool | ScalarNumberIsFixed (void) const |
virtual double | Scalar (const size_t CMN_UNUSED(index)) const throw (std::out_of_range) |
virtual std::string | ScalarDescription (const size_t CMN_UNUSED(index), const std::string &CMN_UNUSED(userDescription)) const |
Static Public Member Functions | |
static std::string | GetName (void) |
static bool | IsProxyComponent (const std::string &componentName) |
static const std::string | GetComponentProxyName (const std::string &processName, const std::string &componentName) |
static const std::string | GetInterfaceUID (const std::string &processName, const std::string &componentName, const std::string &interfaceName) |
Protected Types | |
typedef std::vector < ConnectionIDType > | ConnectionIDListType |
typedef cmnNamedMap < ConnectionIDListType > | InterfaceMapElementType |
typedef cmnNamedMap < InterfaceMapType > | ComponentMapType |
typedef cmnNamedMap < ComponentMapType > | ProcessMapType |
typedef std::map < ConnectionIDType, mtsConnection > | ConnectionMapType |
typedef std::map < ConnectionIDType, ConnectionIDType > | DisconnectQueueType |
typedef struct mtsManagerGlobal::CleanupElementType | CleanupElementType |
typedef std::list < CleanupElementType > | CleanupElementListType |
typedef cmnNamedMap < CleanupElementListType > | DisconnectedProcessCleanupMapType |
Protected Member Functions | |
void * | ThreadDisconnectProcess (void *arg) |
void | ShowInternalStructure (void) |
void | Cleanup (void) |
ConnectionIDListType * | GetConnectionsOfInterfaceProvidedOrOutput (const std::string &serverProcessName, const std::string &serverComponentName, const std::string &interfaceName) const |
ConnectionIDListType * | GetConnectionsOfInterfaceProvidedOrOutput (const std::string &serverProcessName, const std::string &serverComponentName, const std::string &interfaceName, InterfaceMapType **interfaceMap) const |
ConnectionIDListType * | GetConnectionsOfInterfaceRequiredOrInput (const std::string &clientProcessName, const std::string &clientComponentName, const std::string &interfaceName) const |
ConnectionIDListType * | GetConnectionsOfInterfaceRequiredOrInput (const std::string &clientProcessName, const std::string &clientComponentName, const std::string &interfaceName, InterfaceMapType **interfaceMap) const |
bool | AddConnectionToInterfaceProvidedOrOutput (const std::string &serverProcessName, const std::string &serverComponentName, const std::string &interfaceName, const ConnectionIDType connectionID) |
bool | AddConnectionToInterfaceRequiredOrInput (const std::string &clientProcessName, const std::string &clientComponentName, const std::string &interfaceName, const ConnectionIDType connectionID) |
bool | RemoveConnectionOfInterfaceProvidedOrOutput (const std::string &serverProcessName, const std::string &serverComponentName, const std::string &interfaceName, const ConnectionIDType connectionID) |
bool | RemoveConnectionOfInterfaceRequiredOrInput (const std::string &clientProcessName, const std::string &clientComponentName, const std::string &interfaceName, const ConnectionIDType connectionID) |
bool | CleanupDisconnectedProcess (const std::string &nameOfProcessDisconnected) |
bool | IsAlreadyConnected (const mtsDescriptionConnection &description) const |
int | GetNumberOfInterfaces (const std::string &processName, const std::string &componentName, const bool includeInternalInterface=true) const |
ConnectionIDType | GetConnectionID (const std::string &clientProcessName, const std::string &clientComponentName, const std::string &interfaceName) const |
mtsConnection * | GetConnectionInformation (const ConnectionIDType connectionID) |
void | DisconnectInternal (void) |
void | AddToDisconnectedProcessCleanup (const std::string &sourceProcessName, const std::string &targetProcessName, const std::string &targetComponentProxyName) |
Friends | |
class | mtsManagerGlobalTest |
class | mtsManagerLocalTest |
|
protected |
|
protected |
To clean up disconnected process
|
protected |
Component map: a map of registered components in a process key=(component name), value=(interface map) value can be null if a component does not have any interface.
|
protected |
Typedef for connection map: key=(connected interface name), value=(list of connection ids) map name=(name of component that owns these interfaces.
|
protected |
Connection element map: a map of strings that defines a connection key=(connection id), value=(an instance of Connection) When a local component manager requests estbalishing a connection, an element is created and added. If a connection is not established before timeout, the element is removed. When a local component manager notifies that a connection is successfully established, the element is marked as connected.
|
protected |
|
protected |
Queues, mutexes, and internal thread for thread-safe disconnection
|
protected |
Typedef for interface map element: key=(interface name), value=(connection id list type)
|
protected |
Process map: a map of registered processes (i.e., local component managers) key=(process name), value=(component map) value can be null if a process does not have any component.
mtsManagerGlobal::mtsManagerGlobal | ( | ) |
Constructor and destructor
mtsManagerGlobal::~mtsManagerGlobal | ( | ) |
|
virtual |
Register component.
processName | Name of process |
componentName | Name of component |
Implements mtsManagerGlobalInterface.
|
protected |
Add new connection id to specified interface
|
protected |
|
virtual |
Register provided interface. Can be called at run-time.
processName | Name of process |
componentName | Name of component |
interfaceName | Name of provided interface to be added |
Implements mtsManagerGlobalInterface.
|
virtual |
Register required interface. Can be called at run-time.
processName | Name of process |
componentName | Name of component |
interfaceName | Name of required interface to be added |
Implements mtsManagerGlobalInterface.
|
virtual |
bool mtsManagerGlobal::AddProcessObject | ( | mtsManagerLocalInterface * | localManagerObject, |
const bool | isManagerProxyServer = false |
||
) |
|
protected |
Maintains information to clean up disconnected processes
void mtsManagerGlobal::CheckConnectConfirmTimeout | ( | void | ) |
Check if there is any pending connection. All new connections should be confirmed by the LCM within timeout after the GCM issues a new connection id. Otherwise, the GCM actively disconnects the pending connection.
|
protected |
Reset internal data structures
|
protected |
Remove component proxies and internal interfaces (InterfaceComponentRequiredForXXX) that were created because of the disconnected process
|
virtual |
Connect two interfaces.
requestProcessName | Name of process that requests this connection |
clientProcessName | Name of client process |
clientComponentName | Name of client component |
clientInterfaceRequiredName | Name of client's required interface |
serverProcessName | Name of server process |
serverComponentName | Name of server component |
serverInterfaceProvidedName | Name of server's provided interface |
Implements mtsManagerGlobalInterface.
|
virtual |
Confirm that connection has been successfully established.
connectionID | Connection id |
Implements mtsManagerGlobalInterface.
|
virtual |
Request the global component manager to connect interfaces at server side.
connectionID | Connection id issued by GCM |
Implements mtsManagerGlobalInterface.
|
virtual |
Disconnect two interfaces.
connectionID | Connection id |
Implements mtsManagerGlobalInterface.
bool mtsManagerGlobal::Disconnect | ( | const mtsDescriptionConnection & | connection | ) |
|
virtual |
Disconnect two interfaces.
clientProcessName | Name of client process |
clientComponentName | Name of client component |
clientInterfaceRequiredName | Name of required interface |
serverProcessName | Name of server process |
serverComponentName | Name of server component |
serverInterfaceProvidedName | Name of provided interface |
Implements mtsManagerGlobalInterface.
|
protected |
Process disconnect waiting queue. This is periodically called by the internal processing thread. The connection id that is disconnected is dequeued from disconnect waiting queue and enqueued to disconnected queue.
|
virtual |
Find component using process name and component name.
processName | Name of process |
componentName | Name of component |
Implements mtsManagerGlobalInterface.
|
virtual |
Find provided interface using process name, component name, and interface name.
processName | Name of process |
componentName | Name of component |
interfaceName | Name of provided interface |
Implements mtsManagerGlobalInterface.
|
virtual |
Find required interface using process name, component name, and interface name.
processName | Name of process |
componentName | Name of component |
interfaceName | Name of required interface |
Implements mtsManagerGlobalInterface.
|
virtual |
|
static |
Generate unique name of a proxy component
|
protected |
Get connection id that the required interface specified involves in
|
protected |
Get connection information using connection id
|
protected |
Get connection information about provided interface specified
|
protected |
|
protected |
Get connection information about required interface specified
|
protected |
void mtsManagerGlobal::GetDescriptionOfCommand | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | providedInterfaceName, | ||
const std::string & | commandName, | ||
std::string & | description | ||
) | const |
Get description of a command in a provided interface
void mtsManagerGlobal::GetDescriptionOfEventGenerator | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | providedInterfaceName, | ||
const std::string & | eventGeneratorName, | ||
std::string & | description | ||
) | const |
Get description of an event generator in a provided interface
void mtsManagerGlobal::GetDescriptionOfEventHandler | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | requiredInterfaceName, | ||
const std::string & | eventHandlerName, | ||
std::string & | description | ||
) | const |
Get description of a function in a required interface
void mtsManagerGlobal::GetDescriptionOfFunction | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | requiredInterfaceName, | ||
const std::string & | functionName, | ||
std::string & | description | ||
) | const |
Get description of a function in a required interface
|
virtual |
Get access information of interface proxy server
Implements mtsManagerGlobalInterface.
|
virtual |
Get access information of the provided interface proxy.
clientProcessName | Name of client process |
serverProcessName | Name of server process |
serverComponentName | Name of server component |
serverInterfaceProvidedName | Name of server provided interface |
endpointInfo | access information of provided interface proxy |
Implements mtsManagerGlobalInterface.
|
static |
Generate unique representation of interface as string
std::vector<std::string> mtsManagerGlobal::GetIPAddress | ( | void | ) | const |
Return IP address of this machine.
void mtsManagerGlobal::GetIPAddress | ( | std::vector< std::string > & | ipAddresses | ) | const |
|
virtual |
Get a list of all active connections represented by a set of strings
Implements mtsManagerGlobalInterface.
|
inlinestatic |
Return the name of the global component manager (for mtsProxyBaseCommon.h)
void mtsManagerGlobal::GetNamesOfCommands | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | providedInterfaceName, | ||
std::vector< std::string > & | namesOfCommands | ||
) | const |
Get names of all commands in a provided interface
void mtsManagerGlobal::GetNamesOfComponents | ( | const std::string & | processName, |
std::vector< std::string > & | namesOfComponents | ||
) | const |
Get names of all components in a process
void mtsManagerGlobal::GetNamesOfEventGenerators | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | providedInterfaceName, | ||
std::vector< std::string > & | namesOfEventGenerators | ||
) | const |
Get names of all event generators in a provided interface
void mtsManagerGlobal::GetNamesOfEventHandlers | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | requiredInterfaceName, | ||
std::vector< std::string > & | namesOfEventHandlers | ||
) | const |
Get names of all event handlers in a required interface
void mtsManagerGlobal::GetNamesOfFunctions | ( | const std::string & | processName, |
const std::string & | componentName, | ||
const std::string & | requiredInterfaceName, | ||
std::vector< std::string > & | namesOfFunctions | ||
) | const |
Get names of all functions in a required interface
void mtsManagerGlobal::GetNamesOfInterfacesProvidedOrOutput | ( | const std::string & | processName, |
const std::string & | componentName, | ||
std::vector< std::string > & | namesOfInterfacesProvided | ||
) | const |
Get names of all provided interfaces in a component
void mtsManagerGlobal::GetNamesOfInterfacesRequiredOrInput | ( | const std::string & | processName, |
const std::string & | componentName, | ||
std::vector< std::string > & | namesOfInterfacesRequired | ||
) | const |
Get names of all required interfaces in a component
void mtsManagerGlobal::GetNamesOfProcesses | ( | std::vector< std::string > & | namesOfProcesses | ) | const |
Get names of all processes
|
protected |
Get total number of interfaces a component manages
mtsManagerLocalInterface* mtsManagerGlobal::GetProcessObject | ( | const std::string & | processName | ) | const |
Get a process object (local component manager object)
|
virtual |
Initiate connection process.
connectionID | Connection id issued by GCM's Connect(). |
Implements mtsManagerGlobalInterface.
|
protected |
Check if two interfaces are connected
|
static |
Check if component is proxy based on its name
|
virtual |
Remove component.
processName | Name of process |
componentName | Name of component |
Implements mtsManagerGlobalInterface.
|
protected |
Remove connection id from specified interface
|
protected |
|
virtual |
Remove provided interface. Can be called at run-time.
processName | Name of process |
componentName | Name of component |
interfaceName | Name of provided interface to be removed |
Implements mtsManagerGlobalInterface.
|
virtual |
Remove required interface. Can be called at run-time.
processName | Name of process |
componentName | Name of component |
interfaceName | Name of required interface to be removed |
Implements mtsManagerGlobalInterface.
|
virtual |
|
virtual |
Set access information of interface proxy server
Implements mtsManagerGlobalInterface.
|
inline |
|
protected |
Prints out ProcessMap in human readable format
bool mtsManagerGlobal::StartServer | ( | void | ) |
Start network proxy server. The server's listening port number is fetched from config.server file (default port: 10705)
bool mtsManagerGlobal::StopServer | ( | void | ) |
Stop network proxy server
|
protected |
|
friend |
|
friend |
|
protected |
|
protected |
Counter to issue a new connection ID
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Instance of connected local component manager. Note that the global component manager communicates with the only one instance of mtsManagerLocalInterface regardless of connection type (standalone or network mode)
MJ: (8/20/10) To support a local connection between the global component manager and a local component manager on the same process, this assumption is slightly modified such that the GCM can have two different types of connection with LCM – local and remote. When the GCM executes commands, it checks if it has a local connection to the LCM on the same process and, if yes, it sends the command to the local LCM. If not, it delivers the command to a remote LCM same as before.
|
protected |
|
protected |
For dynamic component composition feature
|
protected |
|
protected |
Mutex for thread-safe processing
|
protected |
Network proxy server
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |