BUGFIX: variable has incomplete type 'OIC::Service::RCSResourceObject::WeakGuard' 29/8529/3
authorGregg Reynolds <reynolds-gregg@norc.org>
Tue, 7 Jun 2016 12:33:31 +0000 (07:33 -0500)
committerUze Choi <uzchoi@samsung.com>
Wed, 15 Jun 2016 09:45:58 +0000 (09:45 +0000)
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 <reynolds-gregg@norc.org>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8529
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/resource-encapsulation/include/RCSResourceObject.h
service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp

index 8a58b15..ff68863 100644 (file)
@@ -79,14 +79,36 @@ namespace OIC
          * in instead of overriding SetRequestHandler.
          * </p>
          */
+
         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<void()> 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
     }
 }
 
index 1a40150..f45ab77 100644 (file)
@@ -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)