|
OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
Public Member Functions | |
| LocalFileLinux (const std::string &filename, OpenMode mode, const OpenZGY::IOContext *iocontext) | |
| virtual void | xx_close () override |
| virtual std::int64_t | xx_eof () const override |
| virtual bool | xx_iscloud () const override |
| virtual void | xx_read (void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override |
| virtual void | xx_readv (const ReadList &requests, bool parallel_ok=false, bool immutable_ok=false, bool transient_ok=false, UsageHint usagehint=UsageHint::Unknown) override |
| virtual void | xx_write (const void *data, std::int64_t offset, std::int64_t size, UsageHint usagehint=UsageHint::Unknown) override |
| virtual bool | xx_threadsafe () const override |
| virtual std::int64_t | _real_eof () const |
| Get the current file size for error reporting. More... | |
Public Member Functions inherited from InternalZGY::FileCommon | |
| FileCommon (const std::string &filename, OpenMode mode, const OpenZGY::IOContext *iocontext) | |
| virtual void | _check_short_read (std::int64_t offset, std::int64_t size, std::int64_t got) const |
| Throw a descriptive error if there was something wrong with the read. More... | |
Static Public Member Functions | |
| static std::shared_ptr< FileADT > | xx_make_instance (const std::string &filename, OpenMode mode, const OpenZGY::IOContext *iocontext) |
Static Public Member Functions inherited from InternalZGY::FileADT | |
| static std::shared_ptr< FileADT > | factory (const std::string &filename, OpenMode mode, const OpenZGY::IOContext *iocontext) |
Additional Inherited Members | |
Static Protected Member Functions inherited from InternalZGY::FileADT | |
| static std::string | _nice (std::int64_t n) |
| Human readable number. | |
| static void | _validate_read (void *data, std::int64_t offset, std::int64_t size, std::int64_t eof, OpenMode mode) |
| static void | _validate_write (const void *data, std::int64_t offset, std::int64_t size, OpenMode mode) |
| static void | _validate_readv (const ReadList &requests, std::int64_t eof, OpenMode mode) |
Protected Attributes inherited from InternalZGY::FileCommon | |
| FileConfig | _config |
| OpenMode | _mode |
| std::string | _name |
| std::int64_t | _eof |
| std::shared_ptr< SummaryTimer > | _rtimer |
| std::shared_ptr< SummaryTimer > | _wtimer |
|
virtual |
Get the current file size for error reporting.
The default implementation in the base class just assumes that the xx_eof() that is (probably) maintained internally is correct.
Reimplemented from InternalZGY::FileCommon.
|
overridevirtual |
Close the file. This should always be done explicitly instead of assuming the destructor will handle it. If left to the destructor then any exceptions will be swallowed.
Implements InternalZGY::FileADT.
|
overridevirtual |
Return the current end-of-file, i.e. the file size.
Implements InternalZGY::FileADT.
|
overridevirtual |
Return true if the file is on the cloud. This might trigger some optimizations.
Implements InternalZGY::FileADT.
|
overridevirtual |
Read binary data from the file. Both size and offset are mandatory. I.e. caller is not allowed to read "the entire file", and not allowed to "read from where I left off the last time". The actual reading will be done in a derived class. The base class only validates the arguments.
Implements InternalZGY::FileADT.
|
overridevirtual |
Read binary data from multiple regions in the file. Each part of the request specifies offset, size, and a delivery functor which will be invoked to pass back the returned bulk.
Arguments: parallel_ok: If true then the delivery functor might be called simultaneously from multiple worker threads. The function itself will block until all the data has been read or an error occurs. immutable_ok: If true the caller promises that the delivery functor will not try to modify the data buffer. Pass False e.g. if the functor may need to byteswap the data it has read from file. transient_ok: If true the caller promises that the delivery functor will not keep a reference to the data buffer after the functor returns.
The delivery functor is called as fn(void* data, std::int64_t size)
FUTURE: a new argument partial_ok may be set to True if it is ok to call the delivery functor with less data than requested, and to keep calling it until all data has been delivered. The signature of the delivery functor gets changed to fn(data, offset, size). Offset is the absolute file offset. I.e. not relative to the requested offset. Passing partial_ok=True might elide some buffer copies if the caller is doing something simple (such as reading an uncompressed brick) where partial copies are possible, and the backend is in the cloud, and a longer lived cache is being maintained, and the cache block size is smaller than the requested size. That is a lot of ifs. There was some code to handle partial_ok but it has been removed. Get it from the git history if you really want it.
Implements InternalZGY::FileADT.
|
overridevirtual |
Return true if multiple reads can be in progress at the same time.
Implements InternalZGY::FileADT.
|
overridevirtual |
Write binary data to the file. Offset is mandatory. I.e. caller is not allowed to "write to where I left off the last time". The actual writing will be done in a derived class. The base class only validates the arguments.
Implements InternalZGY::FileADT.
1.8.17