Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

RTC::PortBase Class Reference

#include <PortBase.h>

Inheritance diagram for RTC::PortBase:

RTC::CorbaPort RTC::DataInPort RTC::DataOutPort List of all members.

Public Member Functions

 PortBase (const char *name="")
 Constructor.
virtual ~PortBase ()
 Destructor.
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)=0
 Publish interface information.
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.
virtual ReturnCode_t subscribeInterfaces (const ConnectorProfile &connector_profile)=0
 Publish interface information.
virtual void unsubscribeInterfaces (const ConnectorProfile &connector_profile)=0
 Disconnect interface connection.
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  connect_func
 A functor to connect Ports. More...
struct  disconnect_all_func
 A functor to disconnect all Ports. More...
struct  disconnect_func
 A functor to disconnect Ports. More...
struct  find_conn_id
 A functor to find a ConnectorProfile named id. More...
struct  find_interface
 A functor to find interface from name and polarity. More...
struct  find_port_ref
 A functor to find the object reference that is identical port_ref. More...
struct  if_name
 A functor to find a PortInterfaceProfile named instance_name. More...

Member Typedef Documentation

typedef ACE_Guard<ACE_Recursive_Thread_Mutex> RTC::PortBase::Guard [protected]
 


Constructor & Destructor Documentation

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.

Parameters:
name The name of Port

virtual RTC::PortBase::~PortBase  )  [virtual]
 

Destructor.


Member Function Documentation

template<class ValueType>
void RTC::PortBase::addProperty const char *  key,
ValueType  value
[inline, protected]
 

Add NameValue data to PortProfile's properties.

Parameters:
ValueType The type of value
key The name of properties
value The value of properties

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.

Parameters:
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)
Returns:
false would be returned if the same name is already registered.

virtual ReturnCode_t RTC::PortBase::connect ConnectorProfile &  connector_profile  )  [virtual]
 

[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.

Parameters:
connector_profile The ConnectorProfile.
Returns:
ReturnCode_t The return code of this operation.

virtual ReturnCode_t RTC::PortBase::connectNext ConnectorProfile &  connector_profile  )  [protected, virtual]
 

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.

Parameters:
connector_profile The connection profile information
Returns:
The return code of ReturnCode_t type.

bool RTC::PortBase::deleteInterface const char *  name,
PortInterfacePolarity  pol
[protected]
 

Delete an interface from the PortInterfaceProfile.

This operation deletes interface information from the PortInterfaceProfile that is owned by the Port.

Parameters:
name The instance name of the interface.
pol The interface's polarity (RTC::PROVIDED or RTC:REQUIRED)
Returns:
false would be returned if the given name is not registered.

virtual ReturnCode_t RTC::PortBase::disconnect const char *  connector_id  )  [virtual]
 

[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.

Parameters:
connector_id The ID of the ConnectorProfile.
Returns:
ReturnCode_t The return code of this operation.

virtual ReturnCode_t RTC::PortBase::disconnect_all  )  [virtual]
 

[CORBA interface] Connect the Port

This operation destroys all connection channels owned by the Port.

Returns:
ReturnCode_t The return code of this operation.

virtual ReturnCode_t RTC::PortBase::disconnectNext ConnectorProfile &  connector_profile  )  [protected, virtual]
 

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.

Parameters:
connector_profile The connection profile information
Returns:
The return code of ReturnCode_t type.

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.

Parameters:
id The id of the ConnectorProfile to be deleted.

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.

Parameters:
id the connector_id to be searched in Port's ConnectorProfiles
Returns:
CoonectorProfile with connector_id

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, empty ConnectorProfile is returned.

Parameters:
id the connector_id to be searched in Port's ConnectorProfiles
Returns:
The index of ConnectorProfile of the Port

virtual ConnectorProfile* RTC::PortBase::get_connector_profile const char *  connector_id  )  [virtual]
 

[CORBA interface] Get the ConnectorProfile

This operation returns the ConnectorProfiles specified connector_id.

Parameters:
connector_id ID of the ConnectorProfile
Returns:
the ConnectorProfile identified by the connector_id

virtual ConnectorProfileList* RTC::PortBase::get_connector_profiles  )  [virtual]
 

[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,

  • name [string] The name of the connection.
  • connector_id [string] Unique identifier.
  • ports [Port sequnce] The sequence of Port's object reference that are related the connection.
  • properties [NVList] The other properties.

Returns:
the ConnectorProfileList of the Port

virtual PortProfile* RTC::PortBase::get_port_profile  )  [virtual]
 

[CORBA interface] Get the PortProfile of the Port

