HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfMultiPartInputFile.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef IMFMULTIPARTINPUTFILE_H_
7 #define IMFMULTIPARTINPUTFILE_H_
8 
9 #include "ImfForward.h"
10 
11 #include "ImfThreading.h"
12 
13 #include "ImfContext.h"
14 
16 
17 /// \brief
18 ///
19 /// TODO: Document this
21 {
22 public:
25  const char fileName[],
26  int numThreads = globalThreadCount (),
27  bool reconstructChunkOffsetTable = true);
28 
31  IStream& is,
32  int numThreads = globalThreadCount (),
33  bool reconstructChunkOffsetTable = true);
34 
35  //-----------------------------------------------------------
36  // A constructor that opens the file with the specified name
37  // and context initialization routines
38  // Destroying the InputFile object will close the file.
39  //-----------------------------------------------------------
42  const char* filename,
43  const ContextInitializer& ctxtinit,
44  int numThreads = globalThreadCount (),
45  bool autoAddType = true);
46 
47  //------------------------
48  // Access to the file name
49  //------------------------
50 
52  const char* fileName () const;
53 
54  //----------------------------------
55  // Access to the file format version
56  //----------------------------------
57 
59  int version () const;
60 
61  // ----------------------
62  // Count of number of parts in file
63  // ---------------------
65  int parts () const;
66 
67  //----------------------
68  // Access to the headers
69  //----------------------
70 
72  const Header& header (int partNumber) const;
73 
74  // =----------------------------------------
75  // Check whether the entire chunk offset
76  // table for the part is written correctly
77  // -----------------------------------------
79  bool partComplete (int partNumber) const;
80 
81  // ----------------------------------------
82  // Flush internal part cache
83  // Invalidates all 'Part' types previously
84  // constructed from this file
85  // Intended for test purposes, but can be
86  // used to temporarily reduce memory overhead,
87  // or to switch between types (e.g. TiledInputPart
88  // or DeepScanLineInputPart to InputPart)
89  // ----------------------------------------
90 
92  void flushPartCache ();
93 
94 private:
95  Context _ctxt;
96  struct Data;
97  std::shared_ptr<Data> _data;
98 
99  //
100  // used internally by 'Part' types to access individual parts of the multipart file
101  //
102  // TODO: change these to value / reference semantics (smart ptr)
103  template <class T> IMF_HIDDEN T* getInputPart (int partNumber);
104  IMF_HIDDEN InputPartData* getPart (int) const;
105 
106  IMF_HIDDEN void initialize ();
107 
108  friend class InputPart;
109  friend class ScanLineInputPart;
110  friend class TiledInputPart;
111  friend class DeepScanLineInputPart;
112  friend class DeepTiledInputPart;
113 
114  //
115  // For backward compatibility.
116  //
117 
118  friend class InputFile;
119  friend class TiledInputFile;
120  friend class ScanLineInputFile;
121  friend class DeepScanLineInputFile;
122  friend class DeepTiledInputFile;
123 };
124 
126 
127 #endif /* IMFMULTIPARTINPUTFILE_H_ */
Definition: ImfIO.h:26
GT_API const UT_StringHolder filename
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
class IMF_EXPORT_TYPE MultiPartInputFile
Definition: ImfForward.h:51
Provides generic access to read an image from an EXR file.
Definition: ImfInputFile.h:64
#define IMF_HIDDEN
Definition: ImfExport.h:55
ContextInitializer provides a basic type to initialize a Context with.
TODO: Document this.
#define IMF_EXPORT
Definition: ImfExport.h:54
OPENVDB_API void initialize()
Global registration of native Grid, Transform, Metadata and Point attribute types. Also initializes blosc (if enabled).
Definition: logging.h:294
GT_API const UT_StringHolder version
OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER IMF_EXPORT int globalThreadCount()
Context provides a wrapper around the Core library context object.
Definition: ImfContext.h:30
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:80
class IMF_EXPORT_TYPE ScanLineInputFile
Definition: ImfForward.h:35
#define IMF_EXPORT_TYPE
Definition: ImfExport.h:57