Port base class. More...
#include <PortBase.h>
Classes | |
struct | find_conn_id |
Functor to find a ConnectorProfile named id. More... | |
struct | find_interface |
Functor to find interface from name and polarity. More... | |
struct | find_port_ref |
Functor to find the object reference that is identical port_ref. More... | |
Public Member Functions | |
virtual void | activateInterfaces ()=0 |
Activate all Port interfaces. | |
virtual ReturnCode_t | connect (ConnectorProfile &connector_profile) throw (CORBA::SystemException) |
[CORBA interface] Connect the Port | |
virtual void | deactivateInterfaces ()=0 |
Deactivate all Port interfaces. | |
virtual ReturnCode_t | disconnect (const char *connector_id) throw (CORBA::SystemException) |
[CORBA interface] Disconnect the Port | |
virtual ReturnCode_t | disconnect_all () throw (CORBA::SystemException) |
[CORBA interface] Disconnect the All Ports | |
virtual ConnectorProfile * | get_connector_profile (const char *connector_id) throw (CORBA::SystemException) |
[CORBA interface] Get the ConnectorProfile | |
virtual ConnectorProfileList * | get_connector_profiles () throw (CORBA::SystemException) |
[CORBA interface] Get the ConnectorProfileList of the Port | |
virtual PortProfile * | get_port_profile () throw (CORBA::SystemException) |
[CORBA interface] Get the PortProfile of the Port | |
const char * | getName () const |
Get the name of this Port. | |
const PortProfile & | getPortProfile () const |
Get the PortProfile of the Port. | |
PortService_ptr | getPortRef () |
Get the object reference of this Port. | |
const PortProfile & | getProfile () const |
Get the PortProfile of the Port. | |
virtual ReturnCode_t | notify_connect (ConnectorProfile &connector_profile) throw (CORBA::SystemException) |
[CORBA interface] Notify the Ports connection | |
virtual ReturnCode_t | notify_disconnect (const char *connector_id) throw (CORBA::SystemException) |
[CORBA interface] Notify the Ports disconnection | |
PortBase (const char *name="") | |
Constructor. | |
void | setName (const char *name) |
Set the name of this Port. | |
void | setOnConnected (ConnectionCallback *on_connected) |
Setting callback called on connection established. | |
void | setOnConnectionLost (ConnectionCallback *on_connection_lost) |
Setting callback called on connection lost. | |
void | setOnDisconnected (ConnectionCallback *on_disconnected) |
Setting callback called on disconnected. | |
void | setOnPublishInterfaces (ConnectionCallback *on_publish) |
Setting callback called on publish interfaces. | |
void | setOnSubscribeInterfaces (ConnectionCallback *on_subscribe) |
Setting callback called on publish interfaces. | |
void | setOnUnsubscribeInterfaces (ConnectionCallback *on_subscribe) |
Setting callback called on unsubscribe interfaces. | |
void | setOwner (RTObject_ptr owner) |
Set the owner RTObject of the Port. | |
void | setPortConnectListenerHolder (PortConnectListeners *portconnListeners) |
Setting PortConnectListener holder. | |
void | setPortRef (PortService_ptr port_ref) |
Set the object reference of this Port. | |
virtual | ~PortBase (void) |
Destructor. | |
Protected Types | |
typedef coil::Guard< coil::Mutex > | Guard |
Protected Member Functions | |
virtual ReturnCode_t | _publishInterfaces (void) |
Publish interface information. | |
template<class ValueType > | |
void | addProperty (const char *key, ValueType value) |
Add NameValue data to PortProfile's properties. | |
bool | appendInterface (const char *name, const char *type_name, PortInterfacePolarity pol) |
Append an interface to the PortInterfaceProfile. | |
void | appendProperty (const char *key, const char *value) |
Append NameValue data to PortProfile's properties. | |
bool | checkPorts (::RTC::PortServiceList &ports) |
Existence of ports. | |
virtual ReturnCode_t | connectNext (ConnectorProfile &connector_profile) |
Call notify_connect() of the next Port. | |
bool | deleteInterface (const char *name, PortInterfacePolarity pol) |
Delete the interface registration from the PortInterfaceProfile. | |
virtual ReturnCode_t | disconnectNext (ConnectorProfile &connector_profile) |
Call notify_disconnect() of the next Port. | |
bool | eraseConnectorProfile (const char *id) |
Delete the ConnectorProfile. | |
ConnectorProfile | findConnProfile (const char *id) |
Find ConnectorProfile with id. | |
CORBA::Long | findConnProfileIndex (const char *id) |
Find ConnectorProfile with id. | |
const std::string | getUUID () const |
Generate the UUID. | |
bool | isEmptyId (const ConnectorProfile &connector_profile) const |
Check whether connector_id of ConnectorProfile is empty. | |
bool | isExistingConnId (const char *id) |
Check whether the given id exists in stored ConnectorProfiles. | |
void | onConnected (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret) |
void | onConnectNextport (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret) |
void | onDisconnected (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret) |
void | onDisconnectNextport (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret) |
void | onNotifyConnect (const char *portname, RTC::ConnectorProfile &profile) |
void | onNotifyDisconnect (const char *portname, RTC::ConnectorProfile &profile) |
void | onPublishInterfaces (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret) |
void | onSubscribeInterfaces (const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret) |
void | onUnsubscribeInterfaces (const char *portname, RTC::ConnectorProfile &profile) |
virtual ReturnCode_t | publishInterfaces (ConnectorProfile &connector_profile)=0 |
Publish interface information. | |
virtual void | setConnectionLimit (int limit_value) |
Set the maximum number of connections. | |
void | setUUID (ConnectorProfile &connector_profile) const |
Generate and set the UUID to the ConnectorProfile. | |
virtual ReturnCode_t | subscribeInterfaces (const ConnectorProfile &connector_profile)=0 |
Publish interface information. | |
virtual void | unsubscribeInterfaces (const ConnectorProfile &connector_profile)=0 |
Disconnect interface connection. | |
void | updateConnectorProfile (const ConnectorProfile &connector_profile) |
Append or update the ConnectorProfile list. | |
void | updateConnectors () |
Disconnect ports that doesn't exist. | |
Protected Attributes | |
int | m_connectionLimit |
The maximum number of connections. | |
coil::Mutex | m_connectorsMutex |
RTC::PortService_var | m_objref |
Object Reference of the Port. | |
ConnectionCallback * | m_onConnected |
Callback functor objects. | |
ConnectionCallback * | m_onConnectionLost |
Callback functor objects. | |
ConnectionCallback * | m_onDisconnected |
Callback functor objects. | |
ConnectionCallback * | m_onPublishInterfaces |
Callback functor objects. | |
ConnectionCallback * | m_onSubscribeInterfaces |
Callback functor objects. | |
ConnectionCallback * | m_onUnsubscribeInterfaces |
Callback functor objects. | |
std::string | m_ownerInstanceName |
Instance name. | |
PortConnectListeners * | m_portconnListeners |
PortConnectListener holder. | |
PortProfile | m_profile |
PortProfile of the Port. | |
coil::Mutex | m_profile_mutex |
Mutex of PortProfile. | |
Logger | rtclog |
Logger stream. |
Port base class.
This class is a base class of RTC::Port. RTC::Port inherits a concept of RT-Component, and can be regarded as almost the same as it. In the concept of RT-Component, Port is attached to the component, can mediate interaction between other components and usually is associated with some interfaces. Component can provide or require interface for outside via Port, and the Port plays a role to manage the connection.
Concrete class of Port assumes to be usually created at the same time that RT-Component's instance is created, be registerd to RT-Component after provided and required interfaces are registerd, and function as accessible Port from outside.
RTC::Port provides the following operations as CORBA interface:
This class provides implementations of these operations.
In these operations, as for get_port_profile(), get_connector_profiles(), get_connector_profile(), connect(), disconnect() and disconnect_all(), since their behaviors especially need not to be change in subclass, overriding is not recommended.
As for notify_connect() and notify_disconnect(), you may have to modify behavior according to the kind of interfaces that subclass provides and requires, however it is not recommended these are overriden directly. In the section of notify_connect() and notify_disconnect() as described below, it is recommended that you modify behavior by overriding the protected function related to these functions.
Definition at line 134 of file PortBase.h.
typedef coil::Guard<coil::Mutex> RTC::PortBase::Guard [protected] |
Definition at line 2089 of file PortBase.h.
RTC::PortBase::PortBase | ( | const char * | name = "" | ) |
Constructor.
The constructor of the ProtBase class is given the name of this Port and initialized. At the same time, the PortBase activates itself as CORBA object and stores its object reference to the PortProfile's port_ref member. Characters except "." can be used for the name of the port.
name | The name of Port (The default value:"") |
Definition at line 38 of file PortBase.cpp.
RTC::PortBase::~PortBase | ( | void | ) | [virtual] |
Destructor.
In the destructor, PortService CORBA object is deactivated. This function never throws exception.
Definition at line 71 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::_publishInterfaces | ( | void | ) | [protected, virtual] |
Publish interface information.
Publish interface information.
Definition at line 315 of file PortBase.cpp.
virtual void RTC::PortBase::activateInterfaces | ( | ) | [pure virtual] |
Activate all Port interfaces.
This operation activate all interfaces that is registered in the ports.
Implemented in RTC::CorbaPort, RTC::OutPortBase, RTC::InPortBase, RTObject::PortMock, PortBase::PortBaseMock, PortAdmin::PortMock, and CORBA_SeqUtil::PortMock.
void RTC::PortBase::addProperty | ( | const char * | key, |
ValueType | value | ||
) | [inline, protected] |
Add NameValue data to PortProfile's properties.
Add NameValue data to PortProfile's properties. Type of additional data is specified by ValueType.
key | The name of properties |
value | The value of properties |
Definition at line 1876 of file PortBase.h.
bool RTC::PortBase::appendInterface | ( | const char * | name, |
const char * | type_name, | ||
PortInterfacePolarity | pol | ||
) | [protected] |
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.
name | The instance name of the interface. |
type_name | The type name of the interface. |
pol | The interface's polarity (RTC::PROVIDED or RTC:REQUIRED) |
Definition at line 841 of file PortBase.cpp.
void RTC::PortBase::appendProperty | ( | const char * | key, |
const char * | value | ||
) | [inline, protected] |
Append NameValue data to PortProfile's properties.
Append NameValue data to PortProfile's properties. The properties which are set by this function would be referred through get_port_profile() from outsides.
key | The name of properties |
value | The value of properties |
Definition at line 1907 of file PortBase.h.
bool RTC::PortBase::checkPorts | ( | ::RTC::PortServiceList & | ports | ) | [protected] |
Existence of ports.
ports | Checked ports |
Definition at line 937 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::connect | ( | ConnectorProfile & | connector_profile | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Connect the Port
This operation establishes connection according to the given ConnectionProfile inforamtion. This function is premised on calling from mainly application program or tools.
connector_profile | The ConnectorProfile. |
Reimplemented in RTC::OutPortBase, and RTC::InPortBase.
Definition at line 181 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::connectNext | ( | ConnectorProfile & | connector_profile | ) | [protected, virtual] |
Call notify_connect() of the next Port.
Call notify_connect() for the next Port.
This operation calls the notify_connect() of the next Port's that stored in ConnectorProfile's port_ref sequence.
connector_profile | The connection profile information |
Definition at line 626 of file PortBase.cpp.
virtual void RTC::PortBase::deactivateInterfaces | ( | ) | [pure virtual] |
Deactivate all Port interfaces.
This operation deactivate all interfaces that is registered in the ports.
Implemented in RTC::CorbaPort, RTC::OutPortBase, RTC::InPortBase, RTObject::PortMock, PortBase::PortBaseMock, PortAdmin::PortMock, and CORBA_SeqUtil::PortMock.
bool RTC::PortBase::deleteInterface | ( | const char * | name, |
PortInterfacePolarity | pol | ||
) | [protected] |
Delete the interface registration from the PortInterfaceProfile.
This operation deletes interface information from the PortInterfaceProfile that is owned by the Port.
name | The instance name of the interface. |
pol | The interface's polarity (RTC::PROVIDED or RTC:REQUIRED) |
Definition at line 867 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::disconnect | ( | const char * | connector_id | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Disconnect the Port
This operation destroys connection between this port and the peer port according to given connector_id. Usually connector_id should be a UUID string that is unique in the system. And the connection, which is established by connect()/notify_connect() functions, is identified by the ConnectorProfile::connector_id.
connector_id | The ID of the ConnectorProfile. |
Definition at line 339 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::disconnect_all | ( | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Disconnect the All Ports
This operation destroys all connections associated with this Port.
Definition at line 454 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::disconnectNext | ( | ConnectorProfile & | connector_profile | ) | [protected, virtual] |
Call notify_disconnect() of the next Port.
Call notify_disconnect() for the next Port.
This operation calls the notify_disconnect() of the next Port's that stored in ConnectorProfile's port_ref sequence.
connector_profile | The connection profile information |
Definition at line 650 of file PortBase.cpp.
bool RTC::PortBase::eraseConnectorProfile | ( | const char * | id | ) | [protected] |
Delete the ConnectorProfile.
This operation deletes a ConnectorProfile specified by id from ConnectorProfileList owned by PortProfile of this Port.
id | The id of the ConnectorProfile to be deleted. |
Definition at line 823 of file PortBase.cpp.
ConnectorProfile RTC::PortBase::findConnProfile | ( | const char * | id | ) | [protected] |
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.
id | the connector_id to be searched in Port's ConnectorProfiles |
Definition at line 770 of file PortBase.cpp.
CORBA::Long RTC::PortBase::findConnProfileIndex | ( | const char * | id | ) | [protected] |
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, -1 is returned.
id | the connector_id to be searched |
Definition at line 785 of file PortBase.cpp.
ConnectorProfile * RTC::PortBase::get_connector_profile | ( | const char * | connector_id | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Get the ConnectorProfile
This operation returns the ConnectorProfiles specified connector_id. Since this function is CORBA operation, callers have responsibility to destruction of the returned ConnectorProfile object according to the CORBA memory management rules.
If ConnectorProfile with specified connector_id is not included, empty ConnectorProfile is returned.
connector_id | ID of the ConnectorProfile |
Definition at line 153 of file PortBase.cpp.
ConnectorProfileList * RTC::PortBase::get_connector_profiles | ( | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Get the ConnectorProfileList of the Port
This operation returns a list of the ConnectorProfiles of the Port. Since this function is CORBA operation, callers have responsibility to destruction of the returned ConnectorProfileList object according to the CORBA memory management rules.
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 every Port. ConnectionProfile has the following members:
Definition at line 133 of file PortBase.cpp.
PortProfile * RTC::PortBase::get_port_profile | ( | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Get the PortProfile of the Port
This operation returns the PortProfile of the Port. Since this function is CORBA operation, callers have responsibility to destruction of the returned PortProfile object according to the CORBA memory management rules.
PortProfile struct has the following members:
Definition at line 100 of file PortBase.cpp.
const char * RTC::PortBase::getName | ( | void | ) | const |
Get the name of this Port.
This operation returns the name of this Port.
Definition at line 504 of file PortBase.cpp.
const PortProfile & RTC::PortBase::getPortProfile | ( | ) | const |
Get the PortProfile of the Port.
This function is a const function that returns a const reference of the PortProfile stored in this Port.
Definition at line 119 of file PortBase.cpp.
PortService_ptr RTC::PortBase::getPortRef | ( | ) |
Get the object reference of this Port.
Get the object reference of the Port.
This operation returns the object reference that is stored in the Port's PortProfile.
Definition at line 545 of file PortBase.cpp.
const PortProfile & RTC::PortBase::getProfile | ( | ) | const |
Get the PortProfile of the Port.
This operation returns const reference of the PortProfile.
Definition at line 517 of file PortBase.cpp.
const std::string RTC::PortBase::getUUID | ( | ) | const [protected] |
Generate the UUID.
This operation generates UUID.
Reimplemented in PortBase::PortBaseMock.
Definition at line 728 of file PortBase.cpp.
bool RTC::PortBase::isEmptyId | ( | const ConnectorProfile & | connector_profile | ) | const [protected] |
Check whether connector_id of ConnectorProfile is empty.
Check whether connector_id of specified ConnectorProfile is empty.
connector_profile | Target ConnectorProfile for the check |
Definition at line 715 of file PortBase.cpp.
bool RTC::PortBase::isExistingConnId | ( | const char * | id | ) | [protected] |
Check whether the given id exists in stored ConnectorProfiles.
This operation returns boolean whether the given id exists in the Port's ConnectorProfiles.
id | connector_id to be find in Port's ConnectorProfiles |
Definition at line 757 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::notify_connect | ( | ConnectorProfile & | connector_profile | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Notify the Ports connection
This operation is usually called from other ports' connect() or notify_connect() operations when connection between ports is established. This function is not premised on calling from other functions or application programs.
According to the template method pattern, the notify_connect() calls "publishInterfaces()" and "subsctiveInterfaces()" functions, which are premised on implementing in the subclasses. The processing sequence is as follows.
According to the order of port's references stored in the ConnectorProfile::ports, publishing interface information to all the ports and subscription interface information from all the ports is performed by "notify_connect()"s. This cascaded call never aborts in the halfway operations, and calling sequence shall be completed for all the ports.
connector_profile | The ConnectorProfile. |
Definition at line 229 of file PortBase.cpp.
ReturnCode_t RTC::PortBase::notify_disconnect | ( | const char * | connector_id | ) | throw (CORBA::SystemException) [virtual] |
[CORBA interface] Notify the Ports disconnection
This operation is invoked between Ports internally when the connection is destroied. Generally it is not premised on calling from application programs or RTC objects except Port object.
According to the template method pattern, the notify_disconnect() calls unsubsctiveInterfaces() function, which are premised on implementing in the subclasses. The processing sequence is as follows.
notify_disconnect() notifies disconnection to all the ports by cascaded call to the stored ports in the ConnectorProfile::ports in order.
connector_id | The ID of the ConnectorProfile. |
Reimplemented in PortBase::PortBaseMock.
Definition at line 396 of file PortBase.cpp.
void RTC::PortBase::onConnected | ( | const char * | portname, |
RTC::ConnectorProfile & | profile, | ||
ReturnCode_t | ret | ||
) | [inline, protected] |
Definition at line 2021 of file PortBase.h.
void RTC::PortBase::onConnectNextport | ( | const char * | portname, |
RTC::ConnectorProfile & | profile, | ||
ReturnCode_t | ret | ||
) | [inline, protected] |
Definition at line 1997 of file PortBase.h.
void RTC::PortBase::onDisconnected | ( | const char * | portname, |
RTC::ConnectorProfile & | profile, | ||
ReturnCode_t | ret | ||
) | [inline, protected] |
Definition at line 2043 of file PortBase.h.
void RTC::PortBase::onDisconnectNextport | ( | const char * | portname, |
RTC::ConnectorProfile & | profile, | ||
ReturnCode_t | ret | ||
) | [inline, protected] |
Definition at line 2032 of file PortBase.h.
void RTC::PortBase::onNotifyConnect | ( | const char * | portname, |
RTC::ConnectorProfile & | profile | ||
) | [inline, protected] |
Definition at line 1956 of file PortBase.h.
void RTC::PortBase::onNotifyDisconnect | ( | const char * | portname, |
RTC::ConnectorProfile & | profile | ||
) | [inline, protected] |
Definition at line 1966 of file PortBase.h.
void RTC::PortBase::onPublishInterfaces | ( | const char * | portname, |
RTC::ConnectorProfile & | profile, | ||
ReturnCode_t | ret | ||
) | [inline, protected] |
Definition at line 1985 of file PortBase.h.
void RTC::PortBase::onSubscribeInterfaces | ( | const char * | portname, |
RTC::ConnectorProfile & | profile, | ||
ReturnCode_t | ret | ||
) | [inline, protected] |
Definition at line 2009 of file PortBase.h.
void RTC::PortBase::onUnsubscribeInterfaces | ( | const char * | portname, |
RTC::ConnectorProfile & | profile | ||
) | [inline, protected] |
Definition at line 1975 of file PortBase.h.
virtual ReturnCode_t RTC::PortBase::publishInterfaces | ( | ConnectorProfile & | connector_profile | ) | [protected, pure virtual] |
Publish interface information.
This operation is pure virutal function that would be called at the beginning of the notify_connect() process sequence. In the notify_connect(), the following methods would be called in order.
In the concrete Port, this method should be overridden. This method processes the given ConnectorProfile argument and if the given parameter is invalid, it would return error code of ReturnCode_t. Usually, publishInterfaces() method should set interfaces information owned by this Port, and publish it to the other Ports.
When this method is called, other Ports' interfaces information may not be completed. Therefore, the process to obtain other Port's interfaces information should be done in the subscribeInterfaces() method.
This operation should create the new connection for the new connector_id, and should update the connection for the existing connection_id.
connector_profile | The connection profile information |
Implemented in RTC::CorbaPort, RTC::OutPortBase, and RTC::InPortBase.
void RTC::PortBase::setConnectionLimit | ( | int | limit_value | ) | [protected, virtual] |
Set the maximum number of connections.
limit_value | The maximum number of connections |
Definition at line 700 of file PortBase.cpp.
void RTC::PortBase::setName | ( | const char * | name | ) |
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.
name | The name of this Port. |
Definition at line 488 of file PortBase.cpp.
void RTC::PortBase::setOnConnected | ( | ConnectionCallback * | on_connected | ) |
Setting callback called on connection established.
This operation sets a functor that is called when connection between ports established.
Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.
The callback functor is called only when notify_connect() function successfully returns. In case of error, the functor will not be called.
Since this functor is called with ConnectorProfile argument that is same as out-parameter of notify_connect() function, you can get all the information of published interfaces of related ports in the connection. Although by using this functor, you can modify ConnectorProfile argument for out-paramter of notify_connect(), the modification should be done carefully for fear of causing connection inconsistency.
on_subscribe | a pointer to ConnectionCallback's subclasses |
Definition at line 589 of file PortBase.cpp.
void RTC::PortBase::setOnConnectionLost | ( | ConnectionCallback * | on_connection_lost | ) |
Setting callback called on connection lost.
This operation sets a functor that is called when connection of this port does lost.
on_connection_lost | a pointer to ConnectionCallback's subclasses |
Definition at line 604 of file PortBase.cpp.
void RTC::PortBase::setOnDisconnected | ( | ConnectionCallback * | on_disconnected | ) |
Setting callback called on disconnected.
This operation sets a functor that is called when connection between ports is destructed.
Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.
The callback functor is called just before notify_disconnect() that is disconnection execution function returns.
This functor is called with argument of corresponding ConnectorProfile. Since this ConnectorProfile will be destructed after calling this functor, modifications never affect others.
on_disconnected | a pointer to ConnectionCallback's subclasses |
Definition at line 599 of file PortBase.cpp.
void RTC::PortBase::setOnPublishInterfaces | ( | ConnectionCallback * | on_publish | ) |
Setting callback called on publish interfaces.
This operation sets a functor that is called after publishing interfaces process when connecting between ports.
Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.
The callback functor is called after calling publishInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of publishInterfaces() function. Although by using this functor, you can modify the ConnectorProfile published by publishInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.
on_publish | a pointer to ConnectionCallback's subclasses |
Definition at line 579 of file PortBase.cpp.
void RTC::PortBase::setOnSubscribeInterfaces | ( | ConnectionCallback * | on_subscribe | ) |
Setting callback called on publish interfaces.
This operation sets a functor that is called before subscribing interfaces process when connecting between ports.
Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.
The callback functor is called before calling subscribeInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of subscribeInterfaces() function. Although by using this functor, you can modify ConnectorProfile argument for subscribeInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.
on_subscribe | a pointer to ConnectionCallback's subclasses |
Definition at line 584 of file PortBase.cpp.
void RTC::PortBase::setOnUnsubscribeInterfaces | ( | ConnectionCallback * | on_subscribe | ) |
Setting callback called on unsubscribe interfaces.
This operation sets a functor that is called before unsubscribing interfaces process when disconnecting between ports.
Since the ownership of the callback functor object is owned by the caller, it has the responsibility of object destruction.
The callback functor is called before calling unsubscribeInterfaces() that is virtual member function of the PortBase class with an argument of ConnectorProfile type that is same as the argument of unsubscribeInterfaces() function. Although by using this functor, you can modify ConnectorProfile argument for unsubscribeInterfaces() function, the modification should be done carefully for fear of causing connection inconsistency.
on_unsubscribe | a pointer to ConnectionCallback's subclasses |
Definition at line 594 of file PortBase.cpp.
void RTC::PortBase::setOwner | ( | RTObject_ptr | owner | ) |
Set the owner RTObject of the Port.
This operation sets the owner RTObject of this Port.
owner | The owner RTObject's reference of this Port |
Definition at line 559 of file PortBase.cpp.
void RTC::PortBase::setPortConnectListenerHolder | ( | PortConnectListeners * | portconnListeners | ) |
Setting PortConnectListener holder.
This operation sets a functor that is called when connection of this port does lost.
on_connection_lost | a pointer to ConnectionCallback's subclasses |
Definition at line 610 of file PortBase.cpp.
void RTC::PortBase::setPortRef | ( | PortService_ptr | port_ref | ) |
Set the object reference of this Port.
Set the object reference of the Port.
This operation sets the object reference itself to the Port's PortProfile.
port_ref | The object reference of this Port. |
Definition at line 531 of file PortBase.cpp.
void RTC::PortBase::setUUID | ( | ConnectorProfile & | connector_profile | ) | const [protected] |
Generate and set the UUID to the ConnectorProfile.
Generate the UUID and set it to the ConnectorProfile.
This operation generates and set UUID to the ConnectorProfile.
connector_profile | ConnectorProfile to be set connector_id |
Definition at line 744 of file PortBase.cpp.
virtual ReturnCode_t RTC::PortBase::subscribeInterfaces | ( | const ConnectorProfile & | connector_profile | ) | [protected, pure virtual] |
Publish interface information.
This operation is pure virutal function that would be called at the mid-flow of the notify_connect() process sequence. In the notify_connect(), the following methods would be called in order.
In the concrete Port, this method should be overridden. This method processes the given ConnectorProfile argument and if the given parameter is invalid, it would return error code of ReturnCode_t. The given argument ConnectorProfile includes all the interfaces information in it. Usually, subscribeInterafaces() method obtains information of interfaces from ConnectorProfile, and should set it to the interfaces that require them.
This operation should create the new connection for the new connector_id, and should update the connection for the existing connection_id.
connector_profile | The connection profile information |
Implemented in RTC::CorbaPort, RTC::OutPortBase, and RTC::InPortBase.
virtual void RTC::PortBase::unsubscribeInterfaces | ( | const ConnectorProfile & | connector_profile | ) | [protected, pure virtual] |
Disconnect interface connection.
This operation is pure virutal function that would be called at the end of the notify_disconnect() process sequence. In the notify_disconnect(), the following methods would be called in order to disconnect.
connector_profile | The connection profile information |
Implemented in RTC::CorbaPort, RTC::OutPortBase, and RTC::InPortBase.
void RTC::PortBase::updateConnectorProfile | ( | const ConnectorProfile & | connector_profile | ) | [protected] |
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.
connector_profile | the ConnectorProfile to be appended or updated |
Definition at line 799 of file PortBase.cpp.
void RTC::PortBase::updateConnectors | ( | ) | [protected] |
Disconnect ports that doesn't exist.
This function detects dead-port, and if dead ports are found in the connection list, disconnects them.
Definition at line 886 of file PortBase.cpp.
int RTC::PortBase::m_connectionLimit [protected] |
The maximum number of connections.
Definition at line 2107 of file PortBase.h.
coil::Mutex RTC::PortBase::m_connectorsMutex [mutable, protected] |
Definition at line 2088 of file PortBase.h.
RTC::PortService_var RTC::PortBase::m_objref [protected] |
Object Reference of the Port.
Definition at line 2079 of file PortBase.h.
ConnectionCallback* RTC::PortBase::m_onConnected [protected] |
Callback functor objects.
This is a callback object that is called when the connection is completed.
Definition at line 2152 of file PortBase.h.
ConnectionCallback* RTC::PortBase::m_onConnectionLost [protected] |
Callback functor objects.
This is a callback object called when the connection of the port does lost.
Definition at line 2196 of file PortBase.h.
ConnectionCallback* RTC::PortBase::m_onDisconnected [protected] |
Callback functor objects.
This is a callback object that is called in connected release.
Definition at line 2180 of file PortBase.h.
ConnectionCallback* RTC::PortBase::m_onPublishInterfaces [protected] |
Callback functor objects.
This is callback objedct that is called when the interface is opened to the public.
Definition at line 2123 of file PortBase.h.
ConnectionCallback* RTC::PortBase::m_onSubscribeInterfaces [protected] |
Callback functor objects.
This is callback objedct that is called when the interface is got.
Definition at line 2137 of file PortBase.h.
Callback functor objects.
This is a callback object that is called when the interface is released.
Definition at line 2166 of file PortBase.h.
std::string RTC::PortBase::m_ownerInstanceName [protected] |
Instance name.
Definition at line 2098 of file PortBase.h.
PortConnectListeners* RTC::PortBase::m_portconnListeners [protected] |
PortConnectListener holder.
Holders of PortConnectListeners
Definition at line 2211 of file PortBase.h.
PortProfile RTC::PortBase::m_profile [protected] |
PortProfile of the Port.
Definition at line 2070 of file PortBase.h.
coil::Mutex RTC::PortBase::m_profile_mutex [mutable, protected] |
Mutex of PortProfile.
Definition at line 2087 of file PortBase.h.
Logger RTC::PortBase::rtclog [mutable, protected] |
Logger stream.
Definition at line 2062 of file PortBase.h.