IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSTopic.h
Go to the documentation of this file.
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 
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  {
42  class NSTopic
43  {
44  public:
48  enum class NSTopicState
49  {
50  UNSUBSCRIBED = 0,
51  SUBSCRIBED = 1,
52  };
53 
57  NSTopic(): m_state(NSTopicState::UNSUBSCRIBED)
58  {
59  }
60 
67  NSTopic(const std::string &topicName, const NSTopicState state)
68  : m_topicName(topicName) , m_state(state)
69  {
70  }
71 
72 
76  ~NSTopic() = default;
77 
83  std::string getTopicName() const;
84 
90  void setTopicName(const std::string &topicName);
91 
97  NSTopicState getState() const;
98 
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_ */
NSTopicState
Notification topic State.
Definition: NSTopic.h:48
NSTopic(const std::string &topicName, const NSTopicState state)
Constructor of NSTopic.
Definition: NSTopic.h:67
void setState(const NSTopicState state)
This method is for setting state for the Notification service Topic.
NSTopic()
Constructor of NSTopic.
Definition: NSTopic.h:57
~NSTopic()=default
Destructor of NSTopic.
void setTopicName(const std::string &topicName)
This method is for setting topicName for the Notification service Topic.
std::string getTopicName() const
This method is for getting topicName from the Notification service Topic.
NSTopicState
Notification topic state.
Definition: NSCommon.h:93
This class provides a set of APIs for Notification service Topic.
Definition: NSTopic.h:42
NSTopicState getState() const
This method is for getting state from the Notification service Topic.
This file provides APIs of Notification Service for common functions.