Adding OCRep destructor, various move activities
authorErich Keane <erich.keane@intel.com>
Wed, 4 Feb 2015 20:08:26 +0000 (12:08 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Sat, 21 Feb 2015 00:12:05 +0000 (00:12 +0000)
Apparently OCRepresentation's destructor was causing issues
in the JNI version.  Seemingly adding a virtual destructor to
the OCRepresentation is enough to cause this to go away.

Also adding move construction/assignment to our more expensive
types.

Change-Id: Icb3b6f25e268384b51126e18ec55fc5099c9b2f9
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/305
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
(cherry picked from commit b7a33ba1905fcef02c21532a944ddc0958a121af)
Reviewed-on: https://gerrit.iotivity.org/gerrit/385
Reviewed-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
resource/include/OCHeaderOption.h
resource/include/OCRepresentation.h
resource/include/OCResource.h
resource/include/OCResourceRequest.h
resource/include/OCResourceResponse.h
resource/src/OCRepresentation.cpp

index 31517c5..2e2becf 100644 (file)
@@ -64,6 +64,16 @@ namespace OC
                 }
             }
 
+            virtual ~OCHeaderOption(){}
+
+            OCHeaderOption(const OCHeaderOption&) = default;
+
+            OCHeaderOption(OCHeaderOption&&) = default;
+
+            OCHeaderOption& operator=(const OCHeaderOption&) = default;
+
+            OCHeaderOption& operator=(OCHeaderOption&&) = default;
+
             /**
             * API to get Option ID
             * @return unsigned integer option ID
index 287d42e..d3b4d38 100644 (file)
@@ -98,7 +98,18 @@ namespace OC
     class OCRepresentation
     {
         public:
-            OCRepresentation();
+            OCRepresentation(): m_interfaceType(InterfaceType::None){}
+
+            OCRepresentation(OCRepresentation&&) = default;
+
+            OCRepresentation(const OCRepresentation&) = default;
+
+            OCRepresentation& operator=(const OCRepresentation&) = default;
+
+            OCRepresentation& operator=(OCRepresentation&&) = default;
+
+            virtual ~OCRepresentation(){}
+
             std::string getJSONRepresentation() const;
 
             void addChild(const OCRepresentation&);
index f11efdd..7d07a86 100644 (file)
@@ -90,6 +90,10 @@ namespace OC
     friend class ListenOCContainer;
     public:
         typedef std::shared_ptr<OCResource> Ptr;
+
+        OCResource(OCResource&&) = default;
+        OCResource& operator=(OCResource&&) = default;
+
         /**
         * Virtual destructor
         */
index 50c28c4..107363e 100644 (file)
@@ -57,6 +57,8 @@ namespace OC
         {
         }
 
+        OCResourceRequest(OCResourceRequest&&) = default;
+        OCResourceRequest& operator=(OCResourceRequest&&) = default;
         /**
         *  Virtual destructor
         */
index 7671019..6305a7c 100644 (file)
@@ -57,6 +57,8 @@ namespace OC
         {
         }
 
+        OCResourceResponse(OCResourceResponse&&) = default;
+        OCResourceResponse& operator=(OCResourceResponse&&) = default;
         virtual ~OCResourceResponse(void) {}
 
         /**
index a91fd72..dc2d092 100644 (file)
@@ -161,9 +161,6 @@ namespace OC
 
 namespace OC
 {
-    OCRepresentation::OCRepresentation()
-    :m_interfaceType(InterfaceType::None)
-    { }
     std::string OCRepresentation::getJSONRepresentation() const
     {
         if(emptyData())