DATRW++ library: seismic data I/O with multiple formats
|
The base class datrw::odatstream takes care of many organizational issues for you. You are only responsible to provide code which is capable to actually write the data to a file stream. I will use datrw::osffstream as an example.
You have to provide at least a derived stream class like datrw::osffstream, which has to be equipped with:
That's all.
Finally check files writeany.h, writeany.cc, formats.h, and formats.cc and add appropriate lines to make the new stream visible through the generic interface of datrw::oanystream and the functions presented in writeany.h.
The C++ ostream to which data should be written is available through the protected member data field datrw::odatstream::Mos by inheritance. The inherited function datrw::odatstream::hassrce() indicates whether SRCE data is available and can be retrieved through the inherited function datrw::odatstream::srce(). The inherited function datrw::odatstream::hasfree() indicates whether FREE data is available and can be retrieved through the inherited function datrw::odatstream::free().
This set of functions is responsible to actually write a trace to the C++ output stream which is available through the protected member data field datrw::odatstream::Mos by inheritance. Appropriate sample type conversion has do be done, if necessary. The base class datrw::odatstream ensures that WID2 data is available before one of these functions is called. You can check whether additionally INFO or FREE data is available for the trace, by calling the inherited functions datrw::odatstream::hasinfo() or datrw::odatstream::hasfree(), respectively. The INFO and FREE data is available through the inherited functions datrw::odatstream::info() and datrw::odatstream::free().