1 | ///////////////////////////////////////////////////////////////////////////  |
2 | //  |
3 | // Copyright (c) 2011, Industrial Light & Magic, a division of Lucas  |
4 | // Digital Ltd. LLC  |
5 | //  |
6 | // All rights reserved.  |
7 | //  |
8 | // Redistribution and use in source and binary forms, with or without  |
9 | // modification, are permitted provided that the following conditions are  |
10 | // met:  |
11 | // * Redistributions of source code must retain the above copyright  |
12 | // notice, this list of conditions and the following disclaimer.  |
13 | // * Redistributions in binary form must reproduce the above  |
14 | // copyright notice, this list of conditions and the following disclaimer  |
15 | // in the documentation and/or other materials provided with the  |
16 | // distribution.  |
17 | // * Neither the name of Industrial Light & Magic nor the names of  |
18 | // its contributors may be used to endorse or promote products derived  |
19 | // from this software without specific prior written permission.  |
20 | //  |
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  |
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  |
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  |
24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  |
26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  |
27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  |
28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  |
29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  |
30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  |
31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
32 | //  |
33 | ///////////////////////////////////////////////////////////////////////////  |
34 |   |
35 | #ifndef IMFMULTIPARTINPUTFILE_H_  |
36 | #define IMFMULTIPARTINPUTFILE_H_  |
37 |   |
38 | #include "ImfGenericInputFile.h"  |
39 | #include "ImfNamespace.h"  |
40 | #include "ImfForward.h"  |
41 | #include "ImfThreading.h"  |
42 | #include "ImfExport.h"  |
43 |   |
44 | OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER  |
45 |   |
46 |   |
47 | class MultiPartInputFile : public GenericInputFile  |
48 | {  |
49 | public:  |
50 | IMF_EXPORT  |
51 | MultiPartInputFile(const char fileName[],  |
52 | int numThreads = globalThreadCount(),  |
53 | bool reconstructChunkOffsetTable = true);  |
54 |   |
55 | IMF_EXPORT  |
56 | MultiPartInputFile(IStream& is,  |
57 | int numThreads = globalThreadCount(),  |
58 | bool reconstructChunkOffsetTable = true);  |
59 |   |
60 | IMF_EXPORT  |
61 | virtual ~MultiPartInputFile();  |
62 |   |
63 | // ----------------------  |
64 | // Count of number of parts in file  |
65 | // ---------------------  |
66 | IMF_EXPORT  |
67 | int parts() const;  |
68 |   |
69 |   |
70 | //----------------------  |
71 | // Access to the headers  |
72 | //----------------------  |
73 |   |
74 | IMF_EXPORT  |
75 | const Header & (int n) const;  |
76 |   |
77 |   |
78 | //----------------------------------  |
79 | // Access to the file format version  |
80 | //----------------------------------  |
81 |   |
82 | IMF_EXPORT  |
83 | int version () const;  |
84 |   |
85 |   |
86 | // =----------------------------------------  |
87 | // Check whether the entire chunk offset  |
88 | // table for the part is written correctly  |
89 | // -----------------------------------------  |
90 | IMF_EXPORT  |
91 | bool partComplete(int part) const;  |
92 |   |
93 |   |
94 | struct Data;  |
95 |   |
96 |   |
97 | private:  |
98 | Data* _data;  |
99 |   |
100 | MultiPartInputFile(const MultiPartInputFile &) = delete;  |
101 | MultiPartInputFile& operator = (const MultiPartInputFile &) = delete;  |
102 | MultiPartInputFile(MultiPartInputFile &&) = delete;  |
103 | MultiPartInputFile& operator = (MultiPartInputFile &&) = delete;  |
104 |   |
105 |   |
106 | //  |
107 | // used internally by 'Part' types to access individual parts of the multipart file  |
108 | //  |
109 | template<class T> T* getInputPart(int partNumber);  |
110 | InputPartData* getPart(int);  |
111 |   |
112 | void initialize();  |
113 |   |
114 |   |
115 |   |
116 |   |
117 | friend class InputPart;  |
118 | friend class ScanLineInputPart;  |
119 | friend class TiledInputPart;  |
120 | friend class DeepScanLineInputPart;  |
121 | friend class DeepTiledInputPart;  |
122 |   |
123 | //  |
124 | // For backward compatibility.  |
125 | //  |
126 |   |
127 | friend class InputFile;  |
128 | friend class TiledInputFile;  |
129 | friend class ScanLineInputFile;  |
130 | friend class DeepScanLineInputFile;  |
131 | friend class DeepTiledInputFile;  |
132 | };  |
133 |   |
134 |   |
135 | OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT  |
136 |   |
137 | #endif /* IMFMULTIPARTINPUTFILE_H_ */  |
138 | |