IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSAcceptedProviders.h
Go to the documentation of this file.
1 //******************************************************************
2 //
3 // Copyright 2017 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 
21 
28 #ifndef _NS_ACCEPTED_PROVIDERS_H_
29 #define _NS_ACCEPTED_PROVIDERS_H_
30 
31 #include <map>
32 #include <mutex>
33 #include <algorithm>
34 #include "NSProvider.h"
35 
36 
37 namespace OIC
38 {
39  namespace Service
40  {
46  {
47  public :
53  {
55  }
56 
62 
69 
74  {
76  }
77 
84  std::shared_ptr<NSProvider> getProvider(const std::string &id);
85 
91  void addProvider(std::shared_ptr<NSProvider> provider);
92 
98  void removeProvider(const std::string &id);
99 
106  bool isAccepted(const std::string &id);
107 
112  int size();
113 
117  void removeProviders();
118 
123  std::map<std::string, std::shared_ptr<NSProvider> > getProviders() const;
124 
125  private :
126  std::map<std::string, std::shared_ptr<NSProvider> > m_providers;
127  mutable std::mutex m_mutex;
128  };
129  }
130 }
131 
132 #endif //_NS_ACCEPTED_PROVIDERS_H_
void removeProvider(const std::string &id)
request to remove NSProvider
void addProvider(std::shared_ptr< NSProvider > provider)
Request to add NSProvider pointer.
This class provides a set of C++APIs for managing accepted Providers.
Definition: NSAcceptedProviders.h:45
~NSAcceptedProviders()
Destructor of NSAcceptedProviders.
Definition: NSAcceptedProviders.h:73
NSAcceptedProviders()
Constructor of NSAcceptedProviders.
Definition: NSAcceptedProviders.h:52
void removeProviders()
request to remove all NSProviders
This file contains Notification service Provider representation.
int size()
get size of providers accepted.
NSAcceptedProviders & operator=(const NSAcceptedProviders &)
Copy assignment operator of NSAcceptedProviders.
bool isAccepted(const std::string &id)
request to check if NSProvider is accepted
std::shared_ptr< NSProvider > getProvider(const std::string &id)
request to get NSProvider pointer
std::map< std::string, std::shared_ptr< NSProvider > > getProviders() const
get the map of providers accepted.