#include <CorbaPort.h>
Inheritance diagram for RTC::CorbaPort:
Public Member Functions | |
CorbaPort (const char *name) | |
Constructor. | |
virtual | ~CorbaPort () |
Destructor. | |
bool | registerProvider (const char *instance_name, const char *type_name, PortableServer::RefCountServantBase &provider) |
Register provider. | |
bool | registerConsumer (const char *instance_name, const char *type_name, CorbaConsumerBase &consumer) |
Register consumer. | |
virtual PortProfile * | get_port_profile () |
[CORBA interface] Get the PortProfile of the Port | |
const PortProfile & | getPortProfile () const |
virtual ConnectorProfileList * | get_connector_profiles () |
[CORBA interface] Get the ConnectorProfileList of the Port | |
virtual ConnectorProfile * | get_connector_profile (const char *connector_id) |
[CORBA interface] Get the ConnectorProfile | |
virtual ReturnCode_t | connect (ConnectorProfile &connector_profile) |
[CORBA interface] Connect the Port | |
virtual ReturnCode_t | notify_connect (ConnectorProfile &connector_profile) |
[CORBA interface] Notify the Ports connection | |
virtual ReturnCode_t | disconnect (const char *connector_id) |
[CORBA interface] Connect the Port | |
virtual ReturnCode_t | notify_disconnect (const char *connector_id) |
[CORBA interface] Notify the Ports disconnection | |
virtual ReturnCode_t | disconnect_all () |
[CORBA interface] Connect the Port | |
void | setName (const char *name) |
Set the name of this Port. | |
const PortProfile & | getProfile () const |
Get the PortProfile of the Port. | |
void | setPortRef (Port_ptr port_ref) |
Set the object reference of this Port. | |
Port_ptr | getPortRef () |
Get the object reference of this Port. | |
void | setOwner (RTObject_ptr owner) |
Set the owner RTObject of the Port. | |
Protected Types | |
typedef ACE_Guard< ACE_Recursive_Thread_Mutex > | Guard |
Protected Member Functions | |
virtual ReturnCode_t | publishInterfaces (ConnectorProfile &connector_profile) |
Publish interface information. | |
virtual ReturnCode_t | subscribeInterfaces (const ConnectorProfile &connector_profile) |
Subscribe interfaces. | |
virtual void | unsubscribeInterfaces (const ConnectorProfile &connector_profile) |
Unsubscribe interfaces. | |
virtual ReturnCode_t | connectNext (ConnectorProfile &connector_profile) |
Call notify_connect() of the next Port. | |
virtual ReturnCode_t | disconnectNext (ConnectorProfile &connector_profile) |
Call notify_disconnect() of the next Port. | |
bool | isEmptyId (const ConnectorProfile &connector_profile) const |
Whether connector_id of ConnectorProfile is empty. | |
const std::string | getUUID () const |
Get the UUID. | |
void | setUUID (ConnectorProfile &connector_profile) const |
Create and set the UUID to the ConnectorProfile. | |
bool | isExistingConnId (const char *id) |
Whether the given id exists in stored ConnectorProfiles. | |
ConnectorProfile | findConnProfile (const char *id) |
Find ConnectorProfile with id. | |
CORBA::Long | findConnProfileIndex (const char *id) |
Find ConnectorProfile with id. | |
void | updateConnectorProfile (const ConnectorProfile &connector_profile) |
Append or update the ConnectorProfile list. | |
bool | eraseConnectorProfile (const char *id) |
Delete the ConnectorProfile. | |
bool | appendInterface (const char *name, const char *type_name, PortInterfacePolarity pol) |
Append an interface to the PortInterfaceProfile. | |
bool | deleteInterface (const char *name, PortInterfacePolarity pol) |
Delete an interface from the PortInterfaceProfile. | |
template<class ValueType> | |
void | addProperty (const char *key, ValueType value) |
Add NameValue data to PortProfile's properties. | |
Protected Attributes | |
PortProfile | m_profile |
PortProfile of the Port. | |
RTC::Port_var | m_objref |
ACE_Recursive_Thread_Mutex | m_profile_mutex |
Classes | |
struct | Consumer |
Consumer inforamtion struct. | |
struct | subscribe |
Subscription mutching functor for Consumer. | |
struct | unsubscribe |
Unsubscription functor for Consumer. |
CorbaPort is an implementation of the Port of RT-Component's that provides user-defined CORBA Object Service and Consumer.
RT-Component can provide user-defined CORBA serivces, which is called RT-Serivce (Provider), through the Ports. RT-Component can also provide place-holder, which is called RT-Serivce Consumer, to use other RT-Component's service.
The CorbaPort can manage any number of Providers and Consumers, can associate Consumers with correspondent Providers when establishing connection among Ports.
Usually, CorbaPort is used like the following.
RTC::CorbaPort m_port0; // declaration of Port
MyService_impl m_mysvc0; // Serivce Provider that is provided by the Port RTC::CorbaConsumer<YourService> m_cons0; // Consumer of the Port
// register Service Provider to the Port m_port0.registerProvider("MyService0", "Generic", m_mysvc0); // register Service Consumer to the Port m_port0.registerConsumer("YourService0", "Generic", m_cons0 );
// after connect established
m_cons0->your_service_function(); // call a YourService's function
// in another component that is connected with the Port m_cons1->my_service_function(); // call a MyService's function
Registering Service Provider by registerProvider(), it can be used from other RT-Components. Registering Service Consumer by registerConsumer(), other RT-Component's services can be used through the consumer object.
|
|
|
Constructor.
|
|
Destructor.
|
|
Add NameValue data to PortProfile's properties.
|
|
Append an interface to the PortInterfaceProfile. This operation appends interface information to the PortInterfaceProfile that is owned by the Port. The given interfaces information only updates PortInterfaceProfile of PortProfile that is obtained through get_port_profile(). In order to provide and require interfaces, proper functions (for example publishInterface(), subscribeInterface() and so on) should be overridden in subclasses, and these functions provide concrete interface connection and disconnection functionality. The interface (instance) name have to be unique in the Port. If the given interface name is identical with stored interface name, this function returns false.
|
|
[CORBA interface] Connect the Port This operation establishes connection according to the given ConnectionProfile inforamtion. Application programs, which is going to establish the connection among Ports owned by RT-Components, have to set valid values to the ConnectorProfile and give it to the argument of connect() operation. name, ports, (properties) members of ConnectorProfile should be set valid values before giving to the argument of connect() operation.
|
|
Call notify_connect() of the next Port. This operation calls the notify_connect() of the next Port's that stored in ConnectorProfile's port_ref sequence.
|
|
Delete an interface from the PortInterfaceProfile. This operation deletes interface information from the PortInterfaceProfile that is owned by the Port.
|
|
[CORBA interface] Connect the Port This operation destroys connection between this port and the peer port according to given id that is given when the connection established.
|
|
[CORBA interface] Connect the Port This operation destroys all connection channels owned by the Port.
|
|
Call notify_disconnect() of the next Port. This operation calls the notify_disconnect() of the next Port's that stored in ConnectorProfile's port_ref sequence.
|
|
Delete the ConnectorProfile. This operation deletes a ConnectorProfile specified by id from ConnectorProfileList owned by PortProfile of this Port.
|
|
Find ConnectorProfile with id. This operation returns ConnectorProfile with the given id from Port's ConnectorProfiles' list. If the ConnectorProfile with connector id that is identical with the given id does not exist, empty ConnectorProfile is returned.
|
|
Find ConnectorProfile with id. This operation returns ConnectorProfile with the given id from Port's ConnectorProfiles' list. If the ConnectorProfile with connector id that is identical with the given id does not exist, empty ConnectorProfile is returned.
|
|
[CORBA interface] Get the ConnectorProfile This operation returns the ConnectorProfiles specified connector_id.
|
|
[CORBA interface] Get the ConnectorProfileList of the Port This operation returns a list of the ConnectorProfiles of the Port. ConnectorProfile includes the connection information that describes relation between (among) Ports, and Ports exchange the ConnectionProfile on connection process and hold the same information in each Port. ConnectionProfile has the following members,
|
|
[CORBA interface] Get the PortProfile of the Port This operation returns the PortProfile of the Port. PortProfile struct has the following members,
|
|
|
|
Get the object reference of this Port. This operation returns the object reference that is stored in the Port's PortProfile.
|
|
Get the PortProfile of the Port. This operation returns const reference of the PortProfile.
|
|
Get the UUID. This operation generates UUID.
|
|
Whether connector_id of ConnectorProfile is empty.
|
|
Whether the given id exists in stored ConnectorProfiles. This operation returns boolean whether the given id exists in the Port's ConnectorProfiles.
|
|
[CORBA interface] Notify the Ports connection This operation is invoked between Ports internally when the connection is established.
|
|
[CORBA interface] Notify the Ports disconnection This operation is invoked between Ports internally when the connection is destroied.
|
|
Publish interface information.
Implements RTC::PortBase. |
|
Register consumer. This operation registers a consumer, which requiers a service, to the other Port. The consumer is associated with "instance_name" and "type_name" as the instance name of the service and as the type name of the service that is required.
|
|
Register provider. This operation registers a servant, which is provided in this Port, to the Port. The servant is associated with "instance_name" and "type_name" as the instance name of the servant and as the type name of the servant.
|
|
Set the name of this Port. This operation sets the name of this Port. The given Port's name is applied to Port's PortProfile.name.
|
|
Set the owner RTObject of the Port. This operation sets the owner RTObject of this Port.
|
|
Set the object reference of this Port. This operation sets the object reference itself to the Port's PortProfile.
|
|
Create and set the UUID to the ConnectorProfile. This operation generates and set UUID to the ConnectorProfile.
|
|
Subscribe interfaces.
Implements RTC::PortBase. |
|
Unsubscribe interfaces.
Implements RTC::PortBase. |
|
Append or update the ConnectorProfile list. This operation appends or updates ConnectorProfile of the Port by the given ConnectorProfile. If the connector_id of the given ConnectorProfile does not exist in the Port's ConnectorProfile list, the given ConnectorProfile would be append to the list. If the same id exists, the list would be updated.
|
|
|
|
PortProfile of the Port.
|
|
|