File indexing completed on 2026-09-20 09:18:45
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _OSD_CachedFileSystem_HeaderFile
0015 #define _OSD_CachedFileSystem_HeaderFile
0016
0017 #include <OSD_FileSystem.hxx>
0018
0019
0020
0021
0022
0023
0024
0025 class OSD_CachedFileSystem : public OSD_FileSystem
0026 {
0027 DEFINE_STANDARD_RTTIEXT(OSD_CachedFileSystem, OSD_FileSystem)
0028 public:
0029
0030 Standard_EXPORT OSD_CachedFileSystem(
0031 const occ::handle<OSD_FileSystem>& theLinkedFileSystem = occ::handle<OSD_FileSystem>());
0032
0033
0034 const occ::handle<OSD_FileSystem>& LinkedFileSystem() const { return myLinkedFS; }
0035
0036
0037 void SetLinkedFileSystem(const occ::handle<OSD_FileSystem>& theLinkedFileSystem)
0038 {
0039 myLinkedFS = theLinkedFileSystem;
0040 }
0041
0042
0043 Standard_EXPORT bool IsSupportedPath(const TCollection_AsciiString& theUrl) const override;
0044
0045
0046 Standard_EXPORT bool IsOpenIStream(const std::shared_ptr<std::istream>& theStream) const override;
0047
0048
0049 Standard_EXPORT bool IsOpenOStream(const std::shared_ptr<std::ostream>& theStream) const override;
0050
0051
0052
0053 Standard_EXPORT std::shared_ptr<std::istream> OpenIStream(
0054 const TCollection_AsciiString& theUrl,
0055 const std::ios_base::openmode theParams,
0056 const int64_t theOffset,
0057 const std::shared_ptr<std::istream>& theOldStream) override;
0058
0059
0060
0061 Standard_EXPORT std::shared_ptr<std::ostream> OpenOStream(
0062 const TCollection_AsciiString& theUrl,
0063 const std::ios_base::openmode theMode) override;
0064
0065
0066 Standard_EXPORT std::shared_ptr<std::streambuf> OpenStreamBuffer(
0067 const TCollection_AsciiString& theUrl,
0068 const std::ios_base::openmode theMode,
0069 const int64_t theOffset = 0,
0070 int64_t* theOutBufSize = nullptr) override;
0071
0072 protected:
0073
0074 struct OSD_CachedStream
0075 {
0076 TCollection_AsciiString Url;
0077 std::shared_ptr<std::istream> Stream;
0078 std::shared_ptr<std::streambuf> StreamBuf;
0079
0080 void Reset()
0081 {
0082 Stream.reset();
0083 StreamBuf.reset();
0084 }
0085 };
0086
0087 protected:
0088 OSD_CachedStream myStream;
0089 occ::handle<OSD_FileSystem> myLinkedFS;
0090 };
0091
0092 #endif