PortBase.cpp
Go to the documentation of this file.
1 // -*- C++ -*-
20 #include <assert.h>
21 #include <memory>
22 #include <coil/UUID.h>
23 #include <rtm/PortBase.h>
24 #include <rtm/PortCallback.h>
25 
26 namespace RTC
27 {
28  //============================================================
29  // class PortBase
30  //============================================================
38  PortBase::PortBase(const char* name)
39  : rtclog(name),
40  m_ownerInstanceName("unknown"),
41  m_connectionLimit(-1),
42  m_onPublishInterfaces(0),
43  m_onSubscribeInterfaces(0),
44  m_onConnected(0),
45  m_onUnsubscribeInterfaces(0),
46  m_onDisconnected(0),
47  m_onConnectionLost(0),
48  m_portconnListeners(NULL)
49  {
50  m_objref = this->_this();
51  // Now Port name is <instance_name>.<port_name>. r1648
52  std::string portname(m_ownerInstanceName);
53  portname += ".";
54  portname += name;
55 
56  m_profile.name = CORBA::string_dup(portname.c_str());
57  m_profile.interfaces.length(0);
58  m_profile.port_ref = m_objref;
59  m_profile.connector_profiles.length(0);
60  m_profile.owner = RTC::RTObject::_nil();
61  m_profile.properties.length(0);
62  }
63 
72  {
73  RTC_TRACE(("~PortBase()"));
74  try
75  {
76  PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
77  _default_POA()->deactivate_object(oid);
78  }
79  catch (PortableServer::POA::ServantNotActive &e)
80  {
81  RTC_ERROR(("%s", e._name()));
82  }
83  catch (PortableServer::POA::WrongPolicy &e)
84  {
85  RTC_ERROR(("%s", e._name()));
86  }
87  catch (...)
88  {
89  RTC_ERROR(("Unknown exception caught."));
90  }
91  }
92 
101  throw (CORBA::SystemException)
102  {
103  RTC_TRACE(("get_port_profile()"));
104 
106  Guard gaurd(m_profile_mutex);
107  PortProfile_var prof;
108  prof = new PortProfile(m_profile);
109  return prof._retn();
110  }
111 
119  const PortProfile& PortBase::getPortProfile() const
120  {
121  RTC_TRACE(("getPortProfile()"));
122 
123  return m_profile;
124  }
125 
134  throw (CORBA::SystemException)
135  {
136  RTC_TRACE(("get_connector_profiles()"));
137 
139 
140  Guard gaurd(m_profile_mutex);
141  ConnectorProfileList_var conn_prof;
142  conn_prof = new ConnectorProfileList(m_profile.connector_profiles);
143  return conn_prof._retn();
144  }
145 
153  ConnectorProfile* PortBase::get_connector_profile(const char* connector_id)
154  throw (CORBA::SystemException)
155  {
156  RTC_TRACE(("get_connector_profile(%s)", connector_id));
157 
159 
160  Guard gaurd(m_profile_mutex);
161  CORBA::Long index(findConnProfileIndex(connector_id));
162 
163  if (index < 0)
164  {
165  ConnectorProfile_var conn_prof;
166  conn_prof = new ConnectorProfile();
167  return conn_prof._retn();
168  }
169  ConnectorProfile_var conn_prof;
170  conn_prof = new ConnectorProfile(m_profile.connector_profiles[index]);
171  return conn_prof._retn();
172  }
173 
181  ReturnCode_t PortBase::connect(ConnectorProfile& connector_profile)
182  throw (CORBA::SystemException)
183  {
184  RTC_TRACE(("connect()"));
185  if (isEmptyId(connector_profile))
186  {
187  Guard gurad(m_profile_mutex);
188  // "connector_id" stores UUID which is generated at the initial Port
189  // in connection process.
190  setUUID(connector_profile);
191  assert(!isExistingConnId(connector_profile.connector_id));
192  }
193  else
194  {
195  Guard gurad(m_profile_mutex);
196  if (isExistingConnId(connector_profile.connector_id))
197  {
198  RTC_ERROR(("Connection already exists."));
200  }
201  }
202 
203  try
204  {
205  RTC::PortService_ptr p;
206  p = connector_profile.ports[(CORBA::ULong)0];
207  ReturnCode_t ret = p->notify_connect(connector_profile);
208  if (ret != RTC::RTC_OK)
209  {
210  RTC_ERROR(("Connection failed. cleanup."));
211  disconnect(connector_profile.connector_id);
212  }
213  return ret;
214  }
215  catch (...)
216  {
217  return RTC::BAD_PARAMETER;
218  }
219  return RTC::RTC_ERROR;
220  }
221 
229  ReturnCode_t PortBase::notify_connect(ConnectorProfile& connector_profile)
230  throw (CORBA::SystemException)
231  {
232  RTC_TRACE(("notify_connect()"));
233  Guard guard(m_connectorsMutex);
234  ReturnCode_t retval[] = {RTC::RTC_OK, RTC::RTC_OK, RTC::RTC_OK};
235 
236  onNotifyConnect(getName(), connector_profile);
237 
238  // publish owned interface information to the ConnectorProfile
239  retval[0] = publishInterfaces(connector_profile);
240  if (retval[0] != RTC::RTC_OK)
241  {
242  RTC_ERROR(("publishInterfaces() in notify_connect() failed."));
243  }
244  onPublishInterfaces(getName(), connector_profile, retval[0]);
245  if (m_onPublishInterfaces != 0)
246  {
247  (*m_onPublishInterfaces)(connector_profile);
248  }
249 
250 
251  // call notify_connect() of the next Port
252  retval[1] = connectNext(connector_profile);
253  if (retval[1] != RTC::RTC_OK)
254  {
255  RTC_ERROR(("connectNext() in notify_connect() failed."));
256  }
257  onConnectNextport(getName(), connector_profile, retval[1]);
258 
259  // subscribe interface from the ConnectorProfile's information
260 
261  if (m_onSubscribeInterfaces != 0)
262  {
263  (*m_onSubscribeInterfaces)(connector_profile);
264  }
265 
266  retval[2] = subscribeInterfaces(connector_profile);
267  if (retval[2] != RTC::RTC_OK)
268  {
269  RTC_ERROR(("subscribeInterfaces() in notify_connect() failed."));
270  }
271  onSubscribeInterfaces(getName(), connector_profile, retval[2]);
272 
273  RTC_PARANOID(("%d connectors are existing",
274  m_profile.connector_profiles.length()));
275 
276  Guard gurad(m_profile_mutex);
277  CORBA::Long index(findConnProfileIndex(connector_profile.connector_id));
278  if (index < 0)
279  {
280  CORBA_SeqUtil::push_back(m_profile.connector_profiles,
281  connector_profile);
282  RTC_PARANOID(("New connector_id. Push backed."));
283  }
284  else
285  {
286  m_profile.connector_profiles[index] = connector_profile;
287  RTC_PARANOID(("Existing connector_id. Updated."));
288  }
289 
290  for (int i(0), len(sizeof(retval)/sizeof(ReturnCode_t)); i < len; ++i)
291  {
292  if (retval[i] != RTC::RTC_OK)
293  {
294  onConnected(getName(), connector_profile, retval[i]);
295  return retval[i];
296  }
297  }
298 
299  // connection established without errors
300  if (m_onConnected != 0)
301  {
302  (*m_onConnected)(connector_profile);
303  }
304  onConnected(getName(), connector_profile, RTC::RTC_OK);
305  return RTC::RTC_OK;
306  }
307 
316  {
317  if(!(m_connectionLimit < 0))
318  {
319  if((::CORBA::ULong)m_connectionLimit<=m_profile.connector_profiles.length())
320  {
321  RTC_PARANOID(("Connected number has reached the limitation."));
322  RTC_PARANOID(("Can connect the port up to %d ports.",
324  RTC_PARANOID(("%d connectors are existing",
325  m_profile.connector_profiles.length()));
326  return RTC::RTC_ERROR;
327  }
328  }
329  return RTC::RTC_OK;
330  }
331 
339  ReturnCode_t PortBase::disconnect(const char* connector_id)
340  throw (CORBA::SystemException)
341  {
342  RTC_TRACE(("disconnect(%s)", connector_id));
343 
344  CORBA::Long index(findConnProfileIndex(connector_id));
345  if (index < 0)
346  {
347  RTC_ERROR(("Invalid connector id: %s", connector_id));
348  return RTC::BAD_PARAMETER;
349  }
350 
351  ConnectorProfile prof;
352  { // lock and copy profile
353  Guard guard(m_profile_mutex);
354  prof = m_profile.connector_profiles[index];
355  }
356 
357  if (prof.ports.length() < 1)
358  {
359  RTC_FATAL(("ConnectorProfile has empty port list."));
361  }
362 
363  for (CORBA::ULong i(0), len(prof.ports.length()); i < len; ++i)
364  {
365  RTC::PortService_var p(prof.ports[i]);
366  try
367  {
368  return p->notify_disconnect(connector_id);
369  }
370  catch (CORBA::SystemException &e)
371  {
372 #ifndef ORB_IS_RTORB
373  RTC_WARN(("Exception caught: minor code(%d).", e.minor()));;
374 #else // ORB_IS_RTORB
375  RTC_WARN(("Exception caught"));
376 #endif // ORB_IS_RTORB
377  continue;
378  }
379  catch (...)
380  {
381  RTC_WARN(("Unknown exception caught."));;
382  continue;
383  }
384  }
385  RTC_ERROR(("notify_disconnect() for all ports failed."));
386  return RTC::RTC_ERROR;
387  }
388 
396  ReturnCode_t PortBase::notify_disconnect(const char* connector_id)
397  throw (CORBA::SystemException)
398  {
399  RTC_TRACE(("notify_disconnect(%s)", connector_id));
400  Guard guard(m_connectorsMutex);
401  Guard gaurd(m_profile_mutex);
402 
403  // find connector_profile
404  CORBA::Long index(findConnProfileIndex(connector_id));
405  if (index < 0)
406  {
407  RTC_ERROR(("Invalid connector id: %s", connector_id));
408  return RTC::BAD_PARAMETER;
409  }
410 
411  ConnectorProfile& prof(m_profile.connector_profiles[(CORBA::ULong)index]);
412  onNotifyDisconnect(getName(), prof);
413 
414  ReturnCode_t retval(disconnectNext(prof));
415  onDisconnectNextport(getName(), prof, retval);
416 
417  if (m_onUnsubscribeInterfaces != 0)
418  {
419  (*m_onUnsubscribeInterfaces)(prof);
420  }
422  unsubscribeInterfaces(prof);
423 
424  if (m_onDisconnected != 0)
425  {
426  (*m_onDisconnected)(prof);
427  }
428 // Why RtORB does not use CORBA_SeqUtil?
429 #ifndef ORB_IS_RTORB
430  CORBA_SeqUtil::erase(m_profile.connector_profiles, index);
431 #else // ORB_IS_RTORB
432  CORBA::ULong len(m_profile.connector_profiles.length());
433  if (index < (CORBA::Long)len)
434  {
435  for (CORBA::ULong i(index); i < len - 1; ++i)
436  {
437  m_profile.connector_profiles[i] =
438  m_profile.connector_profiles[i + 1] ;
439  }
440  m_profile.connector_profiles._length=len-1;
441  }
442 #endif // ORB_IS_RTORB
443  onDisconnected(getName(), prof, retval);
444  return retval;
445  }
446 
455  throw (CORBA::SystemException)
456  {
457  RTC_TRACE(("disconnect_all()"));
458 
460  {
461  Guard gaurd(m_profile_mutex);
462  plist = m_profile.connector_profiles;
463  }
464 
466  CORBA::ULong len(plist.length());
467  RTC_DEBUG(("disconnecting %d connections.", len));
468  for (CORBA::ULong i(0); i < len; ++i)
469  {
470  ReturnCode_t tmpret;
471  tmpret =this->disconnect(plist[i].connector_id);
472  if (tmpret != RTC::RTC_OK) retcode = tmpret;
473  }
474 
475  return retcode;
476  }
477 
478  //============================================================
479  // Local operations
480  //============================================================
488  void PortBase::setName(const char* name)
489  {
490  RTC_TRACE(("setName(%s)", name));
491  Guard guard(m_profile_mutex);
492  m_profile.name = CORBA::string_dup(name);
493  rtclog.setName(name);
494  }
495 
504  const char* PortBase::getName() const
505  {
506  RTC_TRACE(("getName() = %s", (const char*)m_profile.name));
507  return m_profile.name;
508  }
509 
517  const PortProfile& PortBase::getProfile() const
518  {
519  RTC_TRACE(("getProfile()"));
520  Guard guard(m_profile_mutex);
521  return m_profile;
522  }
523 
531  void PortBase::setPortRef(PortService_ptr port_ref)
532  {
533  RTC_TRACE(("setPortRef()"));
534  Guard gurad(m_profile_mutex);
535  m_profile.port_ref = port_ref;
536  }
537 
545  PortService_ptr PortBase::getPortRef()
546  {
547  RTC_TRACE(("getPortRef()"));
548  Guard gurad(m_profile_mutex);
549  return m_profile.port_ref;
550  }
551 
559  void PortBase::setOwner(RTObject_ptr owner)
560  {
561  RTC::ComponentProfile_var prof = owner->get_component_profile();
562 
563  m_ownerInstanceName = prof->instance_name;
564  RTC_TRACE(("setOwner(%s)", m_ownerInstanceName.c_str()));
565 
566  {
567  Guard gurad(m_profile_mutex);
568  std::string portname((const char*)m_profile.name);
569  coil::vstring p(coil::split(portname, "."));
570  // Now Port name is <instance_name>.<port_name>. r1648
571  portname = m_ownerInstanceName +"."+ p.back();
572 
573  m_profile.owner = RTC::RTObject::_duplicate(owner);
574  m_profile.name = CORBA::string_dup(portname.c_str());
575  }
576  }
577 
578  // OnConnect·Ï¥³¡¼¥ë¥Ð¥Ã¥¯ (Àܳ¤Ëµ¯°ø¤¹¤ë¥¤¥Ù¥ó¥È¤Ë¤è¤ê¥³¡¼¥ë¤µ¤ì¤ë)
580  {
581  m_onPublishInterfaces = on_publish;
582  }
583 
585  {
586  m_onSubscribeInterfaces = on_subscribe;
587  }
588 
590  {
591  m_onConnected = on_connected;
592  }
593 
595  {
596  m_onUnsubscribeInterfaces = on_unsubscribe;
597  }
598 
600  {
601  m_onDisconnected = on_disconnected;
602  }
603 
605  {
606  m_onConnectionLost = on_connection_lost;
607  }
608 
609  void PortBase::
611  {
612  m_portconnListeners = portconnListeners;
613  }
614 
615 
616  //============================================================
617  // protected operations
618  //============================================================
626  ReturnCode_t PortBase::connectNext(ConnectorProfile& connector_profile)
627  {
628  CORBA::Long index;
629  index = CORBA_SeqUtil::find(connector_profile.ports,
630  find_port_ref(m_profile.port_ref));
631 
632  if (index < 0) return RTC::BAD_PARAMETER;
633 
634  if (++index < static_cast<CORBA::Long>(connector_profile.ports.length()))
635  {
636  RTC::PortService_ptr p;
637  p = connector_profile.ports[index];
638  return p->notify_connect(connector_profile);
639  }
640  return RTC::RTC_OK;
641  }
642 
650  ReturnCode_t PortBase::disconnectNext(ConnectorProfile& cprof)
651  {
652  CORBA::ULong index;
653  index = CORBA_SeqUtil::find(cprof.ports,
654  find_port_ref(m_profile.port_ref));
655  if (index < 0)
656  {
657  return RTC::BAD_PARAMETER;
658  }
659  if (index == cprof.ports.length() - 1)
660  {
661  return RTC::RTC_OK;
662  }
663 
664  CORBA::ULong len = cprof.ports.length();
665 
666  ++index;
667  for (CORBA::ULong i(index); i < len; ++i)
668  {
669  RTC::PortService_var p;
670  p = cprof.ports[i];
671  try
672  {
673  return p->notify_disconnect(cprof.connector_id);
674  }
675  catch (CORBA::SystemException& e)
676  {
677 #ifndef ORB_IS_RTORB
678  RTC_WARN(("Exception caught: minor code.", e.minor()));
679 #else // ORB_IS_RTORB
680  RTC_WARN(("Exception caught"));
681 #endif // ORB_IS_RTORB
682  continue;
683  }
684  catch (...)
685  {
686  RTC_WARN(("Unknown exception caught."));
687  continue;
688  }
689  }
690 
691  return RTC::RTC_ERROR;
692  }
700  void PortBase::setConnectionLimit(int limit_value)
701  {
702  m_connectionLimit = limit_value;
703  }
704 
705  //============================================================
706  // protected utility functions
707  //============================================================
715  bool PortBase::isEmptyId(const ConnectorProfile& connector_profile) const
716  {
717  return connector_profile.connector_id[(CORBA::ULong)0] == 0;
718  }
719 
720 
728  const std::string PortBase::getUUID() const
729  {
730  coil::UUID_Generator uugen;
731  uugen.init();
732  std::auto_ptr<coil::UUID> uuid(uugen.generateUUID(2,0x01));
733 
734  return std::string((const char*)uuid->to_string());
735  }
736 
744  void PortBase::setUUID(ConnectorProfile& connector_profile) const
745  {
746  connector_profile.connector_id = CORBA::string_dup(getUUID().c_str());
747  assert(connector_profile.connector_id[(CORBA::ULong)0] != 0);
748  }
749 
757  bool PortBase::isExistingConnId(const char* id)
758  {
759  return CORBA_SeqUtil::find(m_profile.connector_profiles,
760  find_conn_id(id)) >= 0;
761  }
762 
770  ConnectorProfile PortBase::findConnProfile(const char* id)
771  {
772  CORBA::Long index;
773  index = CORBA_SeqUtil::find(m_profile.connector_profiles,
774  find_conn_id(id));
775  return m_profile.connector_profiles[index];
776  }
777 
785  CORBA::Long PortBase::findConnProfileIndex(const char* id)
786  {
787  return CORBA_SeqUtil::find(m_profile.connector_profiles,
788  find_conn_id(id));
789  }
790 
798  void
799  PortBase::updateConnectorProfile(const ConnectorProfile& connector_profile)
800  {
801  CORBA::Long index;
802  index = CORBA_SeqUtil::find(m_profile.connector_profiles,
803  find_conn_id(connector_profile.connector_id));
804 
805  if (index < 0)
806  {
807  CORBA_SeqUtil::push_back(m_profile.connector_profiles,
808  connector_profile);
809  }
810  else
811  {
812  m_profile.connector_profiles[index] = connector_profile;
813  }
814  }
815 
823  bool PortBase::eraseConnectorProfile(const char* id)
824  {
825  CORBA::Long index;
826  index = CORBA_SeqUtil::find(m_profile.connector_profiles,
827  find_conn_id(id));
828  if (index < 0) return false;
829 
830  CORBA_SeqUtil::erase(m_profile.connector_profiles, index);
831  return true;
832  }
833 
841  bool PortBase::appendInterface(const char* instance_name,
842  const char* type_name,
844  {
845  CORBA::Long index;
846  index = CORBA_SeqUtil::find(m_profile.interfaces,
847  find_interface(instance_name, pol));
848 
849  if (index >= 0) return false;
850  // setup PortInterfaceProfile
851  PortInterfaceProfile prof;
852  prof.instance_name = CORBA::string_dup(instance_name);
853  prof.type_name = CORBA::string_dup(type_name);
854  prof.polarity = pol;
855  CORBA_SeqUtil::push_back(m_profile.interfaces, prof);
856 
857  return true;
858  }
859 
868  {
869  CORBA::Long index;
870  index = CORBA_SeqUtil::find(m_profile.interfaces,
871  find_interface(name, pol));
872 
873  if (index < 0) return false;
874 
875  CORBA_SeqUtil::erase(m_profile.interfaces, index);
876  return true;
877  }
878 
887  {
888  std::vector<std::string> connector_ids;
889  {
890 // Why RtORB copies ConnectorProfile?
891 #ifndef ORB_IS_RTORB
892  Guard guard(m_profile_mutex);
893  ConnectorProfileList& clist(m_profile.connector_profiles);
894 
895  for (CORBA::ULong i(0); i < clist.length(); ++i)
896  {
897  if (!checkPorts(clist[i].ports))
898  {
899  const char* id(clist[i].connector_id);
900  connector_ids.push_back(id);
901  RTC_WARN(("Dead connection: %s", id));
902  }
903  }
904 #else // ORB_IS_RTORB
905  ConnectorProfileList* clist;
906  clist = new ConnectorProfileList(m_profile.connector_profiles);
907 
908  for (CORBA::ULong i(0); i < clist->length(); ++i)
909  {
910  if (!checkPorts((*clist)[i].ports))
911  {
912  const char* id((*clist)[i].connector_id);
913  connector_ids.push_back(id);
914  RTC_WARN(("Dead connection: %s", id));
915  }
916  }
917  delete clist;
918 #endif // ORB_IS_RTORB
919  }
920  std::vector<std::string>::iterator it, it_end;
921 
922  for (std::vector<std::string>::iterator it(connector_ids.begin());
923  it != connector_ids.end(); ++it)
924  {
925  this->disconnect((*it).c_str());
926  }
927  }
928 
936 #ifndef ORB_IS_RTORB
938 #else // ORB_IS_RTORB
939  bool PortBase::checkPorts(RTC_PortServiceList& ports)
940 #endif // ORB_IS_RTORB
941  {
942  for (CORBA::ULong i(0), len(ports.length()); i < len; ++i)
943  {
944  try
945  {
946  if (ports[i]->_non_existent())
947  {
948  RTC_WARN(("Dead Port reference detected."));
949  return false;
950  }
951  }
952  catch (...)
953  {
954  return false;
955  }
956  }
957  return true;
958  }
959 
960 }; // namespace RTC
virtual ReturnCode_t connectNext(ConnectorProfile &connector_profile)
Call notify_connect() of the next Port.
Definition: PortBase.cpp:626
RTC&#39;s Port base class.
void setOnSubscribeInterfaces(ConnectionCallback *on_subscribe)
Setting callback called on publish interfaces.
Definition: PortBase.cpp:584
bool isEmptyId(const ConnectorProfile &connector_profile) const
Check whether connector_id of ConnectorProfile is empty.
Definition: PortBase.cpp:715
#define RTC_ERROR(fmt)
Error log output macro.
Definition: SystemLogger.h:422
void onPublishInterfaces(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:1985
void erase(CorbaSequence &seq, CORBA::ULong index)
Erase the element of the specified index.
virtual ConnectorProfileList * get_connector_profiles()
[CORBA interface] Get the ConnectorProfileList of the Port
Definition: PortBase.cpp:133
RT-Component.
void setUUID(ConnectorProfile &connector_profile) const
Generate and set the UUID to the ConnectorProfile.
Definition: PortBase.cpp:744
virtual ReturnCode_t notify_connect(ConnectorProfile &connector_profile)
[CORBA interface] Notify the Ports connection
Definition: PortBase.cpp:229
std::string m_ownerInstanceName
Instance name.
Definition: PortBase.h:2098
ConnectionCallback * m_onSubscribeInterfaces
Callback functor objects.
Definition: PortBase.h:2137
ConnectionCallback * m_onUnsubscribeInterfaces
Callback functor objects.
Definition: PortBase.h:2166
void onNotifyConnect(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1956
void onDisconnectNextport(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2032
PortService_ptr getPortRef()
Get the object reference of this Port.
Definition: PortBase.cpp:545
coil::Mutex m_connectorsMutex
Definition: PortBase.h:2088
coil::Mutex m_profile_mutex
Mutex of PortProfile.
Definition: PortBase.h:2087
ReturnCode_t
Definition: doil.h:53
Functor to find a ConnectorProfile named id.
Definition: PortBase.h:2223
void setOnPublishInterfaces(ConnectionCallback *on_publish)
Setting callback called on publish interfaces.
Definition: PortBase.cpp:579
void init()
Initialization.
ConnectionCallback * m_onDisconnected
Callback functor objects.
Definition: PortBase.h:2180
void onDisconnected(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2043
void setOnConnected(ConnectionCallback *on_connected)
Setting callback called on connection established.
Definition: PortBase.cpp:589
RTC::ReturnCode_t ret(RTC::Local::ReturnCode_t r)
virtual ReturnCode_t connect(ConnectorProfile &connector_profile)
[CORBA interface] Connect the Port
Definition: PortBase.cpp:181
const char * getName() const
Get the name of this Port.
Definition: PortBase.cpp:504
void setOwner(RTObject_ptr owner)
Set the owner RTObject of the Port.
Definition: PortBase.cpp:559
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
Definition: stringutil.cpp:341
bool deleteInterface(const char *name, PortInterfacePolarity pol)
Delete the interface registration from the PortInterfaceProfile.
Definition: PortBase.cpp:867
void setName(const char *name)
Set suffix of date/time string of header.
PortCallback class.
void setOnUnsubscribeInterfaces(ConnectionCallback *on_subscribe)
Setting callback called on unsubscribe interfaces.
Definition: PortBase.cpp:594
virtual ~PortBase(void)
Destructor.
Definition: PortBase.cpp:71
Functor to find interface from name and polarity.
Definition: PortBase.h:2257
void setPortRef(PortService_ptr port_ref)
Set the object reference of this Port.
Definition: PortBase.cpp:531
#define RTC_WARN(fmt)
Warning log output macro.
Definition: SystemLogger.h:444
#define RTC_FATAL(fmt)
Error log output macro.
Definition: SystemLogger.h:400
#define RTC_PARANOID(fmt)
Paranoid level log output macro.
Definition: SystemLogger.h:555
void onConnectNextport(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:1997
std::vector< std::string > vstring
Definition: stringutil.h:37
virtual ReturnCode_t disconnect(const char *connector_id)
[CORBA interface] Disconnect the Port
Definition: PortBase.cpp:339
coil::UUID * generateUUID(ACE_UINT16 version=0x0001, u_char variant=0x80)
Definition: ace/coil/UUID.h:45
std::vector< ConnectorProfile * > ConnectorProfileList
Definition: IPortService.h:50
#define RTC_DEBUG(fmt)
Debug level log output macro.
Definition: SystemLogger.h:488
ConnectionCallback * m_onConnected
Callback functor objects.
Definition: PortBase.h:2152
void setPortConnectListenerHolder(PortConnectListeners *portconnListeners)
Setting PortConnectListener holder.
Definition: PortBase.cpp:610
PortConnectListeners class.
#define RTC_TRACE(fmt)
CORBA::Long find(const CorbaSequence &seq, Functor f)
Return the index of CORBA sequence element that functor matches.
list index
Definition: rtimages.py:10
virtual ReturnCode_t notify_disconnect(const char *connector_id)
[CORBA interface] Notify the Ports disconnection
Definition: PortBase.cpp:396
PortBase(const char *name="")
Constructor.
Definition: PortBase.cpp:38
void onConnected(const char *portname, RTC::ConnectorProfile &profile, ReturnCode_t ret)
Definition: PortBase.h:2021
virtual ConnectorProfile * get_connector_profile(const char *connector_id)
[CORBA interface] Get the ConnectorProfile
Definition: PortBase.cpp:153
CORBA::Long findConnProfileIndex(const char *id)
Find ConnectorProfile with id.
Definition: PortBase.cpp:785
const PortProfile & getProfile() const
Get the PortProfile of the Port.
Definition: PortBase.cpp:517
void setOnConnectionLost(ConnectionCallback *on_connection_lost)
Setting callback called on connection lost.
Definition: PortBase.cpp:604
virtual void unsubscribeInterfaces(const ConnectorProfile &connector_profile)=0
Disconnect interface connection.
void updateConnectors()
Disconnect ports that doesn&#39;t exist.
Definition: PortBase.cpp:886
virtual PortProfile * get_port_profile()
[CORBA interface] Get the PortProfile of the Port
Definition: PortBase.cpp:100
PortProfile m_profile
PortProfile of the Port.
Definition: PortBase.h:2070
virtual ReturnCode_t publishInterfaces(ConnectorProfile &connector_profile)=0
Publish interface information.
PortConnectListeners * m_portconnListeners
PortConnectListener holder.
Definition: PortBase.h:2211
bool eraseConnectorProfile(const char *id)
Delete the ConnectorProfile.
Definition: PortBase.cpp:823
std::vector< IPortService * > PortServiceList
Definition: IPortService.h:39
void onUnsubscribeInterfaces(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1975
bool isExistingConnId(const char *id)
Check whether the given id exists in stored ConnectorProfiles.
Definition: PortBase.cpp:757
bool appendInterface(const char *name, const char *type_name, PortInterfacePolarity pol)
Append an interface to the PortInterfaceProfile.
Definition: PortBase.cpp:841
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:2009
void onNotifyDisconnect(const char *portname, RTC::ConnectorProfile &profile)
Definition: PortBase.h:1966
int m_connectionLimit
The maximum number of connections.
Definition: PortBase.h:2107
RTC::PortService_var m_objref
Object Reference of the Port.
Definition: PortBase.h:2079
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
ConnectionCallback * m_onConnectionLost
Callback functor objects.
Definition: PortBase.h:2196
virtual ReturnCode_t disconnect_all()
[CORBA interface] Disconnect the All Ports
Definition: PortBase.cpp:454
const std::string getUUID() const
Generate the UUID.
Definition: PortBase.cpp:728
ConnectionCallback * m_onPublishInterfaces
Callback functor objects.
Definition: PortBase.h:2123
virtual ReturnCode_t disconnectNext(ConnectorProfile &connector_profile)
Call notify_disconnect() of the next Port.
Definition: PortBase.cpp:650
bool checkPorts(::RTC::PortServiceList &ports)
Existence of ports.
Definition: PortBase.cpp:937
Functor to find the object reference that is identical port_ref.
Definition: PortBase.h:2240
void updateConnectorProfile(const ConnectorProfile &connector_profile)
Append or update the ConnectorProfile list.
Definition: PortBase.cpp:799
Callback functor abstract for connect/notify_connect() funcs.
Definition: PortCallback.h:55
void setName(const char *name)
Set the name of this Port.
Definition: PortBase.cpp:488
ConnectorProfile findConnProfile(const char *id)
Find ConnectorProfile with id.
Definition: PortBase.cpp:770
virtual ReturnCode_t _publishInterfaces(void)
Publish interface information.
Definition: PortBase.cpp:315
void setOnDisconnected(ConnectionCallback *on_disconnected)
Setting callback called on disconnected.
Definition: PortBase.cpp:599
virtual void setConnectionLimit(int limit_value)
Set the maximum number of connections.
Definition: PortBase.cpp:700
Logger rtclog
Logger stream.
Definition: PortBase.h:2062
PortInterfacePolarity
Definition: IRTC.h:55
const PortProfile & getPortProfile() const
Get the PortProfile of the Port.
Definition: PortBase.cpp:119


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:54