[openrtm-commit:00099] r2128 - branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 5月 24日 (火) 12:49:47 JST
Author: n-ando
Date: 2011-05-24 12:49:47 +0900 (Tue, 24 May 2011)
New Revision: 2128
Modified:
branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp
Log:
Some debug prints have been added to debug refs #2137 issue.
Mutex guard's position has been changed. But the bug is not fixed.
Modified: branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp 2011-05-24 03:46:35 UTC (rev 2127)
+++ branches/RELENG_1_1/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp 2011-05-24 03:49:47 UTC (rev 2128)
@@ -128,21 +128,21 @@
bool SdoServiceAdmin::
addSdoServiceConsumer(const SDOPackage::ServiceProfile& sProfile)
{
+ Guard guard(m_consumer_mutex);
RTC_TRACE(("addSdoServiceConsumer(IFR = %s)",
static_cast<const char*>(sProfile.interface_type)));
- SDOPackage::ServiceProfile profile(sProfile);
// Not supported consumer type -> error return
if (!isAllowedConsumerType(sProfile)) { return false; }
if (!isExistingConsumerType(sProfile)) { return false; }
- if (strncmp(profile.id, "", 1) == 0)
+ RTC_DEBUG(("Valid SDO service required"));
+ if (strncmp(sProfile.id, "", 1) == 0)
{
RTC_WARN(("No id specified. It should be given by clients."));
return false;
}
-
+ RTC_DEBUG(("Valid ID specified"));
{ // re-initialization
- Guard guard(m_consumer_mutex);
std::string id(sProfile.id);
for (size_t i(0); i < m_consumers.size(); ++i)
{
@@ -155,17 +155,20 @@
}
}
}
+ RTC_DEBUG(("SDO service properly initialized."));
// new pofile
SdoServiceConsumerFactory&
factory(SdoServiceConsumerFactory::instance());
- const char* ctype = static_cast<const char*>(profile.interface_type);
+ const char* ctype = static_cast<const char*>(sProfile.interface_type);
+ if (ctype == NULL) { return false; }
SdoServiceConsumerBase* consumer(factory.createObject(ctype));
if (consumer == NULL)
{
RTC_ERROR(("Hmm... consumer must be created."));
return false;
}
+ RTC_DEBUG(("An SDO service consumer created."));
// initialize
if (!consumer->init(m_rtobj, sProfile))
@@ -180,9 +183,14 @@
RTC_INFO(("SDO consumer was deleted by initialization failure"));
return false;
}
+ RTC_DEBUG(("An SDO service consumer initialized."));
+ RTC_DEBUG(("id: %s", static_cast<const char*>(sProfile.id)));
+ RTC_DEBUG(("IFR: %s",
+ static_cast<const char*>(sProfile.interface_type)));
+ RTC_DEBUG(("properties: %s",
+ NVUtil::toString(sProfile.properties).c_str()));
// store consumer
- Guard guard(m_consumer_mutex);
m_consumers.push_back(consumer);
return true;
@@ -197,6 +205,7 @@
*/
bool SdoServiceAdmin::removeSdoServiceConsumer(const char* id)
{
+ Guard guard(m_consumer_mutex);
if (id == NULL || id[0] == '\0')
{
RTC_ERROR(("removeSdoServiceConsumer(): id is invalid."));
@@ -204,7 +213,6 @@
}
RTC_TRACE(("removeSdoServiceConsumer(id = %s)", id));
- Guard guard(m_consumer_mutex);
std::string strid(id);
std::vector<SdoServiceConsumerBase*>::iterator it = m_consumers.begin();
std::vector<SdoServiceConsumerBase*>::iterator it_end = m_consumers.end();
openrtm-commit メーリングリストの案内