xref: /aoo4110/main/store/source/storcach.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  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,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _STORE_STORCACH_HXX
25 #define _STORE_STORCACH_HXX "$Revision: 1.6.8.2 $"
26 
27 #include "sal/types.h"
28 #include "rtl/ref.hxx"
29 
30 #include "store/types.h"
31 #include "storbase.hxx"
32 
33 namespace store
34 {
35 
36 /*========================================================================
37  *
38  * PageCache interface.
39  *
40  *======================================================================*/
41 
42 class PageCache : public rtl::IReference
43 {
44 public:
45 	/** load.
46      */
47     storeError lookupPageAt (
48         PageHolder & rxPage,
49         sal_uInt32   nOffset);
50 
51 	/** insert.
52      */
53     storeError insertPageAt (
54         PageHolder const & rxPage,
55         sal_uInt32         nOffset);
56 
57 	/** update, or insert.
58      */
59     storeError updatePageAt (
60         PageHolder const & rxPage,
61         sal_uInt32         nOffset);
62 
63 	/** remove (invalidate).
64      */
65     storeError removePageAt (
66         sal_uInt32 nOffset);
67 
68 private:
69     /** Implementation (abstract).
70      */
71     virtual storeError lookupPageAt_Impl (
72         PageHolder & rxPage,
73         sal_uInt32   nOffset) = 0;
74 
75     virtual storeError insertPageAt_Impl (
76         PageHolder const & rxPage,
77         sal_uInt32         nOffset) = 0;
78 
79     virtual storeError updatePageAt_Impl (
80         PageHolder const & rxPage,
81         sal_uInt32         nOffset) = 0;
82 
83     virtual storeError removePageAt_Impl (
84         sal_uInt32 nOffset) = 0;
85 };
86 
87 /*========================================================================
88  *
89  * PageCache factory.
90  *
91  *======================================================================*/
92 
93 storeError
94 PageCache_createInstance (
95     rtl::Reference< store::PageCache > & rxCache,
96     sal_uInt16                           nPageSize
97 );
98 
99 /*========================================================================
100  *
101  * The End.
102  *
103  *======================================================================*/
104 
105 } // namespace store
106 
107 #endif /* !_STORE_STORCACH_HXX */
108 
109