1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_STORE_SOURCE_STORBIOS_HXX
21 #define INCLUDED_STORE_SOURCE_STORBIOS_HXX
23 #include <sal/types.h>
24 #include <rtl/ref.hxx>
25 #include <osl/mutex.hxx>
27 #include <store/types.h>
29 #include "storbase.hxx"
36 struct SuperBlockPage
;
38 class OStorePageBIOS
: public store::OStoreObject
45 /** Conversion into Mutex&
47 inline operator osl::Mutex
& (void) const;
50 * @param pLockBytes [in]
51 * @param eAccessMode [in]
52 * @param rnPageSize [inout]
53 * @return store_E_None upon success
55 virtual storeError
initialize (
56 ILockBytes
* pLockBytes
,
57 storeAccessMode eAccessMode
,
58 sal_uInt16
& rnPageSize
);
60 rtl::Reference
< PageData::Allocator
> & allocator()
68 sal_uInt32 nAddr
, void *pData
, sal_uInt32 nSize
) const;
73 sal_uInt32 nAddr
, const void *pData
, sal_uInt32 nSize
) const;
77 inline bool isWriteable() const;
81 inline bool isValid() const;
85 storeError
acquirePage (
86 const OStorePageDescriptor
& rDescr
, storeAccessMode eMode
);
88 storeError
releasePage (const OStorePageDescriptor
& rDescr
);
90 storeError
allocate (OStorePageObject
& rPage
);
92 storeError
free (sal_uInt32 nAddr
);
96 storeError
loadObjectAt (
97 OStorePageObject
& rPage
, sal_uInt32 nAddr
);
99 storeError
saveObjectAt (
100 OStorePageObject
& rPage
, sal_uInt32 nAddr
);
103 * @return store_E_None upon success.
108 * @return store_E_None upon success.
113 /** Destruction (OReference).
115 virtual ~OStorePageBIOS() override
;
120 rtl::Reference
<ILockBytes
> m_xLockBytes
;
123 std::unique_ptr
<SuperBlockPage
> m_pSuper
;
127 rtl::Reference
< PageData::Allocator
> m_xAllocator
;
128 rtl::Reference
< PageCache
> m_xCache
;
130 /** Page Access (control).
144 static int SAL_CALL
constructor (void * obj
, void * arg
);
146 static Ace
* find (Ace
* head
, sal_uInt32 addr
);
147 static void insert (Ace
* head
, Ace
* entry
);
157 storeError
initialize_Impl (
158 ILockBytes
* pLockBytes
,
159 storeAccessMode eAccessMode
,
160 sal_uInt16
& rnPageSize
);
163 /** Page Maintenance.
165 storeError
loadObjectAt_Impl (
166 OStorePageObject
& rPage
, sal_uInt32 nAddr
) const;
167 storeError
saveObjectAt_Impl (
168 OStorePageObject
& rPage
, sal_uInt32 nAddr
) const;
170 OStorePageBIOS (const OStorePageBIOS
&) = delete;
171 OStorePageBIOS
& operator= (const OStorePageBIOS
&) = delete;
174 inline OStorePageBIOS::operator osl::Mutex
& (void) const
176 return const_cast<osl::Mutex
&>(m_aMutex
);
178 inline bool OStorePageBIOS::isWriteable() const
182 inline bool OStorePageBIOS::isValid() const
184 return m_xLockBytes
.is();
189 #endif // INCLUDED_STORE_SOURCE_STORBIOS_HXX
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */