X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Finclude%2FOCRepresentation.h;h=f37ea45a6b83754257bf4c392c62cf05f0006365;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=309b3e55a15cc118951a53c954aea83d2356fcee;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/include/OCRepresentation.h b/resource/include/OCRepresentation.h index 309b3e5..f37ea45 100644 --- a/resource/include/OCRepresentation.h +++ b/resource/include/OCRepresentation.h @@ -119,7 +119,7 @@ namespace OC virtual ~OCRepresentation(){} - void setDevAddr(const OCDevAddr addr); + void setDevAddr(const OCDevAddr&); const std::string getHost() const; @@ -195,8 +195,16 @@ namespace OC { try { - val = boost::get(x->second); - return true; + if (x->second.type() == typeid(T)) + { + val = boost::get(x->second); + return true; + } + else + { + val = T(); + return false; + } } catch (boost::bad_get& e) { @@ -228,7 +236,14 @@ namespace OC { try { - val = boost::get(x->second); + if (x->second.type() == typeid(T)) + { + val = boost::get(x->second); + } + else + { + return val; + } } catch (boost::bad_get& e) { @@ -290,15 +305,23 @@ namespace OC template T getValue() const { + T val = T(); try { - return boost::get(m_values[m_attrName]); + if (m_values[m_attrName].type() == typeid(T)) + { + val = boost::get(m_values[m_attrName]); + } + else + { + return val; + } } catch (boost::bad_get& e) { - T val = T(); return val; } + return val; } std::string getValueToString() const;