From: Gregg Reynolds Date: Tue, 7 Jun 2016 12:33:31 +0000 (-0500) Subject: BUGFIX: variable has incomplete type 'OIC::Service::RCSResourceObject::WeakGuard' X-Git-Tag: 1.2.0+RC1~305 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ee3e97957254e5e06da63e22f413f917601d8057;p=platform%2Fupstream%2Fiotivity.git BUGFIX: variable has incomplete type 'OIC::Service::RCSResourceObject::WeakGuard' Embedding the definition of WeakGuard syntactically eliminates the error we get if its definition is a sibling. Change-Id: Ia020ca5fda0f604d4c60ebfde895b3ecbd244a4c Signed-off-by: Gregg Reynolds Reviewed-on: https://gerrit.iotivity.org/gerrit/8529 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi Tested-by: Uze Choi --- diff --git a/service/resource-encapsulation/include/RCSResourceObject.h b/service/resource-encapsulation/include/RCSResourceObject.h index 8a58b15..ff68863 100644 --- a/service/resource-encapsulation/include/RCSResourceObject.h +++ b/service/resource-encapsulation/include/RCSResourceObject.h @@ -79,14 +79,36 @@ namespace OIC * in instead of overriding SetRequestHandler. *

*/ + class RCSResourceObject { private: - class WeakGuard; typedef AtomicWrapper< std::thread::id > AtomicThreadId; + //! @cond + class WeakGuard + { + public: + WeakGuard(const RCSResourceObject&); + ~WeakGuard(); + + WeakGuard(const WeakGuard&) = delete; + WeakGuard(WeakGuard&&) = delete; + + WeakGuard& operator=(const WeakGuard&) = delete; + WeakGuard& operator=(WeakGuard&&) = delete; + + bool hasLocked() const; + + private: + bool m_isOwningLock; + const RCSResourceObject& m_resourceObject; + }; + //! @endcond + public: + /** * Represents the policy of auto-notify function. * In accord with this policy, observers are notified of attributes @@ -328,7 +350,7 @@ namespace OIC template< typename T > T getAttribute(const std::string& key) const { - WeakGuard lock(*this); + RCSResourceObject::WeakGuard lock(*this); return m_resourceAttributes.at(key).get< T >(); } @@ -668,26 +690,6 @@ namespace OIC std::function m_autoNotifyFunc; }; - //! @cond - class RCSResourceObject::WeakGuard - { - public: - WeakGuard(const RCSResourceObject&); - ~WeakGuard(); - - WeakGuard(const WeakGuard&) = delete; - WeakGuard(WeakGuard&&) = delete; - - WeakGuard& operator=(const WeakGuard&) = delete; - WeakGuard& operator=(WeakGuard&&) = delete; - - bool hasLocked() const; - - private: - bool m_isOwningLock; - const RCSResourceObject& m_resourceObject; - }; - //! @endcond } } diff --git a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp index 1a40150..f45ab77 100644 --- a/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp +++ b/service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp @@ -815,7 +815,7 @@ namespace OIC m_resourceObject, m_resourceObject.m_resourceAttributes, m_autoNotifyPolicy); } - RCSResourceObject::WeakGuard::WeakGuard( + RCSResourceObject::WeakGuard::WeakGuard( const RCSResourceObject& resourceObject) : m_isOwningLock{ false }, m_resourceObject(resourceObject)