24 #include <machine/endian.h>
35 dabc::FileOutput(url,
".lmd"),
48 DOUT0(
" mbs::LmdOutput::DTOR");
56 return StartNewFile();
65 if (!fFile.OpenWriting(CurrentFileName().c_str(), fUrlOptions.c_str())) {
66 ShowInfo(-1,
dabc::format(
"%s cannot open file for writing", CurrentFileName().c_str()));
70 ShowInfo(0,
dabc::format(
"Open %s for writing", CurrentFileName().c_str()));
77 DOUT0(
" mbs::LmdOutput::CloseFile()");
78 if (fFile.isWriting()) {
79 ShowInfo(0,
dabc::format(
"Close file %s", CurrentFileName().c_str()));
95 ShowInfo(-1,
dabc::format(
"Buffer must contain mbs event(s) 10-1, but has type %u", buf.
GetTypeId()));
100 ShowInfo(-1,
"Segmented buffer not (yet) supported");
105 if (!StartNewFile()) {
106 EOUT(
"Cannot start new file for writing");
114 EOUT(
"lmd write error");
void SetIO(FileInterface *_io, bool _ioowner=false)
Reference on memory from memory pool.
unsigned NumSegments() const
Returns number of segment in buffer.
unsigned SegmentSize(unsigned n=0) const
Returns size on the segment, no any boundary checks.
unsigned GetTypeId() const
BufferSize_t GetTotalSize() const
Return total size of all buffer segments.
void * SegmentPtr(unsigned n=0) const
Returns pointer on the segment, no any boundary checks.
Defines and implements basic POSIX file interface.
virtual bool Write_Init()
This is generic virtual method to initialize output before real work is started.
bool null() const
Returns true if reference contains nullptr.
Uniform Resource Locator interpreter.
bool HasOption(const std::string &optname) const
std::string GetOptions() const
virtual bool Write_Init()
This is generic virtual method to initialize output before real work is started.
LmdOutput(const dabc::Url &url)
virtual unsigned Write_Buffer(dabc::Buffer &buf)
Start writing of buffer to output.
static unsigned NumEvents(const dabc::Buffer &buf)
std::string format(const char *fmt,...)