replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / include / OCRepresentation.h
index 309b3e5..f37ea45 100644 (file)
@@ -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<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)
                     {
@@ -228,7 +236,14 @@ namespace OC
                 {
                     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)
                     {
@@ -290,15 +305,23 @@ namespace OC
                     template<typename T>
                     T getValue() const
                     {
+                        T val = T();
                         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)
                         {
-                            T val = T();
                             return val;
                         }
+                        return val;
                     }
 
                     std::string getValueToString() const;