Use `URI` all caps in documentation
[iotivity.git] / resource / include / OCResource.h
index 3fe3a68..c977a04 100644 (file)
@@ -60,7 +60,15 @@ namespace OC
 
             OCResourceIdentifier(const OCResourceIdentifier&) = default;
 
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+            OCResourceIdentifier(OCResourceIdentifier&& o):
+                m_resourceUri(std::move(o.m_resourceUri)),
+                m_representation(o.m_representation)
+            {
+            }
+#else
             OCResourceIdentifier(OCResourceIdentifier&&) = default;
+#endif
 
             OCResourceIdentifier& operator=(const OCResourceIdentifier&) = delete;
 
@@ -103,8 +111,34 @@ namespace OC
     public:
         typedef std::shared_ptr<OCResource> Ptr;
 
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+        OCResource(OCResource&& o):
+            m_clientWrapper(std::move(o.m_clientWrapper)),
+            m_uri(std::move(o.m_uri)),
+            m_resourceId(std::move(o.m_resourceId)),
+            m_devAddr(std::move(o.m_devAddr)),
+            m_useHostString(o.m_useHostString),
+            m_property(o.m_property),
+            m_isCollection(o.m_isCollection),
+            m_resourceTypes(std::move(o.m_resourceTypes)),
+            m_interfaces(std::move(o.m_interfaces)),
+            m_children(std::move(m_children)),
+            m_endpoints(std::move(m_endpoints)),
+            m_serverHeaderOptions(std::move(m_serverHeaderOptions)),
+            m_observeHandle(std::move(m_observeHandle)),
+            m_headerOptions(std::move(m_headerOptions))
+        {
+        }
+#else
         OCResource(OCResource&&) = default;
-        OCResource& operator=(OCResource&&) = default;
+#endif
+        // Explicitly delete the copy ctor since VS2013 would try to generate one, and
+        // the standard says that defaulting the move ctor should delete the copy ctor.
+        OCResource(const OCResource&) = delete;
+
+        // We cannot support copy/move assigns since OCResourceIdentifier doesn't.
+        OCResource& operator=(OCResource&&) = delete;
+        OCResource& operator=(const OCResource&) = delete;
 
         /**
         * Virtual destructor
@@ -452,6 +486,18 @@ namespace OC
         */
         std::string host() const;
 
+        /**
+        * Function to get the endpoints information of this resource
+        * @return std::vector<std::string> endpoints information
+        */
+        std::vector<std::string> getAllHosts() const;
+
+        /**
+         * Function to get the header options information from response
+         * @return headerOptions HeaderOptions vector consisting of OCHeaderOption objects
+         */
+        HeaderOptions getServerHeaderOptions() const;
+
         /**
         * Function to get the URI for this resource
         * @return std::string resource URI
@@ -471,6 +517,21 @@ namespace OC
         */
         bool isObservable() const;
 
+        /**
+        * Function to change host of this reource
+        * @return std::string New host Address.
+        *         not observable.
+        */
+        std::string setHost(const std::string& host);
+#ifdef WITH_MQ
+        /**
+        * Function to provide ability to check if this resource is publisher or not
+        * @return bool true indicates resource is publisher; false indicates resource is
+        *         not publisher.
+        */
+        bool isPublish() const;
+#endif
+
         /**
         * Function to get the list of resource types
         * @return vector of resource types
@@ -497,11 +558,107 @@ namespace OC
         /**
         * Function to get a string representation of the resource's server ID.
         * This is unique per- server independent on how it was discovered.
-        * @note The format of the return value is subject to change and will
-        * likely change both in size and contents in the future.
         */
         std::string sid() const;
 
