OpenRTM-aist  2.1.0
NVUtil.h
[詳解]
1 // -*- C++ -*-
20 #ifndef NVUTIL_NVUTIL_H
21 #define NVUTIL_NVUTIL_H
22 
23 #include <coil/Properties.h>
24 #include <rtm/idl/SDOPackageSkel.h>
25 
26 #include <string>
27 #include <iostream>
28 
47 namespace NVUtil
48 {
79  template <class Value>
80  SDOPackage::NameValue newNV(const char* name, Value value)
81  {
82  SDOPackage::NameValue nv;
83  nv.name = CORBA::string_dup(name);
84  nv.value <<= value;
85  return nv;
86  }
87 
88  /***
89  * @if jp
90  *
91  * @brief value が CORBA::string の NameValue を生成する
92  *
93  * このオペレーションはf value が CORBA::string の NameValueを作成する。
94  *
95  * @param name NameValue の name
96  * @param value NameValue の value
97  *
98  * @return NameValue
99  *
100  * @else
101  *
102  * @brief Create NameValue typed CORBA::string
103  *
104  * This operation creates NameValue typed CORBA::string.
105  *
106  * @param name Name of NameValue
107  * @param value The value of NameValue
108  *
109  * @return NameValue
110  *
111  * @endif
112  */
113  /*
114  template <>
115  SDOPackage::NameValue newNV(const char* name, const char* value)
116  {
117  SDOPackage::NameValue nv;
118  nv.name = CORBA::string_dup(name);
119  nv.value <<= value;
120  return nv;
121  }
122  */
123 
149  SDOPackage::NameValue newNVChar(const char* name, CORBA::Char value);
150 
176  SDOPackage::NameValue newNVBool(const char* name,
177  CORBA::Boolean value);
178 
204  SDOPackage::NameValue newNVOctet(const char* name, CORBA::Octet value);
205 
231  SDOPackage::NameValue newNVAny(const char* name, const CORBA::Any& value);
232 
256 #ifndef ORB_IS_RTORB
257  void copyFromProperties(SDOPackage::NVList& nv, const coil::Properties& prop);
258 #else // ORB_IS_RTORB
259  void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop);
260 #endif // ORB_IS_RTORB
261 
285 #ifndef ORB_IS_RTORB
286  void mergeFromProperties(SDOPackage::NVList& nv, const coil::Properties& prop);
287 #else // ORB_IS_RTORB
288  void mergeFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop);
289 #endif // ORB_IS_RTORB
290 
312  void copyToProperties(coil::Properties& prop, const SDOPackage::NVList& nv);
313 
337  coil::Properties toProperties(const SDOPackage::NVList& nv);
338 
366  const CORBA::Any& find(const SDOPackage::NVList& nv, const char* name);
367 
395  CORBA::Long find_index(const SDOPackage::NVList& nv, const char* name);
396 
424  bool isString(const SDOPackage::NVList& nv, const char* name);
425 
457  bool isStringValue(const SDOPackage::NVList& nv, const char* name,
458  const char* value);
459 
489  std::string toString(const SDOPackage::NVList& nv, const char* name);
490 
533 #ifndef ORB_IS_RTORB
534  bool appendStringValue(SDOPackage::NVList& nv, const char* name,
535  const char* value);
536 #else // ORB_IS_RTORB
537  bool appendStringValue(SDOPackage_NVList& nv, const char* name,
538  const char* value);
539 #endif // ORB_IS_RTORB
540 
564  void append(SDOPackage::NVList& dest, const SDOPackage::NVList& src);
565 
589  std::ostream& dump_to_stream(std::ostream& out,
590  const SDOPackage::NameValue& nv);
591  std::ostream& operator<<(std::ostream& os, const SDOPackage::NameValue& nv);
592 
616  std::ostream& operator<<(std::ostream& os, const SDOPackage::NVList& nvlist);
617 
641  std::ostream& dump(std::ostream& out, const SDOPackage::NVList& nv);
642 
657  void dump(const SDOPackage::NVList& nv);
658 
672  std::string toString(const SDOPackage::NVList& nv);
673 
674 
675 } // namespace NVUtil
676 #endif // NVUTIL_NVUTIL_H
NameValue 用ユーティリティ
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
NVList を Properties へコピーする
coil::Properties toProperties(const SDOPackage::NVList &nv)
NVList を Properties へ変換する
SDOPackage::NameValue newNVOctet(const char *name, CORBA::Octet value)
value が CORBA::Octet の NameValue を生成する
CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
name で指定された要素のインデックスを返す
bool isString(const SDOPackage::NVList &nv, const char *name)
指定された name の value の型が string であるか検証する
SDOPackage::NameValue newNVAny(const char *name, const CORBA::Any &value)
value が CORBA::Any の NameValue を生成する
std::string toString(const SDOPackage::NVList &nv, const char *name)
指定された name の NVList を string として返す。
void append(SDOPackage::NVList &dest, const SDOPackage::NVList &src)
NVList に要素を追加する。
void mergeFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Properties を NVList にマージする
const CORBA::Any & find(const SDOPackage::NVList &nv, const char *name)
NVList から name で指定された value を返す
void copyFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Properties を NVList へコピーする
std::ostream & operator<<(std::ostream &os, const SDOPackage::NameValue &nv)
std::ostream & dump_to_stream(std::ostream &out, const SDOPackage::NameValue &nv)
NameValue に設定されている内容を文字列として出力する。
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
指定された文字列を NVList の要素に追加する。
SDOPackage::NameValue newNV(const char *name, Value value)
NameValue を生成する
Definition: NVUtil.h:80
SDOPackage::NameValue newNVBool(const char *name, CORBA::Boolean value)
value が CORBA::Boolean の NameValue を生成する
bool isStringValue(const SDOPackage::NVList &nv, const char *name, const char *value)
指定された name の value の値が指定した文字列と一致するか検証する
std::ostream & dump(std::ostream &out, const SDOPackage::NVList &nv)
NVList に設定されている内容を文字列として出力する。
SDOPackage::NameValue newNVChar(const char *name, CORBA::Char value)
value が CORBA::Char の NameValue を生成する
coil::Properties Properties
Definition: RTC.h:72