[openrtm-commit:02996] r3130 - branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 12月 11日 (月) 18:25:07 JST
Author: n-ando
Date: 2017-12-11 18:25:07 +0900 (Mon, 11 Dec 2017)
New Revision: 3130
Modified:
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.h
Log:
[bugfix] bugs related merge has been fixed.
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/CORBA_IORUtil.cpp 2017-12-11 09:25:07 UTC (rev 3130)
@@ -47,7 +47,8 @@
/*!
* @if jp
- * @brief IOR ʸ»úÎó¤òIOR¹½Â¤ÂΤØÊÑ´¹¤¹¤E * @else
+ * @brief IOR ʸ»úÎó¤òIOR¹½Â¤ÂΤØÊÑ´¹¤¹¤ë
+ * @else
* @brief Convert from IOR string to IOR structure
* @endif
*/
@@ -113,7 +114,8 @@
#endif // ORB_IS_ORBEXPRESS
/*!
* @if jp
- * @brief IOR¹½Â¤ÂΤòIORʸ»úÎó¤ØÊÑ´¹¤¹¤E * @else
+ * @brief IOR¹½Â¤ÂΤòIORʸ»úÎó¤ØÊÑ´¹¤¹¤ë
+ * @else
* @brief Convert from IOR structure to IOR string
* @endif
*/
@@ -173,7 +175,8 @@
#endif // ORB_IS_ORBEXPRESS
/*!
* @if jp
- * @brief IORÆâ¤Î¥¨¥ó¥É¥Ý¥¤¥ó¥È¤òÃÖ´¹¤¹¤E * @else
+ * @brief IORÆâ¤Î¥¨¥ó¥É¥Ý¥¤¥ó¥È¤òÃÖ´¹¤¹¤ë
+ * @else
* @brief Replace endpoint address in IOR entry
* @endif
*/
@@ -217,7 +220,7 @@
/*!
* @if jp
- * @brief IORʸ»úÎ󤫤é¾ðÊó¤òÃEФ·¥Õ¥©¡¼¥Þ¥Ã¥ÈºÑ¤ß¤Îʸ»úÎó¤È¤·¤ÆÊÖ¤¹
+ * @brief IORʸ»úÎ󤫤é¾ðÊó¤òÃê½Ð¤·¥Õ¥©¡¼¥Þ¥Ã¥ÈºÑ¤ß¤Îʸ»úÎó¤È¤·¤ÆÊÖ¤¹
* @else
* @brief Extracts information from IOR string and returns formatted string
* @endif
@@ -252,23 +255,23 @@
<< (int) pBody.version.minor << " ";
retstr << (const char*) pBody.address.host
<< " " << pBody.address.port << std::endl;
-
+
print_omni_key(retstr, pBody.object_key);
print_key(retstr, pBody.object_key);
print_tagged_components(retstr, pBody.components);
-
retstr << std::endl;
}
+ else if (ior.profiles[count].tag == IOP::TAG_MULTIPLE_COMPONENTS)
{
-
retstr << "Multiple Component Profile ";
IIOP::ProfileBody pBody;
+ IIOP::unmarshalMultiComponentProfile(ior.profiles[count],
pBody.components);
print_tagged_components(retstr, pBody.components);
-
retstr << std::endl;
-
+ }
else
+ {
retstr << "Unrecognised profile tag: 0x"
<< std::hex
<< (unsigned)(ior.profiles[count].tag)
@@ -282,7 +285,6 @@
return retstr.str();
}
-
std::vector<IIOP::Address> getEndpoints(IOP::IOR& ior)
{
#if !defined(ORB_IS_RTORB) && !defined(ORB_IS_ORBEXPRESS) && !defined(ORB_IS_TAO)
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.cpp 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.cpp 2017-12-11 09:25:07 UTC (rev 3130)
@@ -33,17 +33,17 @@
* @param buffer The buffer object that is attached to this Consumer
* @endif
*/
- InPortSHMConsumer::InPortSHMConsumer()
- : m_memory_size(0),
- m_endian(true),
- rtclog("InPortSHMConsumer")
+ InPortSHMConsumer::InPortSHMConsumer()
+ : rtclog("InPortSHMConsumer"),
+ m_memorySize(0),
+ m_endian(true)
{
- coil::UUID_Generator uugen;
- uugen.init();
- std::auto_ptr<coil::UUID> uuid(uugen.generateUUID(2, 0x01));
- m_shm_address = uuid->to_string();
+ coil::UUID_Generator uugen;
+ uugen.init();
+ std::auto_ptr<coil::UUID> uuid(uugen.generateUUID(2, 0x01));
+ m_shmAddress = uuid->to_string();
}
-
+
/*!
* @if jp
* @brief デストラクタ
@@ -51,11 +51,10 @@
* @brief Destructor
* @endif
*/
- InPortSHMConsumer::~InPortSHMConsumer()
+ InPortSHMConsumer::~InPortSHMConsumer()
{
RTC_PARANOID(("~InPortSHMConsumer()"));
- m_shmem.close_memory(true);
-
+ m_shmem.close_memory(true);
}
/*!
@@ -65,272 +64,269 @@
* @brief Initializing configuration
* @endif
*/
- void InPortSHMConsumer::init(coil::Properties& prop)
+ void InPortSHMConsumer::init(coil::Properties& prop)
{
m_properties = prop;
- std::string ds = m_properties["shem_default_size"];
- m_memory_size = m_shmem.string_to_MemorySize(ds);
+ std::string ds = m_properties["shem_default_size"];
+ m_memorySize = m_shmem.string_to_MemorySize(ds);
- if (m_properties.hasKey("serializer") == NULL)
- {
- m_endian = true;
- return;
- }
+ if (m_properties.hasKey("serializer") == NULL)
+ {
+ m_endian = true;
+ return;
+ }
-
- std::string endian_type(m_properties.getProperty("serializer.cdr.endian", ""));
- coil::normalize(endian_type);
- std::vector<std::string> endian(coil::split(endian_type, ","));
- if (endian.empty()) { return; }
- if (endian[0] == "little")
- {
- m_endian = true;
- }
- else if (endian[0] == "big")
- {
- m_endian = false;
- return;
- }
-
+ std::string endian_type(m_properties.getProperty("serializer.cdr.endian",
+ ""));
+ coil::normalize(endian_type);
+ std::vector<std::string> endian(coil::split(endian_type, ","));
+ if (endian.empty()) { return; }
+ if (endian[0] == "little")
+ {
+ m_endian = true;
+ }
+ else if (endian[0] == "big")
+ {
+ m_endian = false;
+ return;
+ }
}
- bool InPortSHMConsumer::setObject(CORBA::Object_ptr obj)
+ bool InPortSHMConsumer::setObject(CORBA::Object_ptr obj)
{
RTC_PARANOID(("setObject()"));
- if (CorbaConsumer< ::OpenRTM::PortSharedMemory >::setObject(obj))
- {
- m_shmem.setInterface(_ptr());
- return true;
- }
-
-
+ if (CorbaConsumer< ::OpenRTM::PortSharedMemory >::setObject(obj))
+ {
+ m_shmem.setInterface(_ptr());
+ return true;
+ }
return false;
}
- /*!
- * @if jp
- * @brief バッファへのデータ書込
- * @else
- * @brief Write data into the buffer
- * @endif
- */
- InPortConsumer::ReturnCode InPortSHMConsumer::put(const cdrMemoryStream& data)
- {
- RTC_PARANOID(("put()"));
+ /*!
+ * @if jp
+ * @brief バッファへのデータ書込
+ * @else
+ * @brief Write data into the buffer
+ * @endif
+ */
+ InPortConsumer::ReturnCode InPortSHMConsumer::put(cdrMemoryStream& data)
+ {
+ RTC_PARANOID(("put()"));
+ try
+ {
+ Guard guard(m_mutex);
+ m_shmem.setEndian(m_endian);
-
- try
- {
+ m_shmem.create_memory(m_memorySize, m_shmAddress.c_str());
- Guard guard(m_mutex);
- m_shmem.setEndian(m_endian);
+ m_shmem.write(data);
- m_shmem.create_memory(m_memory_size, m_shm_address.c_str());
+ return convertReturnCode(_ptr()->put());
+ }
+ catch (...)
+ {
+ return CONNECTION_LOST;
+ }
+ return UNKNOWN_ERROR;
+ }
- m_shmem.write(data);
+
+ void InPortSHMConsumer::
+ publishInterfaceProfile(SDOPackage::NVList& properties)
+ {
+ return;
+ }
+ bool InPortSHMConsumer::
+ subscribeInterface(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("subscribeInterface()"));
+ RTC_DEBUG_STR((NVUtil::toString(properties)));
- return convertReturnCode(_ptr()->put());
- }
- catch (...)
- {
- return CONNECTION_LOST;
- }
- return UNKNOWN_ERROR;
- }
+ // getting InPort's ref from IOR string
+ if (subscribeFromIor(properties)) { return true; }
-
- void InPortSHMConsumer::
- publishInterfaceProfile(SDOPackage::NVList& properties)
- {
- return;
- }
- bool InPortSHMConsumer::
- subscribeInterface(const SDOPackage::NVList& properties)
- {
- RTC_TRACE(("subscribeInterface()"));
- RTC_DEBUG_STR((NVUtil::toString(properties)));
+ // getting InPort's ref from Object reference
+ if (subscribeFromRef(properties)) { return true; }
- // getting InPort's ref from IOR string
- if (subscribeFromIor(properties)) { return true; }
+ return false;;
+ }
- // getting InPort's ref from Object reference
- if (subscribeFromRef(properties)) { return true; }
+ void InPortSHMConsumer::
+ unsubscribeInterface(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("unsubscribeInterface()"));
+ RTC_DEBUG_STR((NVUtil::toString(properties)));
- return false;;
- }
- void InPortSHMConsumer::
- unsubscribeInterface(const SDOPackage::NVList& properties)
- {
- RTC_TRACE(("unsubscribeInterface()"));
- RTC_DEBUG_STR((NVUtil::toString(properties)));
+ if (unsubscribeFromIor(properties)) { return; }
+ unsubscribeFromRef(properties);
+ }
- if (unsubscribeFromIor(properties)) { return; }
- unsubscribeFromRef(properties);
- }
- bool InPortSHMConsumer::
- subscribeFromIor(const SDOPackage::NVList& properties)
- {
- RTC_TRACE(("subscribeFromIor()"));
+ bool InPortSHMConsumer::
+ subscribeFromIor(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("subscribeFromIor()"));
- CORBA::Long index;
- index = NVUtil::find_index(properties,
- "dataport.corba_cdr.inport_ior");
- if (index < 0)
- {
- RTC_ERROR(("inport_ior not found"));
- return false;
- }
+ CORBA::Long index;
+ index = NVUtil::find_index(properties,
+ "dataport.corba_cdr.inport_ior");
+ if (index < 0)
+ {
+ RTC_ERROR(("inport_ior not found"));
+ return false;
+ }
- const char* ior(0);
- if (!(properties[index].value >>= ior))
- {
- RTC_ERROR(("inport_ior has no string"));
- return false;
- }
+ const char* ior(0);
+ if (!(properties[index].value >>= ior))
+ {
+ RTC_ERROR(("inport_ior has no string"));
+ return false;
+ }
- CORBA::ORB_var orb = ::RTC::Manager::instance().getORB();
- CORBA::Object_var obj = orb->string_to_object(ior);
+ CORBA::ORB_var orb = ::RTC::Manager::instance().getORB();
+ CORBA::Object_var obj = orb->string_to_object(ior);
- if (CORBA::is_nil(obj))
- {
- RTC_ERROR(("invalid IOR string has been passed"));
- return false;
- }
+ if (CORBA::is_nil(obj))
+ {
+ RTC_ERROR(("invalid IOR string has been passed"));
+ return false;
+ }
- if (!setObject(obj.in()))
- {
- RTC_WARN(("Setting object to consumer failed."));
- return false;
- }
- return true;
- }
- bool InPortSHMConsumer::
- subscribeFromRef(const SDOPackage::NVList& properties)
- {
- RTC_TRACE(("subscribeFromRef()"));
- CORBA::Long index;
- index = NVUtil::find_index(properties,
- "dataport.corba_cdr.inport_ref");
- if (index < 0)
- {
- RTC_ERROR(("inport_ref not found"));
- return false;
- }
+ if (!setObject(obj.in()))
+ {
+ RTC_WARN(("Setting object to consumer failed."));
+ return false;
+ }
+ return true;
+ }
- CORBA::Object_var obj;
+ bool InPortSHMConsumer::
+ subscribeFromRef(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("subscribeFromRef()"));
+ CORBA::Long index;
+ index = NVUtil::find_index(properties,
+ "dataport.corba_cdr.inport_ref");
+ if (index < 0)
+ {
+ RTC_ERROR(("inport_ref not found"));
+ return false;
+ }
+
+ CORBA::Object_var obj;
#ifdef ORB_IS_ORBEXPRESS
- if (!(properties[index].value >>= obj))
+ if (!(properties[index].value >>= obj))
#else
- if (!(properties[index].value >>= CORBA::Any::to_object(obj.out())))
+ if (!(properties[index].value >>= CORBA::Any::to_object(obj.out())))
#endif
- {
- RTC_ERROR(("prop[inport_ref] is not objref"));
- return true;
- }
+ {
+ RTC_ERROR(("prop[inport_ref] is not objref"));
+ return true;
+ }
- if (CORBA::is_nil(obj))
- {
- RTC_ERROR(("prop[inport_ref] is not objref"));
- return false;
- }
+ if (CORBA::is_nil(obj))
+ {
+ RTC_ERROR(("prop[inport_ref] is not objref"));
+ return false;
+ }
- if (!setObject(obj.in()))
- {
- RTC_ERROR(("Setting object to consumer failed."));
- return false;
- }
- return true;
- }
- bool InPortSHMConsumer::
- unsubscribeFromIor(const SDOPackage::NVList& properties)
- {
- RTC_TRACE(("unsubscribeFromIor()"));
- CORBA::Long index;
- index = NVUtil::find_index(properties,
- "dataport.corba_cdr.inport_ior");
- if (index < 0)
- {
- RTC_ERROR(("inport_ior not found"));
- return false;
- }
+ if (!setObject(obj.in()))
+ {
+ RTC_ERROR(("Setting object to consumer failed."));
+ return false;
+ }
+ return true;
+ }
- const char* ior;
- if (!(properties[index].value >>= ior))
- {
- RTC_ERROR(("prop[inport_ior] is not string"));
- return false;
- }
+ bool InPortSHMConsumer::
+ unsubscribeFromIor(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("unsubscribeFromIor()"));
+ CORBA::Long index;
+ index = NVUtil::find_index(properties,
+ "dataport.corba_cdr.inport_ior");
+ if (index < 0)
+ {
+ RTC_ERROR(("inport_ior not found"));
+ return false;
+ }
- CORBA::ORB_var orb = ::RTC::Manager::instance().getORB();
- CORBA::Object_var var = orb->string_to_object(ior);
- if (!(_ptr()->_is_equivalent(var)))
- {
- RTC_ERROR(("connector property inconsistency"));
- return false;
- }
+ const char* ior;
+ if (!(properties[index].value >>= ior))
+ {
+ RTC_ERROR(("prop[inport_ior] is not string"));
+ return false;
+ }
- releaseObject();
- return true;
- }
- bool InPortSHMConsumer::
- unsubscribeFromRef(const SDOPackage::NVList& properties)
- {
- RTC_TRACE(("unsubscribeFromRef()"));
- CORBA::Long index;
- index = NVUtil::find_index(properties,
- "dataport.corba_cdr.inport_ref");
- if (index < 0) { return false; }
+ CORBA::ORB_var orb = ::RTC::Manager::instance().getORB();
+ CORBA::Object_var var = orb->string_to_object(ior);
+ if (!(_ptr()->_is_equivalent(var)))
+ {
+ RTC_ERROR(("connector property inconsistency"));
+ return false;
+ }
- CORBA::Object_var obj;
+ releaseObject();
+ return true;
+ }
+
+ bool InPortSHMConsumer::
+ unsubscribeFromRef(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("unsubscribeFromRef()"));
+ CORBA::Long index;
+ index = NVUtil::find_index(properties,
+ "dataport.corba_cdr.inport_ref");
+ if (index < 0) { return false; }
+
+ CORBA::Object_var obj;
#ifdef ORB_IS_ORBEXPRESS
- if (!(properties[index].value >>= obj))
+ if (!(properties[index].value >>= obj))
#else
- if (!(properties[index].value >>= CORBA::Any::to_object(obj.out())))
+ if (!(properties[index].value >>= CORBA::Any::to_object(obj.out())))
#endif
- {
- return false;
- }
+ {
+ return false;
+ }
- if (!(_ptr()->_is_equivalent(obj.in()))) { return false; }
+ if (!(_ptr()->_is_equivalent(obj.in()))) { return false; }
- releaseObject();
- return true;
- }
- InPortConsumer::ReturnCode
- InPortSHMConsumer::convertReturnCode(OpenRTM::PortStatus ret)
- {
- switch (ret)
- {
- case OpenRTM::PORT_OK:
- return InPortConsumer::PORT_OK;
- break;
- case OpenRTM::PORT_ERROR:
- return InPortConsumer::PORT_ERROR;
- break;
- case OpenRTM::BUFFER_FULL:
- return InPortConsumer::SEND_FULL;
- break;
- case OpenRTM::BUFFER_TIMEOUT:
- return InPortConsumer::SEND_TIMEOUT;
- break;
- case OpenRTM::UNKNOWN_ERROR:
- return InPortConsumer::UNKNOWN_ERROR;
- break;
- default:
- return InPortConsumer::UNKNOWN_ERROR;
- break;
- }
- return InPortConsumer::UNKNOWN_ERROR;
- }
+ releaseObject();
+ return true;
+ }
-
-
+ InPortConsumer::ReturnCode
+ InPortSHMConsumer::convertReturnCode(OpenRTM::PortStatus ret)
+ {
+ switch (ret)
+ {
+ case OpenRTM::PORT_OK:
+ return InPortConsumer::PORT_OK;
+ break;
+ case OpenRTM::PORT_ERROR:
+ return InPortConsumer::PORT_ERROR;
+ break;
+ case OpenRTM::BUFFER_FULL:
+ return InPortConsumer::SEND_FULL;
+ break;
+ case OpenRTM::BUFFER_TIMEOUT:
+ return InPortConsumer::SEND_TIMEOUT;
+ break;
+ case OpenRTM::UNKNOWN_ERROR:
+ return InPortConsumer::UNKNOWN_ERROR;
+ break;
+ default:
+ return InPortConsumer::UNKNOWN_ERROR;
+ break;
+ }
+ return InPortConsumer::UNKNOWN_ERROR;
+ }
}; // namespace RTC
extern "C"
-{
+{
/*!
* @if jp
* @brief モジュール初期化関数
@@ -338,12 +334,12 @@
* @brief Module initialization
* @endif
*/
- void InPortSHMConsumerInit(void)
+ void InPortSHMConsumerInit(void)
{
RTC::InPortConsumerFactory& factory(RTC::InPortConsumerFactory::instance());
factory.addFactory("shared_memory",
::coil::Creator< ::RTC::InPortConsumer,
- ::RTC::InPortSHMConsumer>,
+ ::RTC::InPortSHMConsumer>,
::coil::Destructor< ::RTC::InPortConsumer,
::RTC::InPortSHMConsumer>);
}
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.h 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMConsumer.h 2017-12-11 09:25:07 UTC (rev 3130)
@@ -53,10 +53,10 @@
* @endif
*/
class InPortSHMConsumer
- : public InPortConsumer,
- public CorbaConsumer< ::OpenRTM::PortSharedMemory >
+ : public InPortConsumer,
+ public CorbaConsumer< ::OpenRTM::PortSharedMemory >
{
- typedef coil::Guard<coil::Mutex> Guard;
+ typedef coil::Guard<coil::Mutex> Guard;
public:
DATAPORTSTATUS_ENUM
/*!
@@ -97,8 +97,8 @@
* @if jp
* @brief 設定初期化
*
- *
- *
+ *
+ *
* @param prop 設定情報
*
* @else
@@ -117,9 +117,9 @@
* @brief 接続先へのデータ送信
*
* 接続先のポートへデータを送信するための純粋仮想関数。
- *
- *
*
+ *
+ *
* @param data 送信するデータ
* @return リターンコード
*
@@ -126,48 +126,50 @@
* @else
* @brief Send data to the destination port
*
- *
*
+ *
* @endif
*/
- virtual InPortConsumer::ReturnCode put(const cdrMemoryStream& data);
+ virtual InPortConsumer::ReturnCode put(cdrMemoryStream& data);
/*!
* @if jp
- * @brief
- *
- *
+ * @brief
*
- * @param obj
- * @return
*
+ *
+ * @param obj
+ * @return
+ *
* @else
- * @brief
+ * @brief
*
- *
*
+ *
* @endif
*/
virtual bool setObject(CORBA::Object_ptr obj);
- virtual void publishInterfaceProfile(SDOPackage::NVList& properties);
- virtual bool subscribeInterface(const SDOPackage::NVList& properties);
- virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
-
-private:
- bool subscribeFromIor(const SDOPackage::NVList& properties);
- bool subscribeFromRef(const SDOPackage::NVList& properties);
- bool unsubscribeFromIor(const SDOPackage::NVList& properties);
- bool unsubscribeFromRef(const SDOPackage::NVList& properties);
+ virtual void publishInterfaceProfile(SDOPackage::NVList& properties);
+ virtual bool subscribeInterface(const SDOPackage::NVList& properties);
+ virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
-protected:
- InPortConsumer::ReturnCode convertReturnCode(OpenRTM::PortStatus ret);
+ private:
+ bool subscribeFromIor(const SDOPackage::NVList& properties);
+ bool subscribeFromRef(const SDOPackage::NVList& properties);
+ bool unsubscribeFromIor(const SDOPackage::NVList& properties);
+ bool unsubscribeFromRef(const SDOPackage::NVList& properties);
- mutable Logger rtclog;
- coil::Properties m_properties;
- coil::Mutex m_mutex;
- std::string m_shm_address;
- SharedMemoryPort m_shmem;
- int m_memory_size;
- bool m_endian;
+ protected:
+ InPortConsumer::ReturnCode convertReturnCode(OpenRTM::PortStatus ret);
+
+ private:
+ coil::Mutex m_mutex;
+ mutable Logger rtclog;
+ coil::Properties m_properties;
+
+ int m_memorySize;
+ std::string m_shmAddress;
+ SharedMemoryPort m_shmem;
+ bool m_endian;
};
}; // namespace RTC
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.cpp 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.cpp 2017-12-11 09:25:07 UTC (rev 3130)
@@ -33,33 +33,29 @@
* @endif
*/
InPortSHMProvider::InPortSHMProvider(void)
- : m_buffer(0),
- m_connector(NULL)
+ : rtclog("InPortSHMProvider"),
+ m_connector(0),
+ m_buffer(0)
{
// PortProfile setting
setInterfaceType("shared_memory");
-
- // ConnectorProfile setting
+ // set InPort's reference
#ifdef ORB_IS_OMNIORB
::RTC::Manager::instance().theShortCutPOA()->activate_object(this);
#endif
-
- m_objref = this->_this();
-
- // set InPort's reference
+ m_objref = this->_this();
CORBA::ORB_var orb = ::RTC::Manager::instance().getORB();
- CORBA::String_var ior = orb->object_to_string(m_objref.in());
+ CORBA::String_var ior = orb->object_to_string(m_objref.in());
CORBA_SeqUtil::
push_back(m_properties,
NVUtil::newNV("dataport.corba_cdr.inport_ior", ior.in()));
-
CORBA_SeqUtil::
push_back(m_properties,
- NVUtil::newNV("dataport.corba_cdr.inport_ref", m_objref));
+ NVUtil::newNV("dataport.corba_cdr.inport_ref", m_objref));
}
-
+
/*!
* @if jp
* @brief デストラクタ
@@ -69,7 +65,6 @@
*/
InPortSHMProvider::~InPortSHMProvider(void)
{
-
}
void InPortSHMProvider::init(coil::Properties& prop)
@@ -83,8 +78,7 @@
* @brief Setting outside buffer's pointer
* @endif
*/
- void InPortSHMProvider::
- setBuffer(BufferBase<cdrMemoryStream>* buffer)
+ void InPortSHMProvider:: setBuffer(BufferBase<cdrMemoryStream>* buffer)
{
m_buffer = buffer;
}
@@ -97,7 +91,7 @@
* @endif
*/
void InPortSHMProvider::setListener(ConnectorInfo& info,
- ConnectorListeners* listeners)
+ ConnectorListeners* listeners)
{
m_profile = info;
m_listeners = listeners;
@@ -106,11 +100,9 @@
void InPortSHMProvider::setConnector(InPortConnector* connector)
{
- m_connector = connector;
+ m_connector = connector;
}
-
-
/*!
* @if jp
* @brief バッファにデータを書き込む
@@ -118,43 +110,37 @@
* @brief Write data into the buffer
* @endif
*/
- ::OpenRTM::PortStatus
- InPortSHMProvider::put()
+ ::OpenRTM::PortStatus InPortSHMProvider::put()
throw (CORBA::SystemException)
{
RTC_PARANOID(("InPortSHMProvider::put()"));
- if (m_buffer == 0)
- {
- return ::OpenRTM::PORT_ERROR;
- }
-
- cdrMemoryStream cdr;
- bool endian_type = m_connector->isLittleEndian();
+ if (m_buffer == 0)
+ {
+ return ::OpenRTM::PORT_ERROR;
+ }
+ cdrMemoryStream cdr;
+ bool endian_type = m_connector->isLittleEndian();
- try
- {
- setEndian(endian_type);
- read(cdr);
-
+ try
+ {
+ setEndian(endian_type);
+ read(cdr);
#ifdef ORB_IS_ORBEXPRESS
- RTC_PARANOID(("received data size: %d", cdr.cdr.size_written()));
+ RTC_PARANOID(("received data size: %d", cdr.cdr.size_written()));
#elif defined(ORB_IS_TAO)
- RTC_PARANOID(("received data size: %d", cdr.cdr.length()));
+ RTC_PARANOID(("received data size: %d", cdr.cdr.length()));
#else
- RTC_PARANOID(("received data size: %d", cdr.bufSize()));
+ RTC_PARANOID(("received data size: %d", cdr.bufSize()));
#endif
-
- }
- catch (...)
- {
+ }
+ catch (...)
+ {
+ }
+ onReceived(cdr);
- }
-
- onReceived(cdr);
-
- BufferStatus::Enum ret = m_buffer->write(cdr);
-
- return convertReturn(ret, cdr);
+ BufferStatus::Enum ret = m_buffer->write(cdr);
+
+ return convertReturn(ret, cdr);
}
/*!
@@ -166,7 +152,7 @@
*/
::OpenRTM::PortStatus
InPortSHMProvider::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
@@ -174,41 +160,32 @@
onBufferWrite(data);
return ::OpenRTM::PORT_OK;
break;
-
case BufferStatus::BUFFER_ERROR:
onReceiverError(data);
return ::OpenRTM::PORT_ERROR;
break;
-
case BufferStatus::BUFFER_FULL:
onBufferFull(data);
onReceiverFull(data);
return ::OpenRTM::BUFFER_FULL;
break;
-
case BufferStatus::BUFFER_EMPTY:
// never come here
return ::OpenRTM::BUFFER_EMPTY;
break;
-
case BufferStatus::PRECONDITION_NOT_MET:
onReceiverError(data);
return ::OpenRTM::PORT_ERROR;
break;
-
case BufferStatus::TIMEOUT:
onBufferWriteTimeout(data);
onReceiverTimeout(data);
return ::OpenRTM::BUFFER_TIMEOUT;
break;
-
default:
return ::OpenRTM::UNKNOWN_ERROR;
}
-
-
}
-
}; // namespace RTC
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.h 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortSHMProvider.h 2017-12-11 09:25:07 UTC (rev 3130)
@@ -188,52 +188,52 @@
::OpenRTM::PortStatus
convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
}
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
}
- inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ inline void onBufferWriteTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
}
- inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
+ inline void onBufferWriteOverwrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
}
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
}
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
}
- inline void onReceiverTimeout(const cdrMemoryStream& data)
+ inline void onReceiverTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
}
- inline void onReceiverError(const cdrMemoryStream& data)
+ inline void onReceiverError(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
@@ -240,12 +240,15 @@
}
private:
+ mutable Logger rtclog;
+
+ InPortConnector* m_connector;
CdrBufferBase* m_buffer;
- ::OpenRTM::PortSharedMemory_var m_objref;
ConnectorListeners* m_listeners;
ConnectorInfo m_profile;
- InPortConnector* m_connector;
+ ::OpenRTM::PortSharedMemory_var m_objref;
+
}; // class InPortCorCdrbaProvider
}; // namespace RTC
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.cpp 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.cpp 2017-12-11 09:25:07 UTC (rev 3130)
@@ -30,12 +30,12 @@
* @endif
*/
OutPortSHMConsumer::OutPortSHMConsumer()
- : m_listeners(NULL)
+ : rtclog("OutPortSHMConsumer"),
+ m_buffer(NULL),
+ m_listeners(NULL)
{
- rtclog.setName("OutPortSHMConsumer");
-
}
-
+
/*!
* @if jp
* @brief デストラクタ
@@ -46,13 +46,13 @@
OutPortSHMConsumer::~OutPortSHMConsumer()
{
try
- {
+ {
_ptr()->close_memory(true);
- }
+ }
catch(...)
- {
- }
- }
+ {
+ }
+ }
/*!
* @if jp
@@ -63,8 +63,7 @@
*/
void OutPortSHMConsumer::init(coil::Properties& prop)
{
- RTC_TRACE(("OutPortSHMConsumer::init()"));
-
+ RTC_TRACE(("OutPortSHMConsumer::init()"));
}
/*!
@@ -98,12 +97,12 @@
bool OutPortSHMConsumer::setObject(CORBA::Object_ptr obj)
{
RTC_PARANOID(("setObject()"));
- if (CorbaConsumer< ::OpenRTM::PortSharedMemory >::setObject(obj))
- {
- //::OpenRTM::PortSharedMemory_var sm = m_shmem.getObjRef();
- _ptr()->setInterface(m_shmem._this());
- return true;
- }
+ if (CorbaConsumer< ::OpenRTM::PortSharedMemory >::setObject(obj))
+ {
+ //::OpenRTM::PortSharedMemory_var sm = m_shmem.getObjRef();
+ _ptr()->setInterface(m_shmem._this());
+ return true;
+ }
return false;
@@ -123,35 +122,30 @@
try
{
-
- Guard guard(m_mutex);
-
+ Guard guard(m_mutex);
- ::OpenRTM::PortStatus ret(_ptr()->get());
- if (ret == ::OpenRTM::PORT_OK)
- {
- m_shmem.read(data);
+ ::OpenRTM::PortStatus ret(_ptr()->get());
+ if (ret == ::OpenRTM::PORT_OK)
+ {
+ m_shmem.read(data);
- RTC_DEBUG(("get() successful"));
+ RTC_DEBUG(("get() successful"));
+ RTC_PARANOID(("CDR data length: %d", data.bufSize()));
- RTC_PARANOID(("CDR data length: %d", data.bufSize()));
+ onReceived(data);
+ onBufferWrite(data);
- onReceived(data);
- onBufferWrite(data);
-
- if (m_buffer->full())
- {
- RTC_INFO(("InPort buffer is full."));
- onBufferFull(data);
- onReceiverFull(data);
- }
- m_buffer->put(data);
- m_buffer->advanceWptr();
- m_buffer->advanceRptr();
-
- return PORT_OK;
- }
-
+ if (m_buffer->full())
+ {
+ RTC_INFO(("InPort buffer is full."));
+ onBufferFull(data);
+ onReceiverFull(data);
+ }
+ m_buffer->put(data);
+ m_buffer->advanceWptr();
+ m_buffer->advanceRptr();
+ return PORT_OK;
+ }
return convertReturn(ret, data);
}
catch (...)
@@ -162,7 +156,7 @@
RTC_ERROR(("OutPortSHMConsumer::get(): Never comes here."));
return UNKNOWN_ERROR;
}
-
+
/*!
* @if jp
* @brief データ受信通知への登録
@@ -182,7 +176,7 @@
RTC_DEBUG(("dataport.corba_cdr.outport_ior not found."));
return false;
}
-
+
if (NVUtil::isString(properties,
"dataport.corba_cdr.outport_ior"))
{
@@ -203,10 +197,10 @@
}
return ret;
}
-
+
return false;
}
-
+
/*!
* @if jp
* @brief データ受信通知からの登録解除
@@ -226,7 +220,7 @@
RTC_DEBUG(("dataport.corba_cdr.outport_ior not found."));
return;
}
-
+
const char* ior;
if (properties[index].value >>= ior)
{
@@ -260,40 +254,31 @@
// never comes here
return PORT_OK;
break;
-
case ::OpenRTM::PORT_ERROR:
onSenderError();
return PORT_ERROR;
break;
-
case ::OpenRTM::BUFFER_FULL:
// never comes here
return BUFFER_FULL;
break;
-
case ::OpenRTM::BUFFER_EMPTY:
onSenderEmpty();
return BUFFER_EMPTY;
break;
-
case ::OpenRTM::BUFFER_TIMEOUT:
onSenderTimeout();
return BUFFER_TIMEOUT;
break;
-
case ::OpenRTM::UNKNOWN_ERROR:
onSenderError();
return UNKNOWN_ERROR;
break;
-
default:
onSenderError();
return UNKNOWN_ERROR;
}
-
}
-
-
}; // namespace RTC
extern "C"
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.h 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMConsumer.h 2017-12-11 09:25:07 UTC (rev 3130)
@@ -32,7 +32,7 @@
* @class OutPortSHMConsumer
* @brief OutPortSHMConsumer クラス
*
- * OutPortConsumer
+ * OutPortConsumer
*
* 通信手段に 共有メモリ を利用した出力ポートプロバイダーの実装クラス。
*
@@ -42,8 +42,8 @@
* @class OutPortSHMConsumer
* @brief OutPortSHMConsumer class
*
- *
*
+ *
* @since 0.4.0
*
* @endif
@@ -84,14 +84,12 @@
*
* @endif
*/
- virtual ~OutPortSHMConsumer();
+ virtual ~OutPortSHMConsumer();
/*!
* @if jp
* @brief 設定初期化
*
- *
- *
* @param prop 設定情報
*
* @else
@@ -98,8 +96,6 @@
*
* @brief Initializing configuration
*
- *
- *
* @param prop Configuration information
*
* @endif
@@ -110,15 +106,11 @@
* @if jp
* @brief バッファをセットする
*
- *
- *
* @param buffer OutPortProviderがデータを取り出すバッファへのポインタ
*
* @else
* @brief Setting outside buffer's pointer
*
- *
- *
* @param buffer A pointer to a data buffer to be used by OutPortProvider
*
* @endif
@@ -129,16 +121,12 @@
* @if jp
* @brief リスナを設定する。
*
- *
- *
* @param info 接続情報
* @param listeners リスナオブジェクト
*
* @else
- * @brief Set the listener.
+ * @brief Set the listener.
*
- *
- *
* @param info Connector information
* @param listeners Listener objects
*
@@ -193,7 +181,7 @@
* @endif
*/
virtual bool subscribeInterface(const SDOPackage::NVList& properties);
-
+
/*!
* @if jp
* @brief データ受信通知からの登録解除
@@ -213,7 +201,7 @@
*/
virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
virtual bool setObject(CORBA::Object_ptr obj);
-
+
private:
/*!
* @if jp
@@ -227,7 +215,7 @@
/*!
* @if jp
- * @brief ON_BUFFER_WRITE のリスナへ通知する。
+ * @brief ON_BUFFER_WRITE のリスナへ通知する。
* @param data cdrMemoryStream
* @else
* @brief Notify an ON_BUFFER_WRITE event to listeners
@@ -234,7 +222,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
@@ -242,7 +230,7 @@
/*!
* @if jp
- * @brief ON_BUFFER_FULL のリスナへ通知する。
+ * @brief ON_BUFFER_FULL のリスナへ通知する。
* @param data cdrMemoryStream
* @else
* @brief Notify an ON_BUFFER_FULL event to listeners
@@ -249,7 +237,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
@@ -257,7 +245,7 @@
/*!
* @if jp
- * @brief ON_RECEIVED のリスナへ通知する。
+ * @brief ON_RECEIVED のリスナへ通知する。
* @param data cdrMemoryStream
* @else
* @brief Notify an ON_RECEIVED event to listeners
@@ -264,7 +252,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -272,7 +260,7 @@
/*!
* @if jp
- * @brief ON_RECEIVER_FULL のリスナへ通知する。
+ * @brief ON_RECEIVER_FULL のリスナへ通知する。
* @param data cdrMemoryStream
* @else
* @brief Notify an ON_RECEIVER_FULL event to listeners
@@ -279,7 +267,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
@@ -287,7 +275,7 @@
/*!
* @if jp
- * @brief ON_SENDER_EMPTYのリスナへ通知する。
+ * @brief ON_SENDER_EMPTYのリスナへ通知する。
* @else
* @brief Notify an ON_SENDER_EMPTY event to listeners
* @endif
@@ -300,7 +288,7 @@
/*!
* @if jp
- * @brief ON_SENDER_TIMEOUT のリスナへ通知する。
+ * @brief ON_SENDER_TIMEOUT のリスナへ通知する。
* @else
* @brief Notify an ON_SENDER_TIMEOUT event to listeners
* @endif
@@ -313,7 +301,7 @@
/*!
* @if jp
- * @brief ON_SENDER_ERRORのリスナへ通知する。
+ * @brief ON_SENDER_ERRORのリスナへ通知する。
* @else
* @Brief Notify an ON_SENDER_ERROR event to listeners
* @endif
@@ -325,17 +313,14 @@
}
protected:
// RTC::OutPortCdr_var m_outport;
+ coil::Mutex m_mutex;
mutable Logger rtclog;
- coil::Properties m_properties;
- coil::Mutex m_mutex;
- std::string m_shm_address;
+
SharedMemoryPort m_shmem;
- int m_memory_size;
- bool m_endian;
- CdrBufferBase* m_buffer;
- ConnectorListeners* m_listeners;
- ConnectorInfo m_profile;
+ CdrBufferBase* m_buffer;
+ ConnectorListeners* m_listeners;
+ ConnectorInfo m_profile;
};
}; // namespace RTC
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.cpp 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.cpp 2017-12-11 09:25:07 UTC (rev 3130)
@@ -32,18 +32,21 @@
* @endif
*/
OutPortSHMProvider::OutPortSHMProvider(void)
- : m_buffer(0),
- m_memory_size(0)
+ : rtclog("OutPortSHMProvider"),
+ m_memorySize(0),
+ m_connector(0),
+ m_buffer(0),
+ m_listeners(0)
{
// PortProfile setting
setInterfaceType("shared_memory");
-
+
// ConnectorProfile setting
#ifdef ORB_IS_OMNIORB
::RTC::Manager::instance().theShortCutPOA()->activate_object(this);
#endif
m_objref = this->_this();
-
+
// set outPort's reference
CORBA::ORB_var orb = ::RTC::Manager::instance().getORB();
CORBA::String_var ior = orb->object_to_string(m_objref.in());
@@ -63,9 +66,9 @@
coil::UUID_Generator uugen;
uugen.init();
std::auto_ptr<coil::UUID> uuid(uugen.generateUUID(2, 0x01));
- m_shm_address = uuid->to_string();
+ m_shmAddress = uuid->to_string();
}
-
+
/*!
* @if jp
* @brief デストラクタ
@@ -77,7 +80,7 @@
{
}
-
+
/*!
* @if jp
* @brief 設定初期化
@@ -87,29 +90,28 @@
*/
void OutPortSHMProvider::init(coil::Properties& prop)
{
- std::string ds = prop["shem_default_size"];
- m_memory_size = string_to_MemorySize(ds);
+ std::string ds = prop["shem_default_size"];
+ m_memorySize = string_to_MemorySize(ds);
- if (prop.hasKey("serializer") == NULL)
- {
- m_endian = true;
- return;
- }
+ if (prop.hasKey("serializer") == NULL)
+ {
+ m_endian = true;
+ return;
+ }
-
- std::string endian_type(prop.getProperty("serializer.cdr.endian", ""));
- coil::normalize(endian_type);
- std::vector<std::string> endian(coil::split(endian_type, ","));
- if (endian.empty()) { return; }
- if (endian[0] == "little")
- {
- m_endian = true;
- }
- else if (endian[0] == "big")
- {
- m_endian = false;
- return;
- }
+ std::string endian_type(prop.getProperty("serializer.cdr.endian", ""));
+ coil::normalize(endian_type);
+ std::vector<std::string> endian(coil::split(endian_type, ","));
+ if (endian.empty()) { return; }
+ if (endian[0] == "little")
+ {
+ m_endian = true;
+ }
+ else if (endian[0] == "big")
+ {
+ m_endian = false;
+ return;
+ }
}
/*!
@@ -128,7 +130,7 @@
* @if jp
* @brief リスナを設定する。
* @else
- * @brief Set the listener.
+ * @brief Set the listener.
* @endif
*/
void OutPortSHMProvider::setListener(ConnectorInfo& info,
@@ -157,14 +159,12 @@
* @brief [CORBA interface] Get data from the buffer
* @endif
*/
- ::OpenRTM::PortStatus
- OutPortSHMProvider::get()
+ ::OpenRTM::PortStatus OutPortSHMProvider::get()
throw (CORBA::SystemException)
{
RTC_PARANOID(("OutPortSHMProvider::get()"));
// at least the output "data" area should be allocated
-
if (m_buffer == 0)
{
onSenderError();
@@ -178,19 +178,20 @@
#ifdef ORB_IS_ORBEXPRESS
CORBA::ULong len((CORBA::ULong)cdr.cdr.size_written());
#elif defined(ORB_IS_TAO)
- CORBA::ULong len((CORBA::ULong)cdr.cdr.length());
+ CORBA::ULong len((CORBA::ULong)cdr.cdr.length());
#else
CORBA::ULong len((CORBA::ULong)cdr.bufSize());
#endif
RTC_PARANOID(("converted CDR data size: %d", len));
- if (len == (CORBA::ULong)0) {
- RTC_ERROR(("buffer is empty."));
- return ::OpenRTM::BUFFER_EMPTY;
- }
- bool endian_type = m_connector->isLittleEndian();
- setEndian(endian_type);
- create_memory(m_memory_size, m_shm_address.c_str());
- write(cdr);
+ if (len == (CORBA::ULong)0)
+ {
+ RTC_ERROR(("buffer is empty."));
+ return ::OpenRTM::BUFFER_EMPTY;
+ }
+ bool endian_type = m_connector->isLittleEndian();
+ setEndian(endian_type);
+ create_memory(m_memorySize, m_shmAddress.c_str());
+ write(cdr);
}
return convertReturn(ret, cdr);
@@ -205,7 +206,7 @@
*/
::OpenRTM::PortStatus
OutPortSHMProvider::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
@@ -214,40 +215,32 @@
onSend(data);
return ::OpenRTM::PORT_OK;
break;
-
case BufferStatus::BUFFER_ERROR:
onSenderError();
return ::OpenRTM::PORT_ERROR;
break;
-
case BufferStatus::BUFFER_FULL:
// never come here
return ::OpenRTM::BUFFER_FULL;
break;
-
case BufferStatus::BUFFER_EMPTY:
onBufferEmpty();
onSenderEmpty();
return ::OpenRTM::BUFFER_EMPTY;
break;
-
case BufferStatus::PRECONDITION_NOT_MET:
onSenderError();
return ::OpenRTM::PORT_ERROR;
break;
-
case BufferStatus::TIMEOUT:
onBufferReadTimeout();
onSenderTimeout();
return ::OpenRTM::BUFFER_TIMEOUT;
break;
-
default:
return ::OpenRTM::UNKNOWN_ERROR;
}
-
}
-
}; // namespace RTC
extern "C"
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.h 2017-12-11 09:21:07 UTC (rev 3129)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortSHMProvider.h 2017-12-11 09:25:07 UTC (rev 3130)
@@ -36,7 +36,7 @@
* @class OutPortSHMProvider
* @brief OutPortSHMProvider クラス
*
- * OutPortProvider
+ * OutPortProvider
*
* 通信手段に 共有メモリ を利用した出力ポートプロバイダの実装クラス。
*
@@ -46,8 +46,8 @@
* @class OutPortSHMProvider
* @brief OutPortSHMProvider class
*
- *
*
+ *
* @since 1.2.0
*
* @endif
@@ -197,7 +197,7 @@
* @endif
*/
::OpenRTM::PortStatus convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
@@ -209,7 +209,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferRead(const cdrMemoryStream& data)
+ inline void onBufferRead(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_READ].notify(m_profile, data);
@@ -224,7 +224,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onSend(const cdrMemoryStream& data)
+ inline void onSend(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_SEND].notify(m_profile, data);
@@ -294,15 +294,18 @@
m_listeners->
connector_[ON_SENDER_ERROR].notify(m_profile);
}
-
+
private:
+ mutable Logger rtclog;
+ int m_memorySize;
+ std::string m_shmAddress;
+
+ OutPortConnector* m_connector;
CdrBufferBase* m_buffer;
- ::OpenRTM::PortSharedMemory_var m_objref;
ConnectorListeners* m_listeners;
ConnectorInfo m_profile;
- OutPortConnector* m_connector;
- std::string m_shm_address;
- int m_memory_size;
+
+ ::OpenRTM::PortSharedMemory_var m_objref;
}; // class OutPortCorbaCdrProvider
}; // namespace RTC
More information about the openrtm-commit
mailing list