[openrtm-commit:02144] r2806 - branches/FSM4RTC/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 11月 27日 (日) 12:15:38 JST
Author: n-ando
Date: 2016-11-27 12:15:38 +0900 (Sun, 27 Nov 2016)
New Revision: 2806
Modified:
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.h
Log:
[incompat,->RELENG_1_2] std::ostream operations have been added to NVUtil.
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.cpp 2016-11-17 17:04:47 UTC (rev 2805)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.cpp 2016-11-27 03:15:38 UTC (rev 2806)
@@ -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/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.h 2016-11-17 17:04:47 UTC (rev 2805)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/NVUtil.h 2016-11-27 03:15:38 UTC (rev 2806)
@@ -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