ImfMultiPartInputFile.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. // Copyright (c) Contributors to the OpenEXR Project.
  4. //
  5. #ifndef IMFMULTIPARTINPUTFILE_H_
  6. #define IMFMULTIPARTINPUTFILE_H_
  7. #include "ImfForward.h"
  8. #include "ImfGenericInputFile.h"
  9. #include "ImfThreading.h"
  10. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
  11. class IMF_EXPORT_TYPE MultiPartInputFile : public GenericInputFile
  12. {
  13. public:
  14. IMF_EXPORT
  15. MultiPartInputFile(const char fileName[],
  16. int numThreads = globalThreadCount(),
  17. bool reconstructChunkOffsetTable = true);
  18. IMF_EXPORT
  19. MultiPartInputFile(IStream& is,
  20. int numThreads = globalThreadCount(),
  21. bool reconstructChunkOffsetTable = true);
  22. IMF_EXPORT
  23. virtual ~MultiPartInputFile();
  24. // ----------------------
  25. // Count of number of parts in file
  26. // ---------------------
  27. IMF_EXPORT
  28. int parts() const;
  29. //----------------------
  30. // Access to the headers
  31. //----------------------
  32. IMF_EXPORT
  33. const Header & header(int n) const;
  34. //----------------------------------
  35. // Access to the file format version
  36. //----------------------------------
  37. IMF_EXPORT
  38. int version () const;
  39. // =----------------------------------------
  40. // Check whether the entire chunk offset
  41. // table for the part is written correctly
  42. // -----------------------------------------
  43. IMF_EXPORT
  44. bool partComplete(int part) const;
  45. // ----------------------------------------
  46. // Flush internal part cache
  47. // Invalidates all 'Part' types previously
  48. // constructed from this file
  49. // Intended for test purposes, but can be
  50. // used to temporarily reduce memory overhead,
  51. // or to switch between types (e.g. TiledInputPart
  52. // or DeepScanLineInputPart to InputPart)
  53. // ----------------------------------------
  54. IMF_EXPORT
  55. void flushPartCache();
  56. struct IMF_HIDDEN Data;
  57. private:
  58. Data* _data;
  59. MultiPartInputFile(const MultiPartInputFile &) = delete;
  60. MultiPartInputFile& operator = (const MultiPartInputFile &) = delete;
  61. MultiPartInputFile(MultiPartInputFile &&) = delete;
  62. MultiPartInputFile& operator = (MultiPartInputFile &&) = delete;
  63. //
  64. // used internally by 'Part' types to access individual parts of the multipart file
  65. //
  66. template<class T> IMF_HIDDEN T* getInputPart(int partNumber);
  67. IMF_HIDDEN InputPartData* getPart(int);
  68. IMF_HIDDEN void initialize();
  69. friend class InputPart;
  70. friend class ScanLineInputPart;
  71. friend class TiledInputPart;
  72. friend class DeepScanLineInputPart;
  73. friend class DeepTiledInputPart;
  74. //
  75. // For backward compatibility.
  76. //
  77. friend class InputFile;
  78. friend class TiledInputFile;
  79. friend class ScanLineInputFile;
  80. friend class DeepScanLineInputFile;
  81. friend class DeepTiledInputFile;
  82. };
  83. OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
  84. #endif /* IMFMULTIPARTINPUTFILE_H_ */