36a3747bd86f68723dfabfbb00439a177dbe7fa9
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / common / NSTopic.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 topic representation.
25  */
26
27 #ifndef _NS_TOPIC_H_
28 #define _NS_TOPIC_H_
29
30
31 #include <string>
32 #include "NSCommon.h"
33
34 namespace OIC
35 {
36     namespace Service
37     {
38         /**
39          * @class   NSTopic
40          * @brief   This class provides a set of APIs for Notification service Topic.
41          */
42         class NSTopic
43         {
44             public:
45                 /**
46                      *  Notification topic State
47                      */
48                 enum class NSTopicState
49                 {
50                     UNSUBSCRIBED = 0,
51                     SUBSCRIBED = 1,
52                 };
53
54                 /**
55                      * Constructor of NSTopic.
56                      */
57                 NSTopic(): m_state(NSTopicState::UNSUBSCRIBED) { }
58
59                 /**
60                      * Constructor of NSTopic.
61                      *
62                      * @param topicName - topicName of the Notification service Topic.
63                      * @param state - as NSTopicState.
64                      */
65                 NSTopic(const std::string &topicName, const NSTopicState state)
66                     : m_topicName(topicName) , m_state(state) {}
67
68
69                 /**
70                      * Destructor of NSTopic.
71                      */
72                 ~NSTopic() = default;
73
74                 /**
75                       * This method is for getting topicName from the Notification service Topic.
76                       *
77                       * @return topicName as string.
78                       */
79                 std::string getTopicName() const;
80
81                 /**
82                       * This method is for setting topicName for the Notification service Topic.
83                       *
84                       * @param topicName - as string.
85                       */
86                 void setTopicName(const std::string &topicName);
87
88                 /**
89                       * This method is for getting state from the Notification service Topic.
90                       *
91                       * @return state as NSTopicState.
92                       */
93                 NSTopicState getState() const;
94
95                 /**
96                       * This method is for setting state for the Notification service Topic.
97                       *
98                       * @param state - as NSTopicState.
99                       */
100                 void setState(const NSTopicState state);
101
102             private:
103                 std::string m_topicName;
104                 NSTopicState m_state;
105
106         };
107     }
108 }
109 #endif /* _NS_TOPIC_H_ */