20 #ifndef RTC_PORTBASE_H 21 #define RTC_PORTBASE_H 26 #include <rtm/idl/RTCSkel.h> 37 class ConnectionCallback;
130 :
public virtual POA_RTC::PortService,
131 public virtual PortableServer::RefCountServantBase
159 explicit PortBase(
const char* name =
"");
512 ReturnCode_t
connect(ConnectorProfile& connector_profile)
override;
629 ReturnCode_t
notify_connect(ConnectorProfile& connector_profile)
override;
696 ReturnCode_t
disconnect(
const char* connector_id)
override;
867 void setName(
const char* name);
1346 virtual ReturnCode_t
1375 virtual ReturnCode_t
connectNext(ConnectorProfile& connector_profile);
1468 virtual ReturnCode_t
1578 static bool isEmptyId(
const ConnectorProfile& connector_profile) ;
1599 static std::string
getUUID() ;
1620 static void setUUID(ConnectorProfile& connector_profile) ;
1819 bool appendInterface(
const char* instance_name,
const char* type_name,
1820 PortInterfacePolarity pol);
1876 template <
class ValueType>
1957 #ifndef ORB_IS_RTORB 1958 bool checkPorts(::RTC::PortServiceList& ports);
1959 #else // ORB_IS_RTORB 1961 #endif // ORB_IS_RTORB 1965 RTC::ConnectorProfile& profile)
1975 RTC::ConnectorProfile& profile)
1984 RTC::ConnectorProfile& profile)
1994 RTC::ConnectorProfile& profile,
2006 RTC::ConnectorProfile& profile,
2018 RTC::ConnectorProfile& profile,
2030 RTC::ConnectorProfile& profile,
2041 RTC::ConnectorProfile& profile,
2052 RTC::ConnectorProfile& profile,
2256 return m_id == std::string(cprof.connector_id);
2271 #ifdef ORB_IS_ORBEXPRESS 2274 return m_port->_is_equivalent(port_ref.in());
2279 return m_port->_is_equivalent(port_ref);
2295 : m_name(name), m_pol(pol)
2300 CORBA::String_var name(CORBA::string_dup(prof.instance_name));
2301 return ((m_name == static_cast<const char *>(name))
2302 && (m_pol == prof.polarity));
2310 #endif // RTC_PORTBASE_H SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
Definition: NVUtil.h:80
void setOnSubscribeInterfaces(ConnectionCallback *on_subscribe)
Setting callback called on publish interfaces.
void onPublishInterfaces(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:1993
virtual ReturnCode_t _publishInterfaces()
Publish interface information.
PortInterfacePolarity m_pol
Definition: PortBase.h:2305
std::mutex m_connectorsMutex
Definition: PortBase.h:2115
std::string m_ownerInstanceName
Instance name.
Definition: PortBase.h:2124
bool operator()(const PortInterfaceProfile &prof)
Definition: PortBase.h:2298
ConnectionCallback * m_onSubscribeInterfaces
Callback functor objects.
Definition: PortBase.h:2163
virtual DirectPortBase * getDirectPort()
ConnectionCallback * m_onUnsubscribeInterfaces
Callback functor objects.
Definition: PortBase.h:2192
void onNotifyConnect(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1964
RT component logger class.
void onDisconnectNextport(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2040
find_interface(const char *name, PortInterfacePolarity pol)
Definition: PortBase.h:2294
Functor to find a ConnectorProfile named id.
Definition: PortBase.h:2251
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
Append the specified string to element of NVList.
void setOnPublishInterfaces(ConnectionCallback *on_publish)
Setting callback called on publish interfaces.
ConnectionCallback * m_onDisconnected
Callback functor objects.
Definition: PortBase.h:2206
void onDisconnected(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2051
void setOnConnected(ConnectionCallback *on_connected)
Setting callback called on connection established.
virtual void setConnectionLimit(int limit_value)
Set the maximum number of connections.
bool appendInterface(const char *instance_name, const char *type_name, PortInterfacePolarity pol)
Append an interface to the PortInterfaceProfile.
void setOwner(RTObject_ptr owner)
Set the owner RTObject of the Port.
bool deleteInterface(const char *name, PortInterfacePolarity pol)
Delete the interface registration from the PortInterfaceProfile.
PortService_ptr getPortRef() const
Get the object reference of this Port.
virtual ReturnCode_t connectNext(ConnectorProfile &connector_profile)
Call notify_connect() of the next Port.
bool operator()(PortService_ptr port_ref)
Definition: PortBase.h:2277
const PortProfile & getProfile() const
Get the PortProfile of the Port.
virtual ReturnCode_t disconnectNext(ConnectorProfile &cprof)
Call notify_disconnect() of the next Port.
Functor to find interface from name and polarity.
Definition: PortBase.h:2292
static bool isEmptyId(const ConnectorProfile &connector_profile)
Check whether connector_id of ConnectorProfile is empty.
std::string m_id
Definition: PortBase.h:2258
virtual void activateInterfaces()=0
Activate all Port interfaces.
void setPortRef(PortService_ptr port_ref)
Set the object reference of this Port.
ReturnCode_t connect(ConnectorProfile &connector_profile) override
[CORBA interface] Connect the Port
bool operator()(const ConnectorProfile &cprof)
Definition: PortBase.h:2254
Definition: DirectPortBase.h:46
void setOnUnsubscribeInterfaces(ConnectionCallback *on_unsubscribe)
Setting callback called on unsubscribe interfaces.
void onConnectNextport(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2005
coil::Properties m_properties
Properties.
Definition: PortBase.h:1919
PortProfile * get_port_profile() override
[CORBA interface] Get the PortProfile of the Port
static void setUUID(ConnectorProfile &connector_profile)
Generate and set the UUID to the ConnectorProfile.
const PortProfile & getPortProfile() const
Get the PortProfile of the Port.
void appendProperty(const char *key, const char *value)
Append NameValue data to PortProfile's properties.
Definition: PortBase.h:1908
ReturnCode_t disconnect_all() override
[CORBA interface] Disconnect the All Ports
ConnectionCallback * m_onConnected
Callback functor objects.
Definition: PortBase.h:2178
Port base class.
Definition: PortBase.h:129
void setPortConnectListenerHolder(PortConnectListeners *portconnListeners)
Setting PortConnectListener holder.
PortService_ptr m_port
Definition: PortBase.h:2282
const char * getName() const
Get the name of this Port.
PortConnectListeners class.
Definition: PortConnectListener.h:486
std::string m_name
Definition: PortBase.h:2304
ConnectorProfileList * get_connector_profiles() override
[CORBA interface] Get the ConnectorProfileList of the Port
NameValue and NVList utility functions.
bool isExistingMarshalingType(coil::Properties &con_prop)
Whether the specified serializer can be used.
PortBase(const char *name="")
Constructor.
CORBA sequence utility template functions.
ConnectorProfile * get_connector_profile(const char *connector_id) override
[CORBA interface] Get the ConnectorProfile
void onConnected(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2029
DirectPortBase * m_directport
Definition: PortBase.h:2239
CORBA::Long findConnProfileIndex(const char *id)
Find ConnectorProfile with id.
Logger class.
Definition: SystemLogger.h:99
void setOnConnectionLost(ConnectionCallback *on_connection_lost)
Setting callback called on connection lost.
ReturnCode_t notify_disconnect(const char *connector_id) override
[CORBA interface] Notify the Ports disconnection
~PortBase() override
Destructor.
virtual void unsubscribeInterfaces(const ConnectorProfile &connector_profile)=0
Disconnect interface connection.
void updateConnectors()
Disconnect ports that doesn't exist.
PortProfile m_profile
PortProfile of the Port.
Definition: PortBase.h:2097
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)=0
Publish interface information.
PortConnectListeners * m_portconnListeners
PortConnectListener holder.
Definition: PortBase.h:2237
bool eraseConnectorProfile(const char *id)
Delete the ConnectorProfile.
find_conn_id(const char *id)
Definition: PortBase.h:2253
ReturnCode_t disconnect(const char *connector_id) override
[CORBA interface] Disconnect the Port
void onUnsubscribeInterfaces(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1983
bool isExistingConnId(const char *id)
Check whether the given id exists in stored ConnectorProfiles.
virtual void deactivateInterfaces()=0
Deactivate all Port interfaces.
virtual ReturnCode_t subscribeInterfaces(const ConnectorProfile &connector_profile)=0
Publish interface information.
void onSubscribeInterfaces(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2017
void onNotifyDisconnect(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1974
int m_connectionLimit
The maximum number of connections.
Definition: PortBase.h:2133
RTC::PortService_var m_objref
Object Reference of the Port.
Definition: PortBase.h:2106
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
Definition: CORBA_SeqUtil.h:175
static std::string getUUID()
Generate the UUID.
ConnectionCallback * m_onConnectionLost
Callback functor objects.
Definition: PortBase.h:2222
find_port_ref(PortService_ptr port_ref)
Definition: PortBase.h:2270
void addProperty(const char *key, ValueType value)
Add NameValue data to PortProfile's properties.
Definition: PortBase.h:1877
ConnectionCallback * m_onPublishInterfaces
Callback functor objects.
Definition: PortBase.h:2149
ReturnCode_t notify_connect(ConnectorProfile &connector_profile) override
[CORBA interface] Notify the Ports connection
bool checkPorts(::RTC::PortServiceList &ports)
Existence of ports.
coil::Properties Properties
Definition: RTC.h:72
Functor to find the object reference that is identical port_ref.
Definition: PortBase.h:2268
void updateConnectorProfile(const ConnectorProfile &connector_profile)
Append or update the ConnectorProfile list.
Callback functor abstract for connect/notify_connect() funcs.
Definition: PortCallback.h:55
void setName(const char *name)
Set the name of this Port.
std::mutex m_profile_mutex
Mutex of PortProfile.
Definition: PortBase.h:2114
ConnectorProfile findConnProfile(const char *id)
Find ConnectorProfile with id.
port's internal action listener classes
void setOnDisconnected(ConnectionCallback *on_disconnected)
Setting callback called on disconnected.
Logger rtclog
Logger stream.
Definition: PortBase.h:2089
bool notify(PortConnectListenerType type, const char *portname, RTC::ConnectorProfile &profile)
Definition: PortConnectListener.h:625