added cacheadapter interface and memorycache of notification.
[platform/upstream/iotivity.git] / service / notification / src / consumer / NSConsumerCache.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 #ifndef _NS_CONSUMER_CACHE_H_
22 #define _NS_CONSUMER_CACHE_H_
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif // __cplusplus
27
28 #include <stdlib.h>
29 #include <stdbool.h>
30
31 #include "NSCommon.h"
32 #include "NSConsumerCommon.h"
33
34
35 typedef void * NSCacheData;
36
37 typedef struct _NSCacheObject
38 {
39     NSCacheData * data;
40     struct _NSCacheObject * next;
41 } NSCacheObject;
42
43 NSCacheList * NSConsumerCacheInit();
44 NSResult NSConsumerCacheDestroy(NSCacheList * list);
45
46 NSResult NSConsumerCacheInsert(NSCacheList * list, NSCacheObject * newObj);
47 NSResult NSConsumerCacheDelete(NSCacheList * list, NSCacheObject * delObj);
48
49 NSCacheObject * NSConsumerCacheFind(NSCacheList * list, char * findId);
50
51 NSResult NSConsumerCacheWrite(NSCacheList * list, NSCacheObject * writeObj);
52 NSCacheObject * NSConsumerCacheRead(NSCacheList * list, NSCacheObject * readObj);
53
54
55 #ifdef __cplusplus
56 }
57 #endif // __cplusplus
58
59 #endif // _NS_CONSUMER_CACHE_H_