This operation returns the PortProfile of the Port. PortProfile struct has the following members,

  • name [string ] The name of the Port.
  • interfaces [PortInterfaceProfileList ·¿] The sequence of PortInterfaceProfile owned by the Port
  • port_ref [Port Object] The object reference of the Port.
  • connector_profile [ConnectorProfileList ·¿] The sequence of ConnectorProfile owned by the Port.
  • owner [RTObject Object] The object reference of RTObject that is owner of the Port.
  • properties [NVList] The other properties.

Returns:
the PortProfile of the Port

const PortProfile& RTC::PortBase::getPortProfile  )  const
 

Port_ptr RTC::PortBase::getPortRef  ) 
 

Get the object reference of this Port.

This operation returns the object reference that is stored in the Port's PortProfile.

Returns:
The object reference of this Port.

const PortProfile& RTC::PortBase::getProfile  )  const
 

Get the PortProfile of the Port.

This operation returns const reference of the PortProfile.

Returns:
the PortProfile of the Port

const std::string RTC::PortBase::getUUID  )  const [protected]
 

Get the UUID.

This operation generates UUID.

Returns:
uuid

bool RTC::PortBase::isEmptyId const ConnectorProfile &  connector_profile  )  const [protected]
 

Whether connector_id of ConnectorProfile is empty.

Returns:
If the given ConnectorProfile's connector_id is empty string, it returns true.

bool RTC::PortBase::isExistingConnId const char *  id  )  [protected]
 

Whether the given id exists in stored ConnectorProfiles.

This operation returns boolean whether the given id exists in the Port's ConnectorProfiles.

Parameters:
id connector_id to be find in Port's ConnectorProfiles

virtual ReturnCode_t RTC::PortBase::notify_connect ConnectorProfile &  connector_profile  )  [virtual]
 

[CORBA interface] Notify the Ports connection

This operation is invoked between Ports internally when the connection is established.

Parameters:
connector_profile The ConnectorProfile.
Returns:
ReturnCode_t The return code of this operation.

virtual ReturnCode_t RTC::PortBase::notify_disconnect const char *  connector_id  )  [virtual]
 

[CORBA interface] Notify the Ports disconnection

This operation is invoked between Ports internally when the connection is destroied.

Parameters:
connector_id The ID of the ConnectorProfile.
Returns:
ReturnCode_t The return code of this operation.

virtual ReturnCode_t RTC::PortBase::publishInterfaces ConnectorProfile &  connector_profile  )  [protected, pure virtual]
 

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.

Parameters:
connector_profile The connection profile information
Returns:
The return code of ReturnCode_t type.

Implemented in RTC::CorbaPort, RTC::DataInPort, and RTC::DataOutPort.

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.

Parameters:
name The name of this Port.

void RTC::PortBase::setOwner RTObject_ptr  owner  ) 
 

Set the owner RTObject of the Port.

This operation sets the owner RTObject of this Port.

Parameters:
owner The owner RTObject's reference of this Port

void RTC::PortBase::setPortRef Port_ptr  port_ref  ) 
 

Set the object reference of this Port.

This operation sets the object reference itself to the Port's PortProfile.

Parameters:
The object reference of this Port.

void RTC::PortBase::setUUID ConnectorProfile &  connector_profile  )  const [protected]
 

Create and set the UUID to the ConnectorProfile.

This operation generates and set UUID to the ConnectorProfile.

Parameters:
connector_profile ConnectorProfile to be set connector_id

virtual ReturnCode_t RTC::PortBase::subscribeInterfaces const ConnectorProfile &  connector_profile  )  [protected, pure virtual]
 

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.

Parameters:
connector_profile The connection profile information
Returns:
The return code of ReturnCode_t type.

Implemented in RTC::CorbaPort, RTC::DataInPort, and RTC::DataOutPort.

virtual void RTC::PortBase::unsubscribeInterfaces const ConnectorProfile &  connector_profile  )  [protected, pure virtual]
 

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.

Parameters:
connector_profile The connection profile information

Implemented in RTC::CorbaPort, RTC::DataInPort, and RTC::DataOutPort.

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.

Parameters:
connector_profile the ConnectorProfile to be appended or updated


Member Data Documentation

RTC::Port_var RTC::PortBase::m_objref [protected]
 

PortProfile RTC::PortBase::m_profile [protected]
 

PortProfile of the Port.

ACE_Recursive_Thread_Mutex RTC::PortBase::m_profile_mutex [mutable, protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Oct 5 05:16:05 2007 for OpenRTM by  doxygen 1.4.1