2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_NPPService
19 /// \brief The file contains declaration of CRegistryEntry class.
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
25 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
26 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_
28 #include <native_service/frameworkunified_types.h>
30 #include "ns_npp_types.h"
33 * This class contains the registry information of the files/folders to be peresisted.
35 class CRegistryEntry {
37 ////////////////////////////////////////////////////////////////////////////////////////////////
39 /// Constructor of CRegistryEntry class
41 /// \param [OUT] f_ctag
42 /// std::string& - File or Folder tag
44 /// \param [OUT] f_crequester
45 /// std::string& - Requester Name
47 /// \param [OUT] f_cstoragepath
48 /// std::string& - File or Folder persistence storage path
50 /// \param [IN] f_bisuserpersistence
51 /// BOOL - File or Folder is user specific
54 ////////////////////////////////////////////////////////////////////////////////////////////////
55 explicit CRegistryEntry(const std::string &f_ctag, const std::string &f_crequester,
56 const std::string &f_cstoragepath, BOOL f_bisuserpersistence);
58 ////////////////////////////////////////////////////////////////////////////////////////////////
60 /// Copy Constructor of CRegistryEntry class
66 ////////////////////////////////////////////////////////////////////////////////////////////////
67 CRegistryEntry(const CRegistryEntry &f_objin);
69 ////////////////////////////////////////////////////////////////////////////////////////////////
71 /// Operator overload =
73 /// \param [IN] f_objin
74 /// CRegistryEntry& - In object.
78 ////////////////////////////////////////////////////////////////////////////////////////////////
79 CRegistryEntry &operator=(const CRegistryEntry &f_objin); // NOLINT (readability/naming)
81 ////////////////////////////////////////////////////////////////////////////////////////////////
85 /// \param [IN] f_creleasepath
86 /// std::string& - Path of the file/folder to be released.
90 ////////////////////////////////////////////////////////////////////////////////////////////////
91 VOID SetReleasePath(const std::string &f_creleasepath);
93 ////////////////////////////////////////////////////////////////////////////////////////////////
95 /// Set the file/folder persist member variable to true to notify that the file/folder is being
102 ////////////////////////////////////////////////////////////////////////////////////////////////
103 VOID SetBeingPersisted();
105 ////////////////////////////////////////////////////////////////////////////////////////////////
107 /// Ack from copy worker received. Process the ack.
113 ////////////////////////////////////////////////////////////////////////////////////////////////
116 ////////////////////////////////////////////////////////////////////////////////////////////////
118 /// Check if File/folder released or not.
123 // BOOL - True if file/folder is released else false
125 ////////////////////////////////////////////////////////////////////////////////////////////////
126 BOOL IsReleased() const;
128 ////////////////////////////////////////////////////////////////////////////////////////////////
129 /// HasntBeenPersisted
130 /// File persisted or not
135 // BOOL - True if file is not persisted else false
137 ////////////////////////////////////////////////////////////////////////////////////////////////
138 BOOL HasntBeenPersisted() const;
140 ////////////////////////////////////////////////////////////////////////////////////////////////
142 /// File/Folder persisted or not
147 // BOOL - True if file/folder is persisted else false
149 ////////////////////////////////////////////////////////////////////////////////////////////////
150 BOOL IsPersisted() const;
152 ////////////////////////////////////////////////////////////////////////////////////////////////
154 /// Ack is pending or not.
159 // BOOL - True if ack is pending else false
161 ////////////////////////////////////////////////////////////////////////////////////////////////
162 BOOL IsAckPending() const;
164 ////////////////////////////////////////////////////////////////////////////////////////////////
166 /// Get the persist path.
170 /// \return std::string
171 // std::string - Returns the persist path.
173 ////////////////////////////////////////////////////////////////////////////////////////////////
174 std::string GetPersistPath() const;
176 ////////////////////////////////////////////////////////////////////////////////////////////////
178 /// Get the release path.
182 /// \return std::string
183 // std::string - Returns the release path.
185 ////////////////////////////////////////////////////////////////////////////////////////////////
186 std::string GetReleasePath() const;
188 ////////////////////////////////////////////////////////////////////////////////////////////////
190 /// Get the load path.
192 /// \param [IN] f_epersisttype
193 /// ENotificationpersistentservicePersistType - type of persisted data
195 /// \param [IN] f_cusername
196 /// std::string - Current user name
199 /// \return std::string
200 // std::string - Returns the load path.
202 ////////////////////////////////////////////////////////////////////////////////////////////////
203 std::string GetLoadPath(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername) const;
205 ////////////////////////////////////////////////////////////////////////////////////////////////
207 /// Get the name of requester.
211 /// \return std::string
212 // std::string - Returns the name of requester.
214 ////////////////////////////////////////////////////////////////////////////////////////////////
215 std::string GetRequester() const;
217 ////////////////////////////////////////////////////////////////////////////////////////////////
223 /// \return std::string
224 // std::string - Returns the tag.
226 ////////////////////////////////////////////////////////////////////////////////////////////////
227 std::string GetTag() const;
229 ////////////////////////////////////////////////////////////////////////////////////////////////
230 /// IsUserPersistence
231 /// Returns TRUE if it is a user persistence.
236 // BOOL - Returns TRUE if it is a user persistence.
238 ////////////////////////////////////////////////////////////////////////////////////////////////
239 BOOL IsUserPersistence();
241 ////////////////////////////////////////////////////////////////////////////////////////////////
243 /// Set current copying action of a the corresponding tag.
245 /// \param [IN] f_ecurrentaction
246 /// ENPS_Loadtype - Current action
249 ////////////////////////////////////////////////////////////////////////////////////////////////
250 VOID SetCurrentAction(ENPS_Loadtype f_ecurrentaction);
252 ////////////////////////////////////////////////////////////////////////////////////////////////
253 /// ResetPersistedFlag
254 /// Reset Persist flags
259 ////////////////////////////////////////////////////////////////////////////////////////////////
260 VOID ResetPersistedFlag();
262 ////////////////////////////////////////////////////////////////////////////////////////////////
263 /// SetPersistProperties
264 /// creates persistence path and stores the persist type
266 /// \param [IN] f_epersisttype
267 /// ENotificationpersistentservicePersistType - Set persist type
268 /// \param [IN] f_cusername
269 /// std::string - Username related to persist tag if any.
273 ////////////////////////////////////////////////////////////////////////////////////////////////
274 VOID SetPersistProperties(ENotificationpersistentservicePersistType f_epersisttype, std::string f_cusername = "");
276 ////////////////////////////////////////////////////////////////////////////////////////////////
278 /// Returns persist type of a job
282 /// \return ENotificationpersistentservicePersistType
283 // ENotificationpersistentservicePersistType - Returns persist type
285 ////////////////////////////////////////////////////////////////////////////////////////////////
286 ENotificationpersistentservicePersistType GetPersistType() const;
288 ////////////////////////////////////////////////////////////////////////////////////////////////
289 /// SetPersistentCategory
290 /// Sets the persistent type related to tag
292 /// \param [IN] f_epersistcategory
293 /// EFrameworkunifiedPersistCategory - persist category
295 /// \return EFrameworkunifiedStatus
296 // EFrameworkunifiedStatus - success or failure status
298 ////////////////////////////////////////////////////////////////////////////////////////////////
299 EFrameworkunifiedStatus SetPersistentCategory(EFrameworkunifiedPersistCategory f_epersistcategory);
301 ////////////////////////////////////////////////////////////////////////////////////////////////
302 /// GetPersistentCategory
303 /// Returns persistent type of tag
307 /// \return EFrameworkunifiedPersistCategory
308 // EFrameworkunifiedPersistCategory - Returns persistent type
310 ////////////////////////////////////////////////////////////////////////////////////////////////
311 EFrameworkunifiedPersistCategory GetPersistentCategory();
313 ENPSPersistenceJobState m_eJobState; // Current state of a job
316 std::string m_cTag; // File/Folder tag
317 std::string m_cRequestor; // Requester application name
318 BOOL m_bIsReleased; // if file or folder released
319 BOOL m_bIsPersisted; // if file or folder is persisted
320 std::string m_cPersistPath; // Persist path
321 std::string m_cReleasePath; // Release path
322 std::string m_cBasePath; // Persist base path
323 BOOL m_bIsUserPersistence; // If user persistence
324 ENPS_Loadtype m_eCurrentAction; // Current action to load file to/from
325 /// temporary/persistence memory
326 ENotificationpersistentservicePersistType m_ePersistType;
327 EFrameworkunifiedPersistCategory m_ePersistCategory; // Persistent category
330 #endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_REGISTRY_ENTRY_H_