IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSAcceptedConsumers.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 
27 #ifndef _NS_ACCEPTED_CONSUMERS_H_
28 #define _NS_ACCEPTED_CONSUMERS_H_
29 
30 #include <map>
31 #include <mutex>
32 #include <algorithm>
33 #include <memory>
34 #include "NSConsumer.h"
35 
36 namespace OIC
37 {
38  namespace Service
39  {
45  {
46  public :
52  {
54  }
55 
61 
68 
73  {
75  }
82  std::shared_ptr<NSConsumer> getConsumer(const std::string &id);
83 
90  void addConsumer(std::shared_ptr<NSConsumer> consumer);
91 
97  void removeConsumer(const std::string &id);
98 
105  bool isAccepted(const std::string &id);
106 
111  int size();
112 
116  void removeConsumers();
117 
122  std::map<std::string, std::shared_ptr<NSConsumer> > getConsumers() const;
123 
124  private :
125  std::map<std::string, std::shared_ptr<NSConsumer> > m_consumers;
126  mutable std::mutex m_mutex;
127  };
128  }
129 }
130 #endif /* _NS_ACCEPTED_CONSUMERS_H_ */
std::map< std::string, std::shared_ptr< NSConsumer > > getConsumers() const
get the map of Consumers accepted.
~NSAcceptedConsumers()
Destructor of NSAcceptedConsumers.
Definition: NSAcceptedConsumers.h:72
void addConsumer(std::shared_ptr< NSConsumer > consumer)
Request to add NSConsumer pointer.
void removeConsumers()
request to remove all NSConsumer
This file contains Notification service Consumer representation.
std::shared_ptr< NSConsumer > getConsumer(const std::string &id)
request to get NSConsumer pointer
void removeConsumer(const std::string &id)
request to remove NSConsumer
int size()
get size of Consumers accepted.
NSAcceptedConsumers()
Constructor of NSAcceptedConsumers.
Definition: NSAcceptedConsumers.h:51
This class provides a set of C++APIs for managing accepted Consumers.
Definition: NSAcceptedConsumers.h:44
NSAcceptedConsumers & operator=(const NSAcceptedConsumers &)
Copy assignment operator of NSAcceptedConsumers.
bool isAccepted(const std::string &id)
request to check if NSConsumer is accepted