CDataSink

Name

CDataSink -- Abstract base class for data sinks.

Synopsis


    #include <CDataSink.h>
       CDataSink {
      
  virtual =0 void putItem(const CRingItem& item);
        virtual =0 void put(const void* pData, size_t nBytes);
  
};    
   

DESCRIPTION

Abstract base class for data sinks. Data sinks are objects to which data (usually ring items) can be sent.

By deriving concrete data types from CDataSink, and using the CDataSinkFactory to create sinks based on a URI description of the sink, a program can be written that produces data for a sink without having any knoweldge of the details of the sink. This allows those programs to function equally well regardless of the sink for which they are producing data.

The base class is abstract. See METHODS below for a desription of the methods a data sink must provide and the expectations for each method.

METHODS

virtual =0 void putItem(const CRingItem& item);

Concrete implementations are supposed to provide strategy code that writes an entire ring item to the sink. item is a reference to the item to write. All errors should be reported by throwing a CErrnoException with the errno global set to a value that describes the error.

virtual =0 void put(const void* pData, size_t nBytes);

Concrete implementations are supposed to provide stratey code that writes an arbitrary chunk of data to the sink. pData points at the data to write and nBytes is the number of bytes to write starting at pData

Errors should be reported by throwing a CErrnoException with the global errno set to a value that describes the error.