From b7a33ba1905fcef02c21532a944ddc0958a121af Mon Sep 17 00:00:00 2001 From: Erich Keane Date: Wed, 4 Feb 2015 12:08:26 -0800 Subject: [PATCH] Adding OCRep destructor, various move activities 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/305 Tested-by: jenkins-iotivity Reviewed-by: Patrick Lankswert --- resource/include/OCHeaderOption.h | 10 ++++++++++ resource/include/OCRepresentation.h | 13 ++++++++++++- resource/include/OCResource.h | 4 ++++ resource/include/OCResourceRequest.h | 2 ++ resource/include/OCResourceResponse.h | 2 ++ resource/src/OCRepresentation.cpp | 3 --- 6 files changed, 30 insertions(+), 4 deletions(-) diff --git a/resource/include/OCHeaderOption.h b/resource/include/OCHeaderOption.h index 31517c5de..2e2becf28 100644 --- a/resource/include/OCHeaderOption.h +++ b/resource/include/OCHeaderOption.h @@ -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 diff --git a/resource/include/OCRepresentation.h b/resource/include/OCRepresentation.h index 2e64fcdae..506722e0f 100644 --- a/resource/include/OCRepresentation.h +++ b/resource/include/OCRepresentation.h @@ -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&); diff --git a/resource/include/OCResource.h b/resource/include/OCResource.h index 63c4253ab..bbbb3f193 100644 --- a/resource/include/OCResource.h +++ b/resource/include/OCResource.h @@ -52,6 +52,10 @@ namespace OC friend class ListenOCContainer; public: typedef std::shared_ptr Ptr; + + OCResource(OCResource&&) = default; + OCResource& operator=(OCResource&&) = default; + /** * Virtual destructor */ diff --git a/resource/include/OCResourceRequest.h b/resource/include/OCResourceRequest.h index 50c28c4bf..107363e76 100644 --- a/resource/include/OCResourceRequest.h +++ b/resource/include/OCResourceRequest.h @@ -57,6 +57,8 @@ namespace OC { } + OCResourceRequest(OCResourceRequest&&) = default; + OCResourceRequest& operator=(OCResourceRequest&&) = default; /** * Virtual destructor */ diff --git a/resource/include/OCResourceResponse.h b/resource/include/OCResourceResponse.h index 767101928..6305a7cf9 100644 --- a/resource/include/OCResourceResponse.h +++ b/resource/include/OCResourceResponse.h @@ -57,6 +57,8 @@ namespace OC { } + OCResourceResponse(OCResourceResponse&&) = default; + OCResourceResponse& operator=(OCResourceResponse&&) = default; virtual ~OCResourceResponse(void) {} /** diff --git a/resource/src/OCRepresentation.cpp b/resource/src/OCRepresentation.cpp index 99b3e655d..4394d0865 100644 --- a/resource/src/OCRepresentation.cpp +++ b/resource/src/OCRepresentation.cpp @@ -163,9 +163,6 @@ namespace OC namespace OC { - OCRepresentation::OCRepresentation() - :m_interfaceType(InterfaceType::None) - { } std::string OCRepresentation::getJSONRepresentation() const { if(empty()) -- 2.34.1