xref: /haiku/src/system/boot/platform/openfirmware/Handle.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
1 /*
2  * Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef HANDLE_H
6 #define HANDLE_H
7 
8 
9 #include <boot/vfs.h>
10 
11 
12 #ifdef __cplusplus
13 
14 class Handle : public ConsoleNode {
15 	public:
16 		Handle(int handle, bool takeOwnership = true);
17 		Handle();
18 		virtual ~Handle();
19 
20 		void SetHandle(int handle, bool takeOwnership = true);
21 
22 		virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize);
23 		virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize);
24 
25 		virtual off_t Size() const;
26 
27 	protected:
28 		int		fHandle;
29 		bool	fOwnHandle;
30 };
31 
32 #endif	/* __cplusplus */
33 
34 #endif	/* HANDLE_H */
35