[openrtm-commit:02988] r3122 - branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 12月 11日 (月) 09:49:35 JST
Author: n-ando
Date: 2017-12-11 09:49:35 +0900 (Mon, 11 Dec 2017)
New Revision: 3122
Modified:
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.h
Log:
merged changes from branches/FSM4RTC/OpenRTM-aist r2797, 2806:
[compat,formatting,->RELENG_1_2,->RELENG_2_0] Braces added.
[incompat,->RELENG_1_2,->RELENG_2_0] std::ostream operations have been added to NVUtil.
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp 2017-12-11 00:45:25 UTC (rev 3121)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp 2017-12-11 00:49:35 UTC (rev 3122)
@@ -44,7 +44,7 @@
{
m_buffer = createBuffer(info);
}
- if (m_buffer == 0 || m_provider==0) throw std::bad_alloc();
+ if (m_buffer == 0 || m_provider == 0) { throw std::bad_alloc(); }
m_buffer->init(info.properties.getNode("buffer"));
m_provider->init(info.properties);
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.cpp 2017-12-11 00:45:25 UTC (rev 3121)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.cpp 2017-12-11 00:49:35 UTC (rev 3122)
@@ -123,7 +123,7 @@
#else // ORB_IS_RTORB
nv[i].name = (char *)keys[i].c_str();
#endif // ORB_IS_RTORB
- nv[i].value <<= prop[keys[i]].c_str();
+ nv[i].value <<= prop[keys[i]].c_str();
}
}
@@ -138,12 +138,12 @@
{
for (CORBA::ULong i(0), len(nv.length()); i < len; ++i)
{
- const char* value;
- if (nv[i].value >>= value)
- {
- const char* name(nv[i].name);
- prop[name] = value;
- };
+ const char* value;
+ if (nv[i].value >>= value)
+ {
+ const char* name(nv[i].name);
+ prop[name] = value;
+ };
}
}
@@ -163,9 +163,9 @@
{
const char* value;
if (nv.value >>= value)
- {
- m_prop.setProperty(CORBA::string_dup(nv.name), value);
- };
+ {
+ m_prop.setProperty(CORBA::string_dup(nv.name), value);
+ }
}
coil::Properties m_prop;
};
@@ -240,14 +240,14 @@
{
try
{
- CORBA::Any value;
- value = find(nv, name);
- const char* str_value;
- return value >>= str_value;
+ CORBA::Any value;
+ value = find(nv, name);
+ const char* str_value;
+ return value >>= str_value;
}
catch (...)
{
- return false;
+ return false;
}
}
@@ -260,14 +260,14 @@
* @endif
*/
bool isStringValue(const SDOPackage::NVList& nv,
- const char* name, const char* value)
+ const char* name, const char* value)
{
if (isString(nv, name))
{
- if (toString(nv, name) == value)
- {
- return true;
- }
+ if (toString(nv, name) == value)
+ {
+ return true;
+ }
}
return false;
}
@@ -284,19 +284,19 @@
const char* str_value;
try
{
- if(!(find(nv, name) >>= str_value))
+ if(!(find(nv, name) >>= str_value))
{
- str_value = "";
+ str_value = "";
}
}
catch (...)
{
- str_value = "";
+ str_value = "";
}
if (str_value == NULL)
{
- str_value = "";
+ str_value = "";
}
return str_value;
@@ -324,22 +324,22 @@
if (index < 0)
{
- CORBA_SeqUtil::push_back(nv, newNV(name, value));
+ CORBA_SeqUtil::push_back(nv, newNV(name, value));
}
else
{
- const char* tmp_char;
- nv[index].value >>= tmp_char;
- std::string tmp_str(tmp_char);
-
- std::vector<std::string> values;
- values = coil::split(tmp_str, ",");
- if (values.end() == std::find(values.begin(), values.end(), value))
- {
- tmp_str.append(",");
- tmp_str.append(value);
- nv[index].value <<= tmp_str.c_str();
- }
+ const char* tmp_char;
+ nv[index].value >>= tmp_char;
+ std::string tmp_str(tmp_char);
+
+ std::vector<std::string> values;
+ values = coil::split(tmp_str, ",");
+ if (values.end() == std::find(values.begin(), values.end(), value))
+ {
+ tmp_str.append(",");
+ tmp_str.append(value);
+ nv[index].value <<= tmp_str.c_str();
+ }
}
return true;
}
@@ -355,33 +355,56 @@
{
for (CORBA::ULong i = 0, len = src.length(); i < len; ++i)
{
- CORBA_SeqUtil::push_back(dest, src[i]);
+ CORBA_SeqUtil::push_back(dest, src[i]);
}
}
/*!
* @if jp
+ * @brief NameValue ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£
+ * @else
+ * @brief Print information configured in NVList as a string type
+ * @endif
+ */
+ std::ostream& dump_to_stream(std::ostream& out,
+ const SDOPackage::NameValue& nv)
+ {
+ const char* str_value;
+ if (nv.value >>= str_value)
+ {
+ out << nv.name << ": " << str_value << std::endl;
+ }
+ else
+ {
+ out << nv.name << ": not a string value" << std::endl;
+ }
+ return out;
+ }
+ std::ostream& operator<<(std::ostream& os, const SDOPackage::NameValue& nv)
+ {
+ return dump_to_stream(os, nv);
+ }
+
+ /*!
+ * @if jp
* @brief NVList ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£
* @else
* @brief Print information configured in NVList as a string type
* @endif
*/
- std::ostream& dump_to_stream(std::ostream& out, const SDOPackage::NVList& nv)
+ std::ostream& dump_to_stream(std::ostream& out,
+ const SDOPackage::NVList& nv)
{
for (CORBA::ULong i(0), n(nv.length()); i < n; ++i)
{
- const char* str_value;
- if (nv[i].value >>= str_value)
- {
- out << nv[i].name << ": " << str_value << std::endl;
- }
- else
- {
- out << nv[i].name << ": not a string value" << std::endl;
- }
+ out << nv[i] << std::endl;
}
return out;
}
+ std::ostream& operator<<(std::ostream& os, const SDOPackage::NVList& nvlist)
+ {
+ return dump_to_stream(os, nvlist);
+ }
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.h 2017-12-11 00:45:25 UTC (rev 3121)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/NVUtil.h 2017-12-11 00:49:35 UTC (rev 3122)
@@ -536,8 +536,60 @@
/*!
* @if jp
*
+ * @brief NameValue ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£
+ *
+ * »ØÄꤵ¤ì¤¿ NVList ¤ËÀßÄꤵ¤ì¤¿ÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£¤Ê¤ª¡¢Àß
+ * Äꤵ¤ì¤Æ¤¤¤ëÍ×ÁǤ¬Ê¸»úÎ󷿰ʳ°¤Î¾ì¹ç¤Ë¤Ï¡¢¤½¤Î»Ý(ʸ»úÎó¤Ç¤Ï¤Ê¤¤)¤ò
+ * ½ÐÎϤ¹¤ë¡£
+ *
+ * @param nv ½ÐÎÏÂÐ¾Ý NameValue
+ *
+ * @else
+ *
+ * @brief Print information configured in NameValue as string type
+ *
+ * Print configured information as string type in specified NVList.
+ * Also, print the reason (this is not string type) if the configured
+ * element is other than string type.
+ *
+ * @param nv The target NameValue for the print
+ *
+ * @endif
+ */
+ std::ostream& dump_to_stream(std::ostream& out,
+ const SDOPackage::NameValue& nv);
+ std::ostream& operator<<(std::ostream& os, const SDOPackage::NameValue& nv);
+
+/*!
+ * @if jp
+ *
* @brief NVList ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£
*
+ * »ØÄꤵ¤ì¤¿ NVList ¤ËÀßÄꤵ¤ì¤¿ÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£¤Ê¤ª¡¢Àß
+ * Äꤵ¤ì¤Æ¤¤¤ëÍ×ÁǤ¬Ê¸»úÎ󷿰ʳ°¤Î¾ì¹ç¤Ë¤Ï¡¢¤½¤Î»Ý(ʸ»úÎó¤Ç¤Ï¤Ê¤¤)¤ò
+ * ½ÐÎϤ¹¤ë¡£
+ *
+ * @param nv ½ÐÎÏÂÐ¾Ý NVList
+ *
+ * @else
+ *
+ * @brief Print information configured in NVList as string type
+ *
+ * Print configured information as string type in specified NVList.
+ * Also, print the reason (this is not string type) if the configured
+ * element is other than string type.
+ *
+ * @param nv The target NVList for the print
+ *
+ * @endif
+ */
+ std::ostream& operator<<(std::ostream& os, const SDOPackage::NVList& nvlist);
+
+ /*!
+ * @if jp
+ *
+ * @brief NVList ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ëÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£
+ *
* »ØÄꤵ¤ì¤¿ NVList ¤ËÀßÄꤵ¤ì¤¿ÆâÍƤòʸ»úÎó¤È¤·¤Æ½ÐÎϤ¹¤ë¡£
* ¤Ê¤ª¡¢ÀßÄꤵ¤ì¤Æ¤¤¤ëÍ×ÁǤ¬Ê¸»úÎ󷿰ʳ°¤Î¾ì¹ç¤Ë¤Ï¡¢¤½¤Î»Ý(ʸ»úÎó¤Ç¤Ï¤Ê¤¤)¤ò
* ½ÐÎϤ¹¤ë¡£
@@ -588,7 +640,7 @@
* @endif
*/
std::string toString(const SDOPackage::NVList& nv);
-
+
};
#endif // NVUTIL_NVUTIL_H
More information about the openrtm-commit
mailing list