Remove unused directories and files in video_in_hal
[staging/basesystem.git] / nsframework / notification_persistent_service / server / include / ns_npp_handlelist.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 //////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup tag_NS_NPPService
19 /// \ingroup  tag_NS_NPPService
20 ///
21 //////////////////////////////////////////////////////////////////////////////////////////////////
22
23 //////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup  tag_NS_NPPService
25 /// \brief    This class holds the message queue handles for notification subscribers
26 ///
27 /// This is a singleton class which holds the message queue handles for notification subscribers.
28 /// This will ensure that NS_NPPService will hold only one handle per subscriber.
29 //////////////////////////////////////////////////////////////////////////////////////////////////
30
31 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
32 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_
33
34 #include <native_service/frameworkunified_types.h>
35 #include <string>
36 #include <map>
37 #include <utility>
38
39 typedef std::map<std::string, HANDLE> HandleList_Type;
40 typedef std::pair<HandleList_Type::iterator, bool> HandleListRetStatus_Type;
41
42
43
44 /**
45  *  This class holds the message queue handles for notification subscribers
46  */
47 class CHandleList {
48  public:
49   ////////////////////////////////////////////////////////////////////////////////////////////////
50   /// GetHandleList
51   /// This function is used to get the singleton instance of class.
52   /// NOTE: Not thread safe. Others threads would not use this function.
53   ///
54   /// \return CHandleList
55   ///     CHandleList - singleton instance of class
56   ///
57   ////////////////////////////////////////////////////////////////////////////////////////////////
58   static CHandleList *GetHandleList();
59
60   ////////////////////////////////////////////////////////////////////////////////////////////////
61   /// ReleaseHandleList
62   /// This function is used to release the instance of class.
63   /// NOTE: Not thread safe. Others threads would not use this function.
64   ///
65   /// \param
66   ///
67   /// \return EFrameworkunifiedStatus
68   //      EFrameworkunifiedStatus - success or failure status
69   ///
70   ////////////////////////////////////////////////////////////////////////////////////////////////
71   static EFrameworkunifiedStatus ReleaseHandleList();
72
73   ////////////////////////////////////////////////////////////////////////////////////////////////
74   /// AddHandleInList
75   /// Add pair of subscriber name and corresponding handle in map.
76   /// NOTE: Not thread safe. Others threads would not use this function.
77   ///
78   /// \param  [IN] f_csubscribername
79   ///     std::string - name of application subscribing for notification
80   /// \param  [IN] f_hmqhandle
81   ///     HANDLE - Message queue handle of the subscriber
82   ///
83   /// \return EFrameworkunifiedStatus
84   //      EFrameworkunifiedStatus -
85   ///
86   ////////////////////////////////////////////////////////////////////////////////////////////////
87   EFrameworkunifiedStatus AddHandleInList(std::string f_csubscribername, HANDLE f_hmqhandle);
88
89   ////////////////////////////////////////////////////////////////////////////////////////////////
90   /// RemoveHandleFromList
91   /// Remove handle for subscriber from the list.
92   /// Handle will actually get removed when all the notifications are unsubscribed by the subscriber
93   /// NOTE: Not thread safe. Others threads would not use this function.
94   ///
95   /// \param  [IN] f_csubscribername
96   ///     std::string - name of application subscribing for notification
97   ///
98   /// \return EFrameworkunifiedStatus
99   //      EFrameworkunifiedStatus -
100   ///
101   ////////////////////////////////////////////////////////////////////////////////////////////////
102   EFrameworkunifiedStatus RemoveHandleFromList(std::string f_csubscribername);
103
104   ////////////////////////////////////////////////////////////////////////////////////////////////
105   /// GetSubscriberMqHandle
106   /// Get the message queue handle of a subscriber.
107   /// NOTE: Not thread safe. Others threads would not use this function.
108   ///
109   /// \param  [IN] f_csubscribername
110   ///     std::string - name of application subscribing for notification
111   ///
112   /// \return HANDLE
113   //      HANDLE - Message queue handle of the subscriber
114   ///
115   ////////////////////////////////////////////////////////////////////////////////////////////////
116   HANDLE  GetSubscriberMqHandle(std::string f_csubscribername);
117
118  private:
119   ////////////////////////////////////////////////////////////////////////////////////////////////
120   /// CHandleList
121   /// Constructor of CHandleList class
122   ///
123   /// \param
124   ///
125   /// \return
126   ///
127   ////////////////////////////////////////////////////////////////////////////////////////////////
128   CHandleList();
129
130   ////////////////////////////////////////////////////////////////////////////////////////////////
131   /// ~CHandleList
132   /// Destructor of CHandleList class
133   ///
134   /// \param
135   ///
136   /// \return
137   ///
138   ////////////////////////////////////////////////////////////////////////////////////////////////
139   ~CHandleList();
140
141   HandleList_Type    m_mHandleList;     ///< map which stores all the message queue handle
142
143   static CHandleList *m_psHandleList;  // NOLINT (readability/naming)
144 };
145 #endif  // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_HANDLELIST_H_