00001 
00020 #ifndef NVUTIL_NVUTIL_H
00021 #define NVUTIL_NVUTIL_H
00022 
00023 #include <string>
00024 #include <iostream>
00025 #include <coil/Properties.h>
00026 #include <rtm/idl/SDOPackageSkel.h>
00027 
00046 namespace NVUtil
00047 {
00078   template <class Value>
00079   SDOPackage::NameValue newNV(const char* name, Value value)
00080   {
00081     SDOPackage::NameValue nv;
00082     nv.name = CORBA::string_dup(name);
00083     nv.value <<= value;
00084     return nv;
00085   }
00086   
00087   
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112   
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121  
00122   
00148   SDOPackage::NameValue newNVChar(const char* name, const CORBA::Char value);
00149   
00175   SDOPackage::NameValue newNVBool(const char* name,
00176                                   const CORBA::Boolean value);
00177   
00203   SDOPackage::NameValue newNVOctet(const char* name, const CORBA::Octet value);
00204   
00230   SDOPackage::NameValue newNVAny(const char* name, const CORBA::Any& value);
00231   
00255 #ifndef ORB_IS_RTORB
00256   void copyFromProperties(SDOPackage::NVList& nv, const coil::Properties& prop);
00257 #else // ORB_IS_RTORB
00258   void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop);
00259 #endif // ORB_IS_RTORB
00260   
00282   void copyToProperties(coil::Properties& prop, const SDOPackage::NVList& nv);
00283   
00307   coil::Properties toProperties(const SDOPackage::NVList& nv);
00308   
00336   const CORBA::Any& find(const SDOPackage::NVList& nv, const char* name);
00337   
00365   const CORBA::Long find_index(const SDOPackage::NVList& nv, const char* name);
00366   
00394   bool isString(const SDOPackage::NVList& nv, const char* name);
00395   
00427   bool isStringValue(const SDOPackage::NVList& nv, const char* name,
00428                      const char* value);
00429   
00459   std::string toString(const SDOPackage::NVList& nv, const char* name);
00460   
00503 #ifndef ORB_IS_RTORB
00504   bool appendStringValue(SDOPackage::NVList& nv, const char* name,
00505                          const char* value);
00506 #else // ORB_IS_RTORB
00507   bool appendStringValue(SDOPackage_NVList& nv, const char* name,
00508                          const char* value);
00509 #endif // ORB_IS_RTORB
00510   
00534   void append(SDOPackage::NVList& dest, const SDOPackage::NVList& src);
00535   
00559   std::ostream& dump(std::ostream& out, const SDOPackage::NVList& nv);
00560 
00575   void dump(const SDOPackage::NVList& nv);
00576 
00590   std::string toString(const SDOPackage::NVList& nv);
00591   
00592 
00593 };
00594 #endif // NVUTIL_NVUTIL_H