xref: /haiku/headers/os/package/hpkg/BlockBufferPool.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 /*
2  * Copyright 2009,2011, Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _PACKAGE__HPKG__BLOCK_BUFFER_POOL_H_
6 #define _PACKAGE__HPKG__BLOCK_BUFFER_POOL_H_
7 
8 
9 #include <SupportDefs.h>
10 
11 #include <package/hpkg/BufferPool.h>
12 
13 
14 namespace BPackageKit {
15 
16 namespace BHPKG {
17 
18 
19 namespace BPrivate {
20 	class BlockBufferPoolImpl;
21 }
22 using BPrivate::BlockBufferPoolImpl;
23 
24 
25 class BBlockBufferPool : public BBufferPool, public BBufferPoolLockable {
26 public:
27 								BBlockBufferPool(size_t blockSize,
28 									uint32 maxCachedBlocks);
29 	virtual						~BBlockBufferPool();
30 
31 	virtual	status_t			Init();
32 
33 	virtual	PoolBuffer*			GetBuffer(size_t size,
34 									PoolBuffer** owner = NULL,
35 									bool* _newBuffer = NULL);
36 	virtual	void				PutBufferAndCache(PoolBuffer** owner);
37 	virtual	void				PutBuffer(PoolBuffer** owner);
38 
39 private:
40 			BlockBufferPoolImpl*	fImpl;
41 };
42 
43 
44 }	// namespace BHPKG
45 
46 }	// namespace BPackageKit
47 
48 
49 #endif	// _PACKAGE__HPKG__BLOCK_BUFFER_POOL_H_
50