projects
/
platform
/
upstream
/
iotivity.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git]
/
resource
/
include
/
OCRepresentation.h
diff --git
a/resource/include/OCRepresentation.h
b/resource/include/OCRepresentation.h
index
309b3e5
..
f37ea45
100644
(file)
--- a/
resource/include/OCRepresentation.h
+++ b/
resource/include/OCRepresentation.h
@@
-119,7
+119,7
@@
namespace OC
virtual ~OCRepresentation(){}
virtual ~OCRepresentation(){}
- void setDevAddr(const OCDevAddr
addr
);
+ void setDevAddr(const OCDevAddr
&
);
const std::string getHost() const;
const std::string getHost() const;
@@
-195,8
+195,16
@@
namespace OC
{
try
{
{
try
{
- val = boost::get<T>(x->second);
- return true;
+ if (x->second.type() == typeid(T))
+ {
+ val = boost::get<T>(x->second);
+ return true;
+ }
+ else
+ {
+ val = T();
+ return false;
+ }
}
catch (boost::bad_get& e)
{
}
catch (boost::bad_get& e)
{
@@
-228,7
+236,14
@@
namespace OC
{
try
{
{
try
{
- val = boost::get<T>(x->second);
+ if (x->second.type() == typeid(T))
+ {
+ val = boost::get<T>(x->second);
+ }
+ else
+ {
+ return val;
+ }
}
catch (boost::bad_get& e)
{
}
catch (boost::bad_get& e)
{
@@
-290,15
+305,23
@@
namespace OC
template<typename T>
T getValue() const
{
template<typename T>
T getValue() const
{
+ T val = T();
try
{
try
{
- return boost::get<T>(m_values[m_attrName]);
+ if (m_values[m_attrName].type() == typeid(T))
+ {
+ val = boost::get<T>(m_values[m_attrName]);
+ }
+ else
+ {
+ return val;
+ }
}
catch (boost::bad_get& e)
{
}
catch (boost::bad_get& e)
{
- T val = T();
return val;
}
return val;
}
+ return val;
}
std::string getValueToString() const;
}
std::string getValueToString() const;