Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

NVUtil.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00020 /*
00021  * $Log: NVUtil.h,v $
00022  * Revision 1.6  2007/04/23 04:54:32  n-ando
00023  * Conversion functions between Properties and NVList were added.
00024  *
00025  * Revision 1.5  2007/01/12 14:33:57  n-ando
00026  * The dump() function was added to dump NVList entries.
00027  *
00028  * Revision 1.4  2007/01/06 17:55:35  n-ando
00029  * toProperties()'s argument was changed to const.
00030  * Some functions were added.
00031  * - isStringValue()
00032  * - appendStringValue()
00033  * - append()
00034  *
00035  * Revision 1.3  2006/11/27 09:54:48  n-ando
00036  * Conversion function from NVList to Properties: toProperties() was added.
00037  *
00038  * Revision 1.2  2006/11/10 04:46:15  n-ando
00039  * Kanji-code was changed to EUC.
00040  *
00041  * Revision 1.1  2006/11/10 04:32:46  n-ando
00042  * NVUtil is SDOPackage::NVList utility.
00043  *
00044  *
00045  */
00046 
00047 #ifndef NVUtil_h
00048 #define NVUtil_h
00049 
00050 #include <string>
00051 #include <iostream>
00052 #include <rtm/idl/SDOPackageSkel.h>
00053 #include <rtm/Properties.h>
00054 
00055 namespace NVUtil
00056 {
00085   template <class Value>
00086   SDOPackage::NameValue newNV(const char* name, Value value)
00087   {
00088     SDOPackage::NameValue nv;
00089     nv.name = CORBA::string_dup(name);
00090     nv.value <<= value;
00091     return nv;
00092   }
00093 
00094 
00118   /*
00119   template <>
00120   SDOPackage::NameValue newNV(const char* name, const char* value)
00121   {
00122     SDOPackage::NameValue nv;
00123     nv.name = CORBA::string_dup(name);
00124     nv.value <<= value;
00125     return nv;
00126   }
00127    */ 
00128 
00152   SDOPackage::NameValue newNVChar(const char* name, const CORBA::Char value);
00153     
00154 
00178   SDOPackage::NameValue newNVBool(const char* name,
00179                                   const CORBA::Boolean value);
00180 
00181     
00205   SDOPackage::NameValue newNVOctet(const char* name, const CORBA::Octet value);
00206 
00207   SDOPackage::NameValue newNVAny(const char* name, const CORBA::Any& value);
00208 
00209 
00210 
00234   void copyFromProperties(SDOPackage::NVList& nv, const RTC::Properties& prop);
00235 
00236   void copyToProperties(RTC::Properties& prop, const SDOPackage::NVList& nv);
00237   RTC::Properties toProperties(const SDOPackage::NVList& nv);
00238 
00261   const CORBA::Any& find(const SDOPackage::NVList& nv, const char* name);
00262   const CORBA::Long find_index(const SDOPackage::NVList& nv, const char* name);
00263 
00287   bool isString(const SDOPackage::NVList& nv, const char* name);
00288   bool isStringValue(const SDOPackage::NVList& nv, const char* name,
00289                      const char* value);
00290 
00318   std::string toString(const SDOPackage::NVList& nv, const char* name);
00319 
00320 
00321 
00322   bool appendStringValue(SDOPackage::NVList& nv, const char* name,
00323                          const char* value);
00324 
00325   void append(SDOPackage::NVList& dest, const SDOPackage::NVList& src);
00326 
00327   void dump(SDOPackage::NVList& nv);
00328 
00329 
00330 };
00331 
00332 #endif // NVUtil_h

Generated on Fri Oct 5 05:15:59 2007 for OpenRTM by  doxygen 1.4.1