Go to the documentation of this file.
20 #ifndef RTC_PORTBASE_H
21 #define RTC_PORTBASE_H
29 #include <rtm/idl/RTCSkel.h>
38 #pragma warning( disable : 4290 )
43 class ConnectionCallback;
136 :
public virtual POA_RTC::PortService,
137 public virtual PortableServer::RefCountServantBase
238 throw (CORBA::SystemException);
320 throw (CORBA::SystemException);
362 throw (CORBA::SystemException);
521 virtual ReturnCode_t
connect(ConnectorProfile& connector_profile)
522 throw (CORBA::SystemException);
639 virtual ReturnCode_t
notify_connect(ConnectorProfile& connector_profile)
640 throw (CORBA::SystemException);
707 virtual ReturnCode_t
disconnect(
const char* connector_id)
708 throw (CORBA::SystemException);
799 throw (CORBA::SystemException);
821 throw (CORBA::SystemException);
881 void setName(
const char* name);
1360 virtual ReturnCode_t
1389 virtual ReturnCode_t
connectNext(ConnectorProfile& connector_profile);
1417 virtual ReturnCode_t
disconnectNext(ConnectorProfile& connector_profile);
1482 virtual ReturnCode_t
1592 bool isEmptyId(
const ConnectorProfile& connector_profile)
const;
1613 const std::string
getUUID()
const;
1634 void setUUID(ConnectorProfile& connector_profile)
const;
1834 PortInterfacePolarity pol);
1890 template <
class ValueType>
1971 #ifndef ORB_IS_RTORB
1972 bool checkPorts(::RTC::PortServiceList& ports);
1973 #else // ORB_IS_RTORB
1975 #endif // ORB_IS_RTORB
1979 RTC::ConnectorProfile& profile)
1989 RTC::ConnectorProfile& profile)
1998 RTC::ConnectorProfile& profile)
2008 RTC::ConnectorProfile& profile,
2020 RTC::ConnectorProfile& profile,
2032 RTC::ConnectorProfile& profile,
2044 RTC::ConnectorProfile& profile,
2050 portconnret_[
ON_CONNECTED].notify(portname, profile, ret);
2055 RTC::ConnectorProfile& profile,
2066 RTC::ConnectorProfile& profile,
2252 return m_id == std::string(cprof.connector_id);
2269 return m_port->_is_equivalent(port_ref);
2289 CORBA::String_var name(CORBA::string_dup(prof.instance_name));
2290 return ((
m_name == (
const char *)name) && (
m_pol == prof.polarity));
2299 #pragma warning( default : 4290 )
2302 #endif // RTC_PORTBASE_H
void onSubscribeInterfaces(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2031
@ ON_CONNECT_NEXTPORT
Definition: PortConnectListener.h:164
virtual ReturnCode_t _publishInterfaces(void)
Publish interface information.
@ ON_NOTIFY_CONNECT
Definition: PortConnectListener.h:51
@ ON_DISCONNECT_NEXT
Definition: PortConnectListener.h:167
void onDisconnectNextport(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2054
void onNotifyConnect(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1978
virtual void deactivateInterfaces()=0
Deactivate all Port interfaces.
void setOnConnectionLost(ConnectionCallback *on_connection_lost)
Setting callback called on connection lost.
virtual ReturnCode_t connect(ConnectorProfile &connector_profile)
[CORBA interface] Connect the Port
void onDisconnected(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2065
void setOnPublishInterfaces(ConnectionCallback *on_publish)
Setting callback called on publish interfaces.
@ ON_PUBLISH_INTERFACES
Definition: PortConnectListener.h:163
Mutex class.
Definition: Mutex.h:40
int m_connectionLimit
The maximum number of connections.
Definition: PortBase.h:2129
virtual void setConnectionLimit(int limit_value)
Set the maximum number of connections.
ConnectionCallback * m_onConnectionLost
Callback functor objects.
Definition: PortBase.h:2218
void setPortConnectListenerHolder(PortConnectListeners *portconnListeners)
Setting PortConnectListener holder.
ConnectionCallback * m_onPublishInterfaces
Callback functor objects.
Definition: PortBase.h:2145
virtual void unsubscribeInterfaces(const ConnectorProfile &connector_profile)=0
Disconnect interface connection.
virtual ConnectorProfile * get_connector_profile(const char *connector_id)
[CORBA interface] Get the ConnectorProfile
bool isExistingConnId(const char *id)
Check whether the given id exists in stored ConnectorProfiles.
PortConnectListeners * m_portconnListeners
PortConnectListener holder.
Definition: PortBase.h:2233
void appendProperty(const char *key, const char *value)
Append NameValue data to PortProfile's properties.
Definition: PortBase.h:1922
bool eraseConnectorProfile(const char *id)
Delete the ConnectorProfile.
PortService_ptr m_port
Definition: PortBase.h:2271
const std::string getUUID() const
Generate the UUID.
virtual void activateInterfaces()=0
Activate all Port interfaces.
void onNotifyDisconnect(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1988
RTC::PortService_var m_objref
Object Reference of the Port.
Definition: PortBase.h:2101
find_interface(const char *name, PortInterfacePolarity pol)
Definition: PortBase.h:2283
Functor to find interface from name and polarity.
Definition: PortBase.h:2281
DirectPortBase * m_directport
Definition: PortBase.h:2235
void onUnsubscribeInterfaces(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1997
find_conn_id(const char *id)
Definition: PortBase.h:2249
bool appendInterface(const char *name, const char *type_name, PortInterfacePolarity pol)
Append an interface to the PortInterfaceProfile.
ConnectionCallback * m_onUnsubscribeInterfaces
Callback functor objects.
Definition: PortBase.h:2188
bool operator()(const PortInterfaceProfile &prof)
Definition: PortBase.h:2287
CORBA sequence utility template functions.
ConnectionCallback * m_onDisconnected
Callback functor objects.
Definition: PortBase.h:2202
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
Definition: CORBA_SeqUtil.h:175
bool deleteInterface(const char *name, PortInterfacePolarity pol)
Delete the interface registration from the PortInterfaceProfile.
void onPublishInterfaces(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2007
coil::Guard< coil::Mutex > Guard
Definition: PortBase.h:2111
find_port_ref(PortService_ptr port_ref)
Definition: PortBase.h:2266
@ ON_NOTIFY_DISCONNECT
Definition: PortConnectListener.h:52
void setOnDisconnected(ConnectionCallback *on_disconnected)
Setting callback called on disconnected.
Callback functor abstract for connect/notify_connect() funcs.
Definition: PortCallback.h:55
@ ON_CONNECTED
Definition: PortConnectListener.h:166
Definition: DirectPortBase.h:46
PortConnectListeners class.
Definition: PortConnectListener.h:487
bool operator()(PortService_ptr port_ref)
Definition: PortBase.h:2267
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
Definition: NVUtil.h:79
virtual ReturnCode_t notify_disconnect(const char *connector_id)
[CORBA interface] Notify the Ports disconnection
void updateConnectorProfile(const ConnectorProfile &connector_profile)
Append or update the ConnectorProfile list.
coil::Properties m_properties
Properties.
Definition: PortBase.h:1933
virtual ReturnCode_t disconnect_all()
[CORBA interface] Disconnect the All Ports
Functor to find a ConnectorProfile named id.
Definition: PortBase.h:2247
virtual ReturnCode_t disconnectNext(ConnectorProfile &connector_profile)
Call notify_disconnect() of the next Port.
void setOnSubscribeInterfaces(ConnectionCallback *on_subscribe)
Setting callback called on publish interfaces.
const PortProfile & getPortProfile() const
Get the PortProfile of the Port.
coil::Mutex m_profile_mutex
Mutex of PortProfile.
Definition: PortBase.h:2109
Logger class.
Definition: SystemLogger.h:99
@ ON_SUBSCRIBE_INTERFACES
Definition: PortConnectListener.h:165
Functor to find the object reference that is identical port_ref.
Definition: PortBase.h:2264
const char * getName() const
Get the name of this Port.
virtual ReturnCode_t connectNext(ConnectorProfile &connector_profile)
Call notify_connect() of the next Port.
std::string m_ownerInstanceName
Instance name.
Definition: PortBase.h:2120
void addProperty(const char *key, ValueType value)
Add NameValue data to PortProfile's properties.
Definition: PortBase.h:1891
PortService_ptr getPortRef() const
Get the object reference of this Port.
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
Append the specified string to element of NVList.
Class represents a set of properties.
Definition: Properties.h:101
port's internal action listener classes
Port base class.
Definition: PortBase.h:135
Logger rtclog
Logger stream.
Definition: PortBase.h:2084
virtual ReturnCode_t subscribeInterfaces(const ConnectorProfile &connector_profile)=0
Publish interface information.
void onConnectNextport(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2019
virtual ConnectorProfileList * get_connector_profiles()
[CORBA interface] Get the ConnectorProfileList of the Port
NameValue and NVList utility functions.
void setPortRef(PortService_ptr port_ref)
Set the object reference of this Port.
virtual ~PortBase(void)
Destructor.
void onConnected(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2043
ConnectionCallback * m_onSubscribeInterfaces
Callback functor objects.
Definition: PortBase.h:2159
void updateConnectors()
Disconnect ports that doesn't exist.
coil::Mutex m_connectorsMutex
Definition: PortBase.h:2110
void setUUID(ConnectorProfile &connector_profile) const
Generate and set the UUID to the ConnectorProfile.
PortInterfacePolarity m_pol
Definition: PortBase.h:2293
virtual ReturnCode_t disconnect(const char *connector_id)
[CORBA interface] Disconnect the Port
std::string m_id
Definition: PortBase.h:2254
ConnectionCallback * m_onConnected
Callback functor objects.
Definition: PortBase.h:2174
const PortProfile & getProfile() const
Get the PortProfile of the Port.
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)=0
Publish interface information.
virtual DirectPortBase * getDirectPort()
ConnectorProfile findConnProfile(const char *id)
Find ConnectorProfile with id.
bool checkPorts(::RTC::PortServiceList &ports)
Existence of ports.
@ ON_DISCONNECTED
Definition: PortConnectListener.h:168
void setName(const char *name)
Set the name of this Port.
virtual PortProfile * get_port_profile()
[CORBA interface] Get the PortProfile of the Port
virtual ReturnCode_t notify_connect(ConnectorProfile &connector_profile)
[CORBA interface] Notify the Ports connection
bool operator()(const ConnectorProfile &cprof)
Definition: PortBase.h:2250
void setOwner(RTObject_ptr owner)
Set the owner RTObject of the Port.
std::string m_name
Definition: PortBase.h:2292
PortBase(const char *name="")
Constructor.
@ ON_UNSUBSCRIBE_INTERFACES
Definition: PortConnectListener.h:53
void setOnUnsubscribeInterfaces(ConnectionCallback *on_subscribe)
Setting callback called on unsubscribe interfaces.
void setOnConnected(ConnectionCallback *on_connected)
Setting callback called on connection established.
bool isEmptyId(const ConnectorProfile &connector_profile) const
Check whether connector_id of ConnectorProfile is empty.
RT component logger class.
CORBA::Long findConnProfileIndex(const char *id)
Find ConnectorProfile with id.
PortProfile m_profile
PortProfile of the Port.
Definition: PortBase.h:2092