replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / include / OCRepresentation.h
index c07974a..f37ea45 100644 (file)
@@ -61,14 +61,8 @@ namespace OC
         public:
             void setPayload(const OCPayload* rep);
 
-            void setPayload(const OCDevicePayload* rep);
-
-            void setPayload(const OCPlatformPayload* rep);
-
             void setPayload(const OCRepPayload* rep);
-#ifdef RD_CLIENT
-            void setPayload(const OCRDPayload* rep);
-#endif
+
             OCRepPayload* getPayload() const;
 
             const std::vector<OCRepresentation>& representations() const;
@@ -125,7 +119,7 @@ namespace OC
 
             virtual ~OCRepresentation(){}
 
-            void setDevAddr(const OCDevAddr addr);
+            void setDevAddr(const OCDevAddr&);
 
             const std::string getHost() const;
 
@@ -201,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)
                     {
@@ -234,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)
                     {
@@ -296,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;
@@ -333,6 +350,7 @@ namespace OC
                      std::is_same<T, bool>::value ||
                      std::is_same<T, std::string>::value ||
                      std::is_same<T, OCRepresentation>::value ||
+                     std::is_same<T, OCByteString>::value ||
                      std::is_same<T, std::vector<int>>::value ||
                      std::is_same<T, std::vector<std::vector<int>>>::value ||
                      std::is_same<T, std::vector<std::vector<std::vector<int>>>>::value ||
@@ -347,7 +365,10 @@ namespace OC
                      std::is_same<T, std::vector<std::vector<std::vector<std::string>>>>::value ||
                      std::is_same<T, std::vector<OCRepresentation>>::value ||
                      std::is_same<T, std::vector<std::vector<OCRepresentation>>>::value ||
-                     std::is_same<T, std::vector<std::vector<std::vector<OCRepresentation>>>>::value
+                     std::is_same<T, std::vector<std::vector<std::vector<OCRepresentation>>>>::value ||
+                     std::is_same<T, std::vector<OCByteString>>::value ||
+                     std::is_same<T, std::vector<std::vector<OCByteString>>>::value ||
+                     std::is_same<T, std::vector<std::vector<std::vector<OCByteString>>>>::value
                      , int>::type = 0// enable_if
                     >
 #else
@@ -466,9 +487,6 @@ namespace OC
             template<typename T>
             T payload_array_helper_copy(size_t index, const OCRepPayloadValue* pl);
             void setPayload(const OCRepPayload* payload);
-#ifdef RD_CLIENT
-            void setPayload(const OCLinksPayload* payload);
-#endif
             void setPayloadArray(const OCRepPayloadValue* pl);
             void getPayloadArray(OCRepPayload* payload,
                     const OCRepresentation::AttributeItem& item) const;
@@ -515,4 +533,3 @@ namespace OC
 
 
 #endif // OC_REPRESENTATION_H_
-