1 | /*****************************************************************************/ |
2 | // Copyright 2006-2007 Adobe Systems Incorporated |
3 | // All Rights Reserved. |
4 | // |
5 | // NOTICE: Adobe permits you to use, modify, and distribute this file in |
6 | // accordance with the terms of the Adobe license agreement accompanying it. |
7 | /*****************************************************************************/ |
8 | |
9 | /* $Id: //mondo/dng_sdk_1_4/dng_sdk/source/dng_file_stream.h#1 $ */ |
10 | /* $DateTime: 2012/05/30 13:28:51 $ */ |
11 | /* $Change: 832332 $ */ |
12 | /* $Author: tknoll $ */ |
13 | |
14 | /** \file |
15 | * Simple, portable, file read/write support. |
16 | */ |
17 | |
18 | /*****************************************************************************/ |
19 | |
20 | #ifndef __dng_file_stream__ |
21 | #define __dng_file_stream__ |
22 | |
23 | /*****************************************************************************/ |
24 | |
25 | #include "dng_stream.h" |
26 | |
27 | /*****************************************************************************/ |
28 | |
29 | /// \brief A stream to/from a disk file. See dng_stream for read/write interface |
30 | |
31 | class dng_file_stream: public dng_stream |
32 | { |
33 | |
34 | private: |
35 | |
36 | FILE *fFile; |
37 | |
38 | public: |
39 | |
40 | /// Open a stream on a file. |
41 | /// \param filename Pathname in platform synax. |
42 | /// \param output Set to true if writing, false otherwise. |
43 | /// \param bufferSize size of internal buffer to use. Defaults to 4k. |
44 | |
45 | dng_file_stream (const char *filename, |
46 | bool output = false, |
47 | uint32 bufferSize = kDefaultBufferSize); |
48 | |
49 | virtual ~dng_file_stream (); |
50 | |
51 | protected: |
52 | |
53 | virtual uint64 DoGetLength (); |
54 | |
55 | virtual void DoRead (void *data, |
56 | uint32 count, |
57 | uint64 offset); |
58 | |
59 | virtual void DoWrite (const void *data, |
60 | uint32 count, |
61 | uint64 offset); |
62 | |
63 | private: |
64 | |
65 | // Hidden copy constructor and assignment operator. |
66 | |
67 | dng_file_stream (const dng_file_stream &stream); |
68 | |
69 | dng_file_stream & operator= (const dng_file_stream &stream); |
70 | |
71 | }; |
72 | |
73 | /*****************************************************************************/ |
74 | |
75 | #endif |
76 | |
77 | /*****************************************************************************/ |
78 | |