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 ���������� * * ���Υ��ڥ졼������f value �� CORBA::string �� NameValue��������롣 * * @param name NameValue �� name * @param value NameValue �� value * * @return NameValue * * @else * * @brief Create NameValue typed CORBA::string * * This operation creates NameValue typed CORBA::string. * * @param name Name of NameValue * @param value The value of NameValue * * @return NameValue * * @endif */ /* template <> SDOPackage::NameValue newNV(const char* name, const char* value) { SDOPackage::NameValue nv; nv.name = CORBA::string_dup(name); nv.value <<= value; return nv; } */ /*! * @if jp * * @brief value �� CORBA::Char �� NameValue ���������� * * ���Υ��ڥ졼������f value �� CORBA::Char �� NameValue��������롣 * * @param name NameValue �� name * @param value NameValue �� value * * @return NameValue * * @else * * @brief Create NameValue typed CORBA::Char * * This operation creates NameValue typed CORBA::Char. * * @param name Name of NameValue * @param value The value of NameValue * * @return NameValue * * @endif */ SDOPackage::NameValue newNVChar(const char* name, const CORBA::Char value); /*! * @if jp * * @brief value �� CORBA::Boolean �� NameValue ���������� * * ���Υ��ڥ졼������f value �� CORBA::Boolean �� NameValue��������롣 * * @param name NameValue �� name * @param value NameValue �� value * * @return NameValue * * @else * * @brief Create NameValue typed CORBA::Boolean * * This operation creates NameValue typed CORBA::Boolean. * * @param name Name of NameValue * @param value The value of NameValue * * @return NameValue * * @endif */ SDOPackage::NameValue newNVBool(const char* name, const CORBA::Boolean value); /*! * @if jp * * @brief value �� CORBA::Octet �� NameValue ���������� * * ���Υ��ڥ졼������ value �� CORBA::Octet �� NameValue��������롣 * * @param name NameValue �� name * @param value NameValue �� value * * @return NameValue * * @else * * @brief Create NameValue typed CORBA::Octet * * This operation creates NameValue typed CORBA::Octet. * * @param name Name of NameValue * @param value The value of NameValue * * @return NameValue * * @endif */ SDOPackage::NameValue newNVOctet(const char* name, const CORBA::Octet value); /*! * @if jp * * @brief value �� CORBA::Any �� NameValue ���������� * * ���Υ��ڥ졼������f value �� CORBA::Any �� NameValue��������롣 * * @param name NameValue �� name * @param value NameValue �� value * * @return NameValue * * @else * * @brief Create NameValue typed CORBA::Any * * This operation creates NameValue typed CORBA::Any. * * @param name Name of NameValue * @param value The value of NameValue * * @return NameValue * * @endif */ SDOPackage::NameValue newNVAny(const char* name, const CORBA::Any& value); /*! * @if jp * * @brief Properties �� NVList �إ��ԡ����� * * ���Υ��ڥ졼������ Properties �� NVList �إ��ԡ����롣 * NVList �� value ������ CORBA::string ���Ȥ��ƥ��ԡ����롣 * * @param nv Properties ���ͤ��Ǽ���� NVList * @param prop ���ԡ����� Properties * * @else * * @brief Copy the properties to NVList * * This operation copies the properties to NVList. * All NVList's values are copied as CORBA::string. * * @param nv NVList to store properties values * @param prop Properties that is copies from * * @endif */ #ifndef ORB_IS_RTORB void copyFromProperties(SDOPackage::NVList& nv, const coil::Properties& prop); #else // ORB_IS_RTORB void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop); #endif // ORB_IS_RTORB /*! * @if jp * * @brief NVList �� Properties �إ��ԡ����� * * ���Υ��ڥ졼������ NVList �� Properties �إ��ԡ����롣 * * @param prop NVList ���ͤ��Ǽ���� Properties * @param nv ���ԡ����� NVList * * @else * * @brief Copy NVList to the Proeprties * * This operation copies NVList to properties. * * @param prop Properties to store NVList values * @param nv NVList of copy source * * @endif */ void copyToProperties(coil::Properties& prop, const SDOPackage::NVList& nv); /*! * @if jp * * @brief NVList �� Properties ���Ѵ����� * * ���Υ��ڥ졼������ NVList �� Properties ���Ѵ����롣 * * @param nv �Ѵ����� NVList * * @return �Ѵ����Property * * @else * * @brief Transform NVList to the properties * * This operation transforms NVList to properties * * @param nv NVList of tranformation source * * @return Transformation result Property * * @endif */ coil::Properties toProperties(const SDOPackage::NVList& nv); /*! * @if jp * * @brief NVList ���� name �ǻ��ꤵ�줿 value ���֤� * * ���Υ��ڥ졼������ name �ǻ��ꤵ�줿 value �� Any �����֤��� * ���ꤷ��̾�Τ����Ǥ�¸�ߤ��ʤ������㳰��ȯ�������롣 * * @param nv �����оݤ� NVList * @param name ��������̾�� * * @return ������� * * @else * * @brief Return the value specified by name from NVList * * This operation returns Any type of value specified by name. * When an element of specified name doesn't exist, the exception will occur. * * @param nv The target NVList for the find * @param name Name for the find * * @return Find result * * @endif */ const CORBA::Any& find(const SDOPackage::NVList& nv, const char* name); /*! * @if jp * * @brief name �ǻ��ꤵ�줿���ǤΥ���ǥå������֤� * * ���Υ��ڥ졼������ name �ǻ��ꤵ�줿���Ǥ���Ǽ����Ƥ�����֤� * ����ǥå������֤��� * * @param nv �����оݤ� NVList * @param name ��������̾�� * * @return �����оݤΥ���ǥå��� * * @else * * @brief Return the index of element specified by name from NVList * * This operation returns the index at the position where the element * specified by name is stored. * * @param nv The target NVList for the find * @param name Name for the find * * @return Index of target object for the find * * @endif */ const CORBA::Long find_index(const SDOPackage::NVList& nv, const char* name); /*! * @if jp * * @brief ���ꤵ�줿 name �� value �η��� string �Ǥ��뤫���ڤ��� * * ���Υ��ڥ졼������ name �ǻ��ꤵ�줿 value �η��� CORBA::string * ���ɤ����� bool �ͤ��֤��� * * @param nv �����оݤ� NVList * @param name ��������̾�� * * @return string���ڷ��(string:true������ʳ�:false) * * @else * * @brief Validate whether value type specified by name is string type * * This operation returns the bool value by checking whether the type of * value specified with name is CORBA::string. * * @param nv The target NVList for the search * @param name Name for the search * * @return String validation result (String:true, Else:false) * * @endif */ bool isString(const SDOPackage::NVList& nv, const char* name); /*! * @if jp * * @brief ���ꤵ�줿 name �� value ���ͤ����ꤷ��ʸ����Ȱ��פ��뤫���ڤ��� * * ���Υ��ڥ졼������ name �ǻ��ꤵ�줿 value �η��� CORBA::string * ���ɤ�����Ƚ�Ǥ��� CORBA::string �Ǥ�����ˤϻ��ꤷ��ʸ����Ȱ��פ��뤫 * ��bool �ͤ��֤��� * * @param nv �����оݤ� NVList * @param name ��������̾�� * @param value ����о�ʸ���� * * @return ���ڷ��(ʸ����Ȱ���:true�������:false) * * @else * * @brief Check whether the value of specified name matches the specified * string * * This operation checks whether the value specified with name is * CORBA::string and returns the bool value which matches spcified string. * * @param nv The target NVList for the search * @param name Name for the search * @param value String value to compare * * @return Check result (Match:true, Unmatch:false) * * @endif */ bool isStringValue(const SDOPackage::NVList& nv, const char* name, const char* value); /*! * @if jp * * @brief ���ꤵ�줿 name �� NVList �� string �Ȥ����֤��� * * ���Υ��ڥ졼������ name �ǻ��ꤵ�줿 NVList ���ͤ� string ���֤��� * �⤷��name �ǻ��ꤷ�� value ���ͤ� CORBA::string �Ǥʤ���С� * ����ʸ�����string���֤��� * * @param nv �����оݤ� NVList * @param name ��������̾�� * * @return name ���б������ͤ�string������ * * @else * * @brief Get NVList of specifid name as string * * This operation returns string value in NVList specified by name. * If the value in NVList specified by name is not CORBA::string type * this operation returns empty string value. * * @param nv The target NVList for the search * @param name Name for the search * * @return String value corresponding to name * * @endif */ std::string toString(const SDOPackage::NVList& nv, const char* name); /*! * @if jp * * @brief ���ꤵ�줿ʸ����� NVList �����Ǥ��ɲä��롣 * * ���Υ��ڥ졼������ name �ǻ��ꤵ�줿���Ǥ� value �ǻ��ꤵ�줿ʸ����� * �ɲä��롣 * name �ǻ��ꤷ�����Ǥ˴��� value ���ͤ����ꤵ��Ƥ�����ˤϲ��⤷�ʤ��� * name �ǻ��ꤷ�����Ǥ� value ���ͤ����ꤵ��Ƥ��ʤ����ϡ� ","���ڤ�� * value ���ͤ��ɲä��롣 * ���ꤵ�줿�ͤ����ꤹ�롣 * name �ǻ��ꤷ�����Ǥ�¸�ߤ��ʤ����ϡ� NVList �κǸ�˿��������Ǥ��ɲä��� * ���ꤵ�줿�ͤ����ꤹ�롣 * * @param nv �����оݤ� NVList * @param name �ɲ��о�����̾ * @param value �ɲä���ʸ���� * * @return �ɲ������ * * @else * * @brief Append the specified string to element of NVList * * This operation appends the string value specified by value to the element * specified by name. * Operate nothing when the 'value' value has already been set to the * element specified by name. * Add the 'value' value each separating by a comma "," when the 'value' * value is not set to the element specified by name. * Set the specified value. * Add a new element at the end of NVList, and set the specified value, * when the element specified by name does not exist. * * @param nv The target NVList for the search * @param name The target element name for the appending * @param value String to append * * @return Append operation result * * @endif */ #ifndef ORB_IS_RTORB bool appendStringValue(SDOPackage::NVList& nv, const char* name, const char* value); #else // ORB_IS_RTORB bool appendStringValue(SDOPackage_NVList& nv, const char* name, const char* value); #endif // ORB_IS_RTORB /*! * @if jp * * @brief NVList �����Ǥ��ɲä��롣 * * ���Υ��ڥ졼������ dest �ǻ��ꤵ�줿 NVList �� src �ǻ��ꤵ�줿���Ǥ� * �ɲä��롣 * * @param dest �ɲä���� NVList * @param src �ɲä��� NVList * * @else * * @brief Append an element to NVList * * This operation appends elements specified by src to NVList specified * by dest. * * @param dest NVList to be appended * @param src NVList to append * * @endif */ void append(SDOPackage::NVList& dest, const SDOPackage::NVList& src); /*! * @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& dump(std::ostream& out, const SDOPackage::NVList& nv); /*! * @if jp * @brief NVList �����ꤵ��Ƥ������Ƥ�ʸ����Ȥ���ɸ����Ϥ��롣 * * @param nv �����о� NVList * * @else * @brief Print information configured in NVList as a string type * to Standard Outport. * * @param nv The target NVList for the print * * @endif */ void dump(const SDOPackage::NVList& nv); /*! * @if jp * @brief NVList �����ꤵ��Ƥ������Ƥ�ʸ����ˤ��� * * @param nv �����о� NVList * * @else * @brief Get information configured in NVList as a string type. * * @param nv The target NVList for the print * * @endif */ std::string toString(const SDOPackage::NVList& nv); }; #endif // NVUTIL_NVUTIL_H
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
257 #else // ORB_IS_RTORB
258  void copyFromProperties(SDOPackage_NVList& nv, const coil::Properties& prop);
259 #endif // ORB_IS_RTORB
260 
283 
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(std::ostream& out, const SDOPackage::NVList& nv);
560 
575  void dump(const SDOPackage::NVList& nv);
576 
590  std::string toString(const SDOPackage::NVList& nv);
591 
592 
593 };
594 #endif // NVUTIL_NVUTIL_H
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
Definition: NVUtil.h:79
bool isString(const SDOPackage::NVList &nv, const char *name)
Validate whether value type specified by name is string type.
Definition: NVUtil.cpp:239
SDOPackage::NameValue newNVOctet(const char *name, const CORBA::Octet value)
Create NameValue typed CORBA::Octet.
Definition: NVUtil.cpp:77
bool appendStringValue(SDOPackage::NVList &nv, const char *name, const char *value)
Append the specified string to element of NVList.
Definition: NVUtil.cpp:313
std::vector< std::pair< std::string, std::string > > NVList
Definition: IRTC.h:67
SDOPackage::NameValue newNVBool(const char *name, const CORBA::Boolean value)
This operation creates NameValue typed CORBA::Boolean.
Definition: NVUtil.cpp:62
Utility for NameValue.
Definition: NVUtil.cpp:38
const CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
Return the index of element specified by name from NVList.
Definition: NVUtil.cpp:227
void copyToProperties(coil::Properties &prop, const SDOPackage::NVList &nv)
Copy NVList to the Proeprties.
Definition: NVUtil.cpp:137
std::string toString(const SDOPackage::NVList &nv, const char *name)
Get NVList of specifid name as string.
Definition: NVUtil.cpp:282
const CORBA::Any & find(const SDOPackage::NVList &nv, const char *name)
Return the value specified by name from NVList.
Definition: NVUtil.cpp:212
void dump(const SDOPackage::NVList &nv)
Print information configured in NVList as a string type to Standard Outport.
Definition: NVUtil.cpp:394
void append(SDOPackage::NVList &dest, const SDOPackage::NVList &src)
Append an element to NVList.
Definition: NVUtil.cpp:354
prop
Organization::get_organization_property ();.
coil::Properties toProperties(const SDOPackage::NVList &nv)
Transform NVList to the properties.
Definition: NVUtil.cpp:180
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.
Definition: NVUtil.cpp:47
bool isStringValue(const SDOPackage::NVList &nv, const char *name, const char *value)
Check whether the value of specified name specified matches the specified string. ...
Definition: NVUtil.cpp:262
void copyFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Copy the properties to NVList.
Definition: NVUtil.cpp:108
SDOPackage::NameValue newNVAny(const char *name, const CORBA::Any &value)
Create NameValue typed CORBA::Any.
Definition: NVUtil.cpp:92


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:53