CRingItemFileTransport

Name

CRingItem FileTransport -- Transport ring items to and from files.

Synopsis


#include <CRingItemFileTransport.h>

class CRingItemFileTransport : public CRingItemTransport
{
    
public:
    CRingItemFileTransport(CRingFileBlockReader& reader); 
    CRingItemFileTransport(io::CBufferedOutput& writer);  
    
    virtual void recv(void** ppData, size_t& size);
    virtual void send(iovec* parts, size_t numParts);
    virtual void end();
};


        

DESCRIPTION

This class is a transport that carries ring items to or from files. Once created, the transpor is only unidirectional and using the wrong data trasnfer operation results in a std::runtime_error exception.

METHODS

CRingItemFileTransport(CRingFileBlockReader& reader);

This constructor creates an object that can use recv to get ring items from a file. See CRingFileBlockReader(3daq) for information on how to create that object.

CRingItemFileTransport(io::CBufferedOutput& writer);

This constructor creates an object to put ring items into a file. writer is the object that does the I/O. See io::CBufferedOutput(3daq) for information about how to construct tis item.

virtual void recv(void** ppData, size_t& size);

Fetches the next ring item from the file. At end of file the ring item returned is of zero length.

virtual void send(iovec* parts, size_t numParts);

Outputs each part of the message to the ringbuffer. It's up to the caller to ensure that data put in the ring consists of properly formatted ring items...

virtual void end();

If the file is open for write, the buffered writer is flushed ensuring all items have been sent to file.