809954181b0bad39ad60421609edea53fa475b25
[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
61                 /**
62                      * Constructor of NSTopic.
63                      *
64                      * @param topicName - topicName of the Notification service Topic.
65                      * @param state - as NSTopicState.
66                      */
67                 NSTopic(const std::string &topicName, const NSTopicState state)
68                     : m_topicName(topicName) , m_state(state)
69                 {
70                 }
71
72
73                 /**
74                      * Destructor of NSTopic.
75                      */
76                 ~NSTopic() = default;
77
78                 /**
79                       * This method is for getting topicName from the Notification service Topic.
80                       *
81                       * @return topicName as string.
82                       */
83                 std::string getTopicName() const;
84
85                 /**
86                       * This method is for setting topicName for the Notification service Topic.
87                       *
88                       * @param topicName - as string.
89                       */
90                 void setTopicName(const std::string &topicName);
91
92                 /**
93                       * This method is for getting state from the Notification service Topic.
94                       *
95                       * @return state as NSTopicState.
96                       */
97                 NSTopicState getState() const;
98
99                 /**
100                       * This method is for setting state for the Notification service Topic.
101                       *
102                       * @param state - as NSTopicState.
103                       */
104                 void setState(const NSTopicState state);
105
106             private:
107                 std::string m_topicName;
108                 NSTopicState m_state;
109
110         };
111     }
112 }
113 #endif /* _NS_TOPIC_H_ */