IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RCSDiscoveryManager.h
Go to the documentation of this file.
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 
29 #ifndef RCS_DISCOVERYMANAGER_H_
30 #define RCS_DISCOVERYMANAGER_H_
31 
32 #include <memory>
33 #include <functional>
34 #include <vector>
35 
36 namespace OIC
37 {
38  namespace Service
39  {
40  class RCSAddress;
41  class RCSRemoteResourceObject;
48  {
49  public:
50 
56  {
57  public:
58  typedef std::unique_ptr< DiscoveryTask > Ptr;
59 
61 
62  DiscoveryTask(const DiscoveryTask&) = delete;
63  DiscoveryTask(DiscoveryTask&&) = delete;
64  DiscoveryTask& operator =(const DiscoveryTask&) const = delete;
65  DiscoveryTask& operator =(DiscoveryTask&&) const = delete;
66 
71  void cancel();
72 
76  bool isCanceled();
77 
78  private:
79  explicit DiscoveryTask(unsigned int);
80 
81  private:
82  unsigned int m_id;
83 
85  };
86 
87  public:
88 
94  typedef std::function< void(std::shared_ptr< RCSRemoteResourceObject >) >
96 
102 
117 
132  const std::string& relativeUri, ResourceDiscoveredCallback cb);
133 
148  const std::string& resourceType, ResourceDiscoveredCallback cb);
149 
167  const std::vector< std::string >& resourceTypes,
169 
185  const std::string& relativeUri, const std::string& resourceType,
187 
206  const std::string& relativeUri,
207  const std::vector< std::string >& resourceTypes,
209 
210  private:
211 
212  RCSDiscoveryManager() = default;
213  ~RCSDiscoveryManager() = default;
214  };
215  }
216 }
217 #endif // RCSDISCOVERYMANAGER_H
bool isCanceled()
Returns whether the discovery request is canceled or not.
DiscoveryTask(const DiscoveryTask &)=delete
static RCSDiscoveryManager * getInstance()
std::unique_ptr< DiscoveryTask > Ptr
Definition: RCSDiscoveryManager.h:58
DiscoveryTask::Ptr discoverResource(const RCSAddress &address, ResourceDiscoveredCallback cb)
Discovers resources of interest, regardless of uri and resource type.
DiscoveryTask::Ptr discoverResourceByType(const RCSAddress &address, const std::string &resourceType, ResourceDiscoveredCallback cb)
Discovers resources of interest by resource type.
This class contains the resource discovery methods.
Definition: RCSDiscoveryManager.h:47
DiscoveryTask::Ptr discoverResourceByTypes(const RCSAddress &address, const std::vector< std::string > &resourceTypes, ResourceDiscoveredCallback cb)
Discovers resources of interest by resource types.
std::function< void(std::shared_ptr< RCSRemoteResourceObject >) > ResourceDiscoveredCallback
Typedef for callback of discoverResource APIs.
Definition: RCSDiscoveryManager.h:95
This is to specify a target address to discover.
Definition: RCSAddress.h:43
void cancel()
It cancels the task of discovery.
This class represents a discovery task.
Definition: RCSDiscoveryManager.h:55
DiscoveryTask & operator=(const DiscoveryTask &) const =delete
friend class RCSDiscoveryManagerImpl
Definition: RCSDiscoveryManager.h:84