replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / common / NSTopicsList.h
1 //******************************************************************
2 //
3 // Copyright 2016 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 /**
22  * @file
23  *
24  * This file contains Notification service topics linked list representation.
25  */
26
27 #ifndef _NS_TOPICS_LIST_H_
28 #define _NS_TOPICS_LIST_H_
29
30
31 #include <string>
32 #include <list>
33 #include "NSTopic.h"
34
35 namespace OIC
36 {
37     namespace Service
38     {
39         /**
40          * @class   NSTopicsList
41          * @brief   This class provides a set of APIs for Notification service Topics Linked list.
42          */
43         class NSTopicsList
44         {
45             public:
46                 /**
47                      * Constructor of NSTopicsList.
48                      */
49                 NSTopicsList() : m_modifiable(true) { }
50
51                 /**
52                      * Constructor of NSTopicsList.
53                      *
54                      * @param topics - pointer to NSTopicLL struct to initialize.
55                      */
56                 NSTopicsList(::NSTopicLL *topics, bool modify);
57
58                 /**
59                      * Copy Constructor of NSTopicsList.
60                      *
61                      * @param topicsList - NSTopicsList to initialize.
62                      */
63                 NSTopicsList(const NSTopicsList &topicsList);
64
65                 /**
66                      * Copy assignment operator of NSTopicsList.
67                      *
68                      * @param topicsList -  NSTopicsList to initialize.
69                      * @return NSTopicsList object reference
70                      */
71                 NSTopicsList &operator=(const NSTopicsList &topicsList);
72
73                 /**
74                      * Destructor of NSTopicsList.
75                      */
76                 ~NSTopicsList();
77
78                 /**
79                      * This method is for adding topic for the Notification service Topics Linked list.
80                      *
81                      * @param topicName as string.
82                      * @param state - as NSTopicState.
83                      */
84                 void addTopic(const std::string &topicName, NSTopic::NSTopicState state);
85
86                 /**
87                      * This method is for removing topic from the Notification service Topics Linked list.
88                      *
89                      * @param topicName as string.
90                      */
91                 void removeTopic(const std::string &topicName);
92
93                 /**
94                      * This method is for getting topic LL from the Notification service Topics Linked list.
95                      *
96                      * @return topic as NSTopics Linked list.
97                      */
98                 std::list<NSTopic> getTopicsList() const;
99
100                 /**
101                      * This method is for preventing for add/remove Topic from Topicslist.
102                      * Below method restricts the application from illegally modifying Topics when 
103                      * Provider is in Invalid state. By calling the API, the service prevents and protects
104                      * the integrity of TopicsList updation when the associated object is Invalid.
105                      *
106                      */
107                 void unsetModifiability();
108
109             private:
110                 std::list<NSTopic *> m_topicsList;
111                 bool m_modifiable;
112
113         };
114     }
115 }
116 #endif /* _NS_TOPICS_LIST_H_ */