+#ifdef WITH_MQ
+        /**
+        * Function to discovery Topics from MQ Broker.
+        *
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult discoveryMQTopics(const QueryParamsMap& queryParametersMap,
+                                        MQTopicCallback attributeHandler,
+                                        QualityOfService qos);
+        /**
+        * Function to create Topic into MQ Broker.
+        * SubTopic is also created through this method.
+        *
+        * @param rep representation of the topic
+        * @param topicUri new URI of the topic which want to create
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult createMQTopic(const OCRepresentation& rep,
+                                    const std::string& topicUri,
+                                    const QueryParamsMap& queryParametersMap,
+                                    MQTopicCallback attributeHandler,
+                                    QualityOfService qos);
+#endif
+#ifdef MQ_SUBSCRIBER
+        /**
+        * Function to subscribe Topic to MQ Broker.
+        *
+        * @param observeType allows the client to specify how it wants to observe.
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param observeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult subscribeMQTopic(ObserveType observeType,
+                                       const QueryParamsMap& queryParametersMap,
+                                       ObserveCallback observeHandler,
+                                       QualityOfService qos);
+
+        /**
+        * Function to unsubscribe Topic to MQ Broker.
+        *
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult unsubscribeMQTopic(QualityOfService qos);
+
+        /**
+        * Function to request publish to MQ publisher.
+        * Publisher can confirm the request message as key:"req_pub" and value:"true".
+        *
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult requestMQPublish(const QueryParamsMap& queryParametersMap,
+                                       PostCallback attributeHandler,
+                                       QualityOfService qos);
+#endif
+#ifdef MQ_PUBLISHER
+        /**
+        * Function to publish Topic information into MQ Broker.
+        *
+        * @param rep representation of the topic
+        * @param queryParametersMap map which can have the query parameter name and value
+        * @param attributeHandler handles callback
+        * @param qos the quality of communication
+        *
+        * @return Returns  ::OC_STACK_OK on success, some other value upon failure.
+        * @note OCStackResult is defined in ocstack.h.
+        *
+        */
+        OCStackResult publishMQTopic(const OCRepresentation& rep,
+                                     const QueryParamsMap& queryParametersMap,
+                                     PostCallback attributeHandler,
+                                     QualityOfService qos);
+#endif
         // overloaded operators allow for putting into a 'set'
         // the uniqueidentifier allows for putting into a hash
         bool operator==(const OCResource &other) const;
@@ -517,33 +674,50 @@ namespace OC
         bool operator>=(const OCResource &other) const;
 
     private:
-        void setHost(const std::string& host);
         std::weak_ptr<IClientWrapper> m_clientWrapper;
         std::string m_uri;
         OCResourceIdentifier m_resourceId;
         OCDevAddr m_devAddr;
         bool m_useHostString;
-        bool m_isObservable;
         bool m_isCollection;
+        uint8_t m_property;
         std::vector<std::string> m_resourceTypes;
         std::vector<std::string> m_interfaces;
         std::vector<std::string> m_children;
+        std::vector<std::string> m_endpoints;
+        HeaderOptions m_serverHeaderOptions;
         OCDoHandle m_observeHandle;
         HeaderOptions m_headerOptions;
 
     private:
         OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
                     const OCDevAddr& devAddr, const std::string& uri,
-                    const std::string& serverId, bool observable,
+                    const std::string& serverId, uint8_t property,
                     const std::vector<std::string>& resourceTypes,
                     const std::vector<std::string>& interfaces);
 
+        OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
+                    const OCDevAddr& devAddr, const std::string& uri,
+                    const std::string& serverId, uint8_t property,
+                    const std::vector<std::string>& resourceTypes,
+                    const std::vector<std::string>& interfaces,
+                    const std::vector<std::string>& endpoints,
+                    const HeaderOptions& serverHeaderOptions);
+
         OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
                     const std::string& host, const std::string& uri,
                     const std::string& serverId,
-                    OCConnectivityType connectivityType, bool observable,
+                    OCConnectivityType connectivityType, uint8_t property,
                     const std::vector<std::string>& resourceTypes,
                     const std::vector<std::string>& interfaces);
+
+        OCResource(std::weak_ptr<IClientWrapper> clientWrapper,
+                    const std::string& host, const std::string& uri,
+                    const std::string& serverId,
+                    OCConnectivityType connectivityType, uint8_t property,
+                    const std::vector<std::string>& resourceTypes,
+                    const std::vector<std::string>& interfaces,
+                    const std::vector<std::string>& endpoints);
     };
 
 } // namespace OC