OpenRTM-aist  1.2.1
NVUtil.h
Go to the documentation of this file.
1 // -*- C++ -*-
20 #ifndef NVUTIL_NVUTIL_H
21 #define NVUTIL_NVUTIL_H
22 
23 #include <string>
24 #include <iostream>
25 #include <coil/Properties.h>
26 #include <rtm/idl/SDOPackageSkel.h>
27 
46 namespace NVUtil
47 {
78  template <class Value>
79  SDOPackage::NameValue newNV(const char* name, Value value)
80  {
81  SDOPackage::NameValue nv;
82  nv.name = CORBA::string_dup(name);
83  nv.value <<= value;
84  return nv;
85  }
86 
87  /***
88  * @if jp
89  *
90  * @brief value が CORBA::string の NameValue を生成する
91  *
92  * このオペレーションはf value が CORBA::string の NameValueを作成する。
93  *
94  * @param name NameValue の name
95  * @param value NameValue の value
96  *
97  * @return NameValue
98  *
99  * @else
100  *
101  * @brief Create NameValue typed CORBA::string
102  *
103  * This operation creates NameValue typed CORBA::string.
104  *
105  * @param name Name of NameValue
106  * @param value The value of NameValue
107  *
108  * @return NameValue
109  *
110  * @endif
111  */
112  /*
113  template <>
114  SDOPackage::NameValue newNV(const char* name, const char* value)
115  {
116  SDOPackage::NameValue nv;
117  nv.name = CORBA::string_dup(name);
118  nv.value <<= value;
119  return nv;
120  }
121  */
122 
148  SDOPackage::NameValue newNVChar(const char* name, const CORBA::Char value);
149 
175  SDOPackage::NameValue newNVBool(const char* name,
176  const CORBA::Boolean value);
177 
203  SDOPackage::NameValue newNVOctet(const char* name, const CORBA::Octet value);
204 
230  SDOPackage::NameValue newNVAny(const char* name, const CORBA::Any& value);
231 
255 #ifndef ORB_IS_RTORB
256  void copyFromProperties(SDOPackage::NVList& nv, const coil::Properties& prop);
257 #else // ORB_IS_RTORB
258  void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop);
259 #endif // ORB_IS_RTORB
260 
282  void copyToProperties(coil::Properties& prop, const SDOPackage::NVList& nv);
283 
307  coil::Properties toProperties(const SDOPackage::NVList& nv);
308 
336  const CORBA::Any& find(const SDOPackage::NVList& nv, const char* name);
337 
365  const CORBA::Long find_index(const SDOPackage::NVList& nv, const char* name);
366 
394  bool isString(const SDOPackage::NVList& nv, const char* name);
395 
427  bool isStringValue(const SDOPackage::NVList& nv, const char* name,
428  const char* value);
429 
459  std::string toString(const SDOPackage::NVList& nv, const char* name);
460 
503 #ifndef ORB_IS_RTORB
504  bool appendStringValue(SDOPackage::NVList& nv, const char* name,
505  const char* value);
506 #else // ORB_IS_RTORB
507  bool appendStringValue(SDOPackage_NVList& nv, const char* name,
508  const char* value);
509 #endif // ORB_IS_RTORB
510 
534  void append(SDOPackage::NVList& dest, const SDOPackage::NVList& src);
535 
559  std::ostream& dump_to_stream(std::ostream& out,
560  const SDOPackage::NameValue& nv);
561  std::ostream& operator<<(std::ostream& os, const SDOPackage::NameValue& nv);
562 
586  std::ostream& operator<<(std::ostream& os, const SDOPackage::NVList& nvlist);
587 
611  std::ostream& dump(std::ostream& out, const SDOPackage::NVList& nv);
612 
627  void dump(const SDOPackage::NVList& nv);
628 
642  std::string toString(const SDOPackage::NVList& nv);
643 
644 
645 };
646 #endif // NVUTIL_NVUTIL_H
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
Definition: NVUtil.h:79
std::ostream & operator<<(std::ostream &os, const SDOPackage::NameValue &nv)
bool isString(const SDOPackage::NVList &nv, const char *name)
Validate whether value type specified by name is string type.
SDOPackage::NameValue newNVOctet(const char *name, const CORBA::Octet value)
Create NameValue typed CORBA::Octet.
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
Append the specified string to element of NVList.
SDOPackage::NameValue newNVBool(const char *name, const CORBA::Boolean value)
Create NameValue typed CORBA::Boolean.
std::ostream & dump_to_stream(std::ostream &out, const SDOPackage::NameValue &nv)
Print information configured in NameValue as string type.
Utility for NameValue.
const CORBA::Any & find(const SDOPackage::NVList &nv, const char *name)
Return the value specified by name from NVList.
const CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
Return the index of element specified by name from NVList.
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
Copy NVList to the Proeprties.
std::string toString(const SDOPackage::NVList &nv, const char *name)
Get NVList of specifid name as string.
void append(SDOPackage::NVList &dest, const SDOPackage::NVList &src)
Append an element to NVList.
std::ostream & dump(std::ostream &out, const SDOPackage::NVList &nv)
Print information configured in NVList as string type.
coil::Properties toProperties(const SDOPackage::NVList &nv)
Transform NVList to the properties.
Class represents a set of properties.
Definition: Properties.h:101
SDOPackage::NameValue newNVChar(const char *name, const CORBA::Char value)
Create NameValue typed CORBA::Char.
Property list class (derived from Java Properties)
bool isStringValue(const SDOPackage::NVList &nv, const char *name, const char *value)
Check whether the value of specified name matches the specified string.
void copyFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Copy the properties to NVList.
SDOPackage::NameValue newNVAny(const char *name, const CORBA::Any &value)
Create NameValue typed CORBA::Any.