21 #pragma warning( push ) 22 #pragma warning( disable : 4267 ) 23 #pragma warning( disable : 4290 ) 24 #pragma warning( disable : 4311 ) 25 #pragma warning( disable : 4312 ) 30 #include <coil/stringutil.h> 35 #pragma warning( pop ) 47 SDOPackage::NameValue
newNVChar(
const char* name,
const CORBA::Char value)
49 SDOPackage::NameValue
nv;
50 nv.name = CORBA::string_dup(name);
51 nv.value <<= CORBA::Any::from_char(value);
62 SDOPackage::NameValue
newNVBool(
const char* name,
const CORBA::Boolean value)
64 SDOPackage::NameValue
nv;
65 nv.name = CORBA::string_dup(name);
66 nv.value <<= CORBA::Any::from_boolean(value);
77 SDOPackage::NameValue
newNVOctet(
const char* name,
const CORBA::Octet value)
79 SDOPackage::NameValue
nv;
80 nv.name = CORBA::string_dup(name);
81 nv.value <<= CORBA::Any::from_octet(value);
92 SDOPackage::NameValue
newNVAny(
const char* name,
const CORBA::Any& value)
94 SDOPackage::NameValue
nv;
95 nv.name = CORBA::string_dup(name);
109 #else // ORB_IS_RTORB 111 #endif // ORB_IS_RTORB 113 std::vector<std::string>
keys;
115 CORBA::ULong len((CORBA::ULong)keys.size());
118 for (CORBA::ULong i = 0; i < len; ++i)
122 nv[i].name = CORBA::string_dup(keys[i].c_str());
123 #else // ORB_IS_RTORB 124 nv[i].name = (
char *)keys[i].c_str();
125 #endif // ORB_IS_RTORB 126 nv[i].value <<= prop[keys[i]].c_str();
139 for (CORBA::ULong i(0), len(nv.length()); i < len; ++i)
142 if (nv[i].value >>= value)
144 const char* name(nv[i].name);
165 if (nv.value >>= value)
199 std::string name(nv.name);
200 return m_name == name;
216 if (index < 0)
throw std::string(
"Not found");
217 return nv[
index].value;
244 value =
find(nv, name);
245 const char* str_value;
246 return value >>= str_value;
263 const char* name,
const char* value)
284 const char* str_value;
287 if(!(
find(nv, name) >>= str_value))
297 if (str_value == NULL)
315 #else // ORB_IS_RTORB 318 #endif // ORB_IS_RTORB 331 const char* tmp_char;
332 nv[
index].value >>= tmp_char;
333 std::string tmp_str(tmp_char);
335 std::vector<std::string> values;
337 if (values.end() ==
std::find(values.begin(), values.end(), value))
340 tmp_str.append(value);
341 nv[
index].value <<= tmp_str.c_str();
356 for (CORBA::ULong i = 0, len = src.length(); i < len; ++i)
371 for (CORBA::ULong i(0), n(nv.length()); i < n; ++i)
373 const char* str_value;
374 if (nv[i].value >>= str_value)
376 out << nv[i].name <<
": " << str_value << std::endl;
380 out << nv[i].name <<
": not a string value" << std::endl;
SDOPackage::NameValue newNV(const char *name, Value value)
Create NameValue.
Functor to transform NVList into the properties.
bool isString(const SDOPackage::NVList &nv, const char *name)
Validate whether value type specified by name is string type.
std::ostream & dump_to_stream(std::ostream &out, const SDOPackage::NVList &nv)
Print information configured in NVList as a 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.
std::vector< std::pair< std::string, std::string > > NVList
nv_find(const char *name)
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
Split string by delimiter.
SDOPackage::NameValue newNVBool(const char *name, const CORBA::Boolean value)
This operation creates NameValue typed CORBA::Boolean.
bool operator()(const SDOPackage::NameValue &nv)
const CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
Return the index of element specified by name from NVList.
void operator()(const SDOPackage::NameValue &nv)
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.
const CORBA::Any & find(const SDOPackage::NVList &nv, const char *name)
Return the value specified by name from NVList.
CORBA::Long find(const CorbaSequence &seq, Functor f)
Return the index of CORBA sequence element that functor matches.
std::string setProperty(const std::string &key, const std::string &value)
Set a value associated with key in the property list.
NameValue and NVList utility functions.
CORBA sequence utility template functions.
void dump(const SDOPackage::NVList &nv)
Print information configured in NVList as a string type to Standard Outport.
void append(SDOPackage::NVList &dest, const SDOPackage::NVList &src)
Append an element to NVList.
prop
Organization::get_organization_property ();.
coil::Properties toProperties(const SDOPackage::NVList &nv)
Transform NVList to the properties.
Functor to find a NVList.
Class represents a set of properties.
SDOPackage::NameValue newNVChar(const char *name, const CORBA::Char value)
Create NameValue typed CORBA::Char.
void push_back(CorbaSequence &seq, SequenceElement elem)
Push the new element back to the CORBA sequence.
bool isStringValue(const SDOPackage::NVList &nv, const char *name, const char *value)
Check whether the value of specified name specified matches the specified string. ...
void copyFromProperties(SDOPackage::NVList &nv, const coil::Properties &prop)
Copy the properties to NVList.
std::vector< std::string > propertyNames(void) const
Return an vector of all the keys in this property.
SDOPackage::NameValue newNVAny(const char *name, const CORBA::Any &value)
Create NameValue typed CORBA::Any.
Functor for_each(CorbaSequence &seq, Functor f)
Apply the functor to all CORBA sequence elements.