OpenRTM-aist-Python 1.1.2
|
Port base class. More...
Classes | |
class | connect_func |
A functor to connect Ports. More... | |
class | disconnect_all_func |
A functor to disconnect all Ports. More... | |
class | disconnect_func |
A functor to disconnect Ports. More... | |
class | find_conn_id |
A functor to find a ConnectorProfile named id. More... | |
class | find_interface |
A functor to find interface from name and polarity. More... | |
class | find_port_ref |
A functor to find the object reference that is identical port_ref. More... | |
class | if_name |
A functor to find a PortInterfaceProfile named instance_name. More... | |
Public Member Functions | |
def | __init__ (self, name=None) |
Constructor. More... | |
def | __del__ (self) |
Destructor. More... | |
def | get_port_profile (self) |
[CORBA interface] Get the PortProfile of the Port More... | |
def | getPortProfile (self) |
Get the PortProfile of the Port. More... | |
def | get_connector_profiles (self) |
[CORBA interface] Get the ConnectorProfileList of the Port More... | |
def | get_connector_profile (self, connector_id) |
[CORBA interface] Get the ConnectorProfile More... | |
def | connect (self, connector_profile) |
[CORBA interface] Connect the Port More... | |
def | notify_connect (self, connector_profile) |
[CORBA interface] Notify the Ports connection More... | |
def | disconnect (self, connector_id) |
[CORBA interface] Disconnect the Port More... | |
def | notify_disconnect (self, connector_id) |
[CORBA interface] Notify the Ports disconnection More... | |
def | disconnect_all (self) |
[CORBA interface] Connect the Port More... | |
def | setName (self, name) |
Set the name of this Port. More... | |
def | getName (self) |
Get the name of this Port. More... | |
def | getProfile (self) |
Get the PortProfile of the Port. More... | |
def | setPortRef (self, port_ref) |
Set the object reference of this Port. More... | |
def | getPortRef (self) |
Get the object reference of this Port. More... | |
def | setOwner (self, owner) |
Set the owner RTObject of the Port. More... | |
def | setOnPublishInterfaces (self, on_publish) |
Setting callback called on publish interfaces. More... | |
def | setOnSubscribeInterfaces (self, on_subscribe) |
Setting callback called on publish interfaces. More... | |
def | setOnConnected (self, on_connected) |
Setting callback called on connection established. More... | |
def | setOnUnsubscribeInterfaces (self, on_subscribe) |
Setting callback called on unsubscribe interfaces. More... | |
def | setOnDisconnected (self, on_disconnected) |
Setting callback called on disconnected. More... | |
def | setPortConnectListenerHolder (self, portconnListeners) |
Setting PortConnectListener holder. More... | |
def | publishInterfaces (self, connector_profile) |
Publish interface information. More... | |
def | connectNext (self, connector_profile) |
Call notify_connect() of the next Port. More... | |
def | disconnectNext (self, connector_profile) |
Call notify_disconnect() of the next Port. More... | |
def | subscribeInterfaces (self, connector_profile) |
Publish interface information. More... | |
def | unsubscribeInterfaces (self, connector_profile) |
Disconnect interface connection. More... | |
def | setConnectionLimit (self, limit_value) |
Set the maximum number of connections. More... | |
def | isEmptyId (self, connector_profile) |
Whether connector_id of ConnectorProfile is empty. More... | |
def | getUUID (self) |
Get the UUID. More... | |
def | setUUID (self, connector_profile) |
Create and set the UUID to the ConnectorProfile. More... | |
def | isExistingConnId (self, id_) |
Whether the given id exists in stored ConnectorProfiles. More... | |
def | findConnProfile (self, id_) |
Find ConnectorProfile with id. More... | |
def | findConnProfileIndex (self, id_) |
Find ConnectorProfile with id. More... | |
def | updateConnectorProfile (self, connector_profile) |
Append or update the ConnectorProfile list. More... | |
def | eraseConnectorProfile (self, id_) |
Delete the ConnectorProfile. More... | |
def | appendInterface (self, instance_name, type_name, pol) |
Append an interface to the PortInterfaceProfile. More... | |
def | deleteInterface (self, name, pol) |
Delete an interface from the PortInterfaceProfile. More... | |
def | addProperty (self, key, value) |
Add NameValue data to PortProfile's properties. More... | |
def | appendProperty (self, key, value) |
Append NameValue data to PortProfile's properties. More... | |
def | updateConnectors (self) |
Disconnect ports that doesn't exist. More... | |
def | checkPorts (self, ports) |
Existence of ports. More... | |
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.
def OpenRTM_aist.PortBase.PortBase.__init__ | ( | self, | |
name = None |
|||
) |
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 |
def OpenRTM_aist.PortBase.PortBase.__del__ | ( | self | ) |
Destructor.
In the destructor, PortService CORBA object is deactivated. This function never throws exception.
def OpenRTM_aist.PortBase.PortBase.addProperty | ( | self, | |
key, | |||
value | |||
) |
Add NameValue data to PortProfile's properties.
key | The name of properties |
value | The value of properties |
template <class valuetype>=""> void addProperty(const char* key, ValueType value)
def OpenRTM_aist.PortBase.PortBase.appendInterface | ( | self, | |
instance_name, | |||
type_name, | |||
pol | |||
) |
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) |
bool appendInterface(const char* name, const char* type_name, PortInterfacePolarity pol);
def OpenRTM_aist.PortBase.PortBase.appendProperty | ( | self, | |
key, | |||
value | |||
) |
Append NameValue data to PortProfile's properties.
Append NameValue data to PortProfile's properties.
key | The name of properties |
value | The value of properties |
void appendProperty(const char* key, const char* value)
def OpenRTM_aist.PortBase.PortBase.checkPorts | ( | self, | |
ports | |||
) |
Existence of ports.
ports | Checked ports |
bool checkPorts(::RTC::PortServiceList& ports)
def OpenRTM_aist.PortBase.PortBase.connect | ( | self, | |
connector_profile | |||
) |
[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. |
virtual ReturnCode_t connect(ConnectorProfile& connector_profile)
def OpenRTM_aist.PortBase.PortBase.connectNext | ( | self, | |
connector_profile | |||
) |
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.
connector_profile | The connection profile information |
virtual ReturnCode_t connectNext(ConnectorProfile& connector_profile);
def OpenRTM_aist.PortBase.PortBase.deleteInterface | ( | self, | |
name, | |||
pol | |||
) |
Delete an interface 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) |
bool deleteInterface(const char* name, PortInterfacePolarity pol);
def OpenRTM_aist.PortBase.PortBase.disconnect | ( | self, | |
connector_id | |||
) |
[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. |
virtual ReturnCode_t disconnect(const char* connector_id)
def OpenRTM_aist.PortBase.PortBase.disconnect_all | ( | self | ) |
[CORBA interface] Connect the Port
This operation destroys all connection channels owned by the Port.
virtual ReturnCode_t disconnect_all()
def OpenRTM_aist.PortBase.PortBase.disconnectNext | ( | self, | |
connector_profile | |||
) |
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.
connector_profile | The connection profile information |
virtual ReturnCode_t disconnectNext(ConnectorProfile& connector_profile);
def OpenRTM_aist.PortBase.PortBase.eraseConnectorProfile | ( | self, | |
id_ | |||
) |
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. |
bool eraseConnectorProfile(const char* id);
def OpenRTM_aist.PortBase.PortBase.findConnProfile | ( | self, | |
id_ | |||
) |
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 |
ConnectorProfile findConnProfile(const char* id);
def OpenRTM_aist.PortBase.PortBase.findConnProfileIndex | ( | self, | |
id_ | |||
) |
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 |
CORBA::Long findConnProfileIndex(const char* id);
def OpenRTM_aist.PortBase.PortBase.get_connector_profile | ( | self, | |
connector_id | |||
) |
[CORBA interface] Get the ConnectorProfile
This operation returns the ConnectorProfiles specified connector_id.
connector_id | ID of the ConnectorProfile |
ConnectorProfile* get_connector_profile(const char* connector_id)
def OpenRTM_aist.PortBase.PortBase.get_connector_profiles | ( | self | ) |
[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,
virtual ConnectorProfileList* get_connector_profiles()
def OpenRTM_aist.PortBase.PortBase.get_port_profile | ( | self | ) |
[CORBA interface] Get the PortProfile of the Port
This operation returns the PortProfile of the Port. PortProfile struct has the following members,
PortProfile* get_port_profile()
def OpenRTM_aist.PortBase.PortBase.getName | ( | self | ) |
Get the name of this Port.
const char* PortBase::getName() const
def OpenRTM_aist.PortBase.PortBase.getPortProfile | ( | self | ) |
Get the PortProfile of the Port.
This function is a const function that returns a const reference of the PortProfile stored in this Port.
PortProfile& getPortProfile() const;
def OpenRTM_aist.PortBase.PortBase.getPortRef | ( | self | ) |
Get the object reference of this Port.
This operation returns the object reference that is stored in the Port's PortProfile.
PortService_ptr getPortRef();
def OpenRTM_aist.PortBase.PortBase.getProfile | ( | self | ) |
Get the PortProfile of the Port.
This operation returns const reference of the PortProfile.
const PortProfile& getProfile() const;
def OpenRTM_aist.PortBase.PortBase.getUUID | ( | self | ) |
Get the UUID.
This operation generates UUID.
const std::string getUUID() const;
def OpenRTM_aist.PortBase.PortBase.isEmptyId | ( | self, | |
connector_profile | |||
) |
Whether connector_id of ConnectorProfile is empty.
bool isEmptyId(const ConnectorProfile& connector_profile) const;
def OpenRTM_aist.PortBase.PortBase.isExistingConnId | ( | self, | |
id_ | |||
) |
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 |
bool isExistingConnId(const char* id);
def OpenRTM_aist.PortBase.PortBase.notify_connect | ( | self, | |
connector_profile | |||
) |
[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. |
virtual ReturnCode_t notify_connect(ConnectorProfile& connector_profile)
def OpenRTM_aist.PortBase.PortBase.notify_disconnect | ( | self, | |
connector_id | |||
) |
[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. |
virtual ReturnCode_t notify_disconnect(const char* connector_id)
def OpenRTM_aist.PortBase.PortBase.publishInterfaces | ( | self, | |
connector_profile | |||
) |
Publish interface information.
This operation is pure virutal method 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 |
def OpenRTM_aist.PortBase.PortBase.setConnectionLimit | ( | self, | |
limit_value | |||
) |
Set the maximum number of connections.
limit_value | The maximum number of connections |
virtual void setConnectionLimit(int limit_value);
def OpenRTM_aist.PortBase.PortBase.setName | ( | self, | |
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. |
void setName(const char* name);
def OpenRTM_aist.PortBase.PortBase.setOnConnected | ( | self, | |
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 |
void setOnConnected(ConnectionCallback* on_connected);
def OpenRTM_aist.PortBase.PortBase.setOnDisconnected | ( | self, | |
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 |
void setOnDisconnected(ConnectionCallback* on_disconnected);
def OpenRTM_aist.PortBase.PortBase.setOnPublishInterfaces | ( | self, | |
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 |
void setOnPublishInterfaces(ConnectionCallback* on_publish);
def OpenRTM_aist.PortBase.PortBase.setOnSubscribeInterfaces | ( | self, | |
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 |
void setOnSubscribeInterfaces(ConnectionCallback* on_subscribe);
def OpenRTM_aist.PortBase.PortBase.setOnUnsubscribeInterfaces | ( | self, | |
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 |
void setOnUnsubscribeInterfaces(ConnectionCallback* on_subscribe);
def OpenRTM_aist.PortBase.PortBase.setOwner | ( | self, | |
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 |
void setOwner(RTObject_ptr owner);
def OpenRTM_aist.PortBase.PortBase.setPortConnectListenerHolder | ( | self, | |
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 |
void setPortConnectListenerHolder(PortConnectListeners* portconnListeners);
def OpenRTM_aist.PortBase.PortBase.setPortRef | ( | self, | |
port_ref | |||
) |
Set the object reference of this Port.
This operation sets the object reference itself to the Port's PortProfile.
The | object reference of this Port. |
void setPortRef(PortService_ptr port_ref);
def OpenRTM_aist.PortBase.PortBase.setUUID | ( | self, | |
connector_profile | |||
) |
Create and set the UUID to the ConnectorProfile.
This operation generates and set UUID to the ConnectorProfile.
connector_profile | ConnectorProfile to be set connector_id |
void setUUID(ConnectorProfile& connector_profile) const;
def OpenRTM_aist.PortBase.PortBase.subscribeInterfaces | ( | self, | |
connector_profile | |||
) |
Publish interface information.
This operation is pure virutal method 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 |
def OpenRTM_aist.PortBase.PortBase.unsubscribeInterfaces | ( | self, | |
connector_profile | |||
) |
Disconnect interface connection.
This operation is pure virutal method that would be called at the end of the notify_disconnect() process sequence. In the notify_disconnect(), the following methods would be called.
connector_profile | The connection profile information |
def OpenRTM_aist.PortBase.PortBase.updateConnectorProfile | ( | self, | |
connector_profile | |||
) |
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 |
void updateConnectorProfile(const ConnectorProfile& connector_profile);
def OpenRTM_aist.PortBase.PortBase.updateConnectors | ( | self | ) |
Disconnect ports that doesn't exist.
void updateConnectors()