Fixed build issue by adding Builder contructor with const args
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 4 Mar 2016 23:51:05 +0000 (00:51 +0100)
committerJee Hyeok Kim <jihyeok13.kim@samsung.com>
Tue, 15 Mar 2016 13:56:23 +0000 (13:56 +0000)
Problem was observed while building on Tizen:2.4:Mobile (g++ 4.9.2):

    libresource_hosting.so: undefined reference to \
    `OIC::Service::RCSResourceObject::Builder::Builder(std::string const&, std::string const&, std::string const&)'

This message appeared while building RHSampleApp using tizen-sdk 2.4.0 Rev4
with imported libs (built with gbs from Tizen:2.4:Mobile repo)

Change-Id: I3064b9e7234edcabbefe40b5e469413e72127fae
Origin: https://github.com/TizenTeam/iotivity/tree/sandbox/pcoval/for-upstream
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/5575
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-by: Robert Spielmann <spielmann@kellendonk.de>
service/resource-encapsulation/include/RCSResourceObject.h
service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp

index 8a58b15..abea691 100644 (file)
@@ -144,7 +144,17 @@ namespace OIC
                  * @param interface Resource interface
                  *
                  */
-                Builder(std::string uri, std::string type, std::string interface);
+                Builder(std::string &&uri, std::string &&type, std::string &&interface);
+
+                 /**
+                 * Constructs a Builder.
+                 *
+                 * @param uri Resource uri
+                 * @param type Resource type
+                 * @param interface Resource interface
+                 *
+                 */
+                Builder(const std::string &uri, const std::string &type, const std::string &interface);
 
                 /**
                  * Add an interface for the resource.
index 4d37f6f..80afefb 100644 (file)
@@ -138,8 +138,8 @@ namespace OIC
     namespace Service
     {
 
-        RCSResourceObject::Builder::Builder(std::string uri, std::string type,
-                std::string interface) :
+        RCSResourceObject::Builder::Builder(std::string &&uri, std::string &&type,
+                std::string &&interface) :
                 m_uri{ std::move(uri) },
                 m_types{ std::move(type) },
                 m_interfaces{ },
@@ -156,6 +156,17 @@ namespace OIC
             }
         }
 
+        RCSResourceObject::Builder::Builder(const std::string &uri, const std::string &type,
+                const std::string &interface) :
+                m_uri{ uri },
+                m_types{ type },
+                m_interfaces{ interface },
+                m_defaultInterface { BASELINE_INTERFACE },
+                m_properties{ OC_DISCOVERABLE | OC_OBSERVABLE },
+                m_resourceAttributes{ }
+        {
+        }
+
         RCSResourceObject::Builder& RCSResourceObject::Builder::addInterface(std::string interface)
         {
             insertValue(m_interfaces, std::move(interface));