data_sink.h (774B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef DATA_SINK_H 6 #define DATA_SINK_H 7 8 /** 9 * Abstract class for any type of implementation that accepts bytes from 10 * some kind of data source. 11 */ 12 class DataSink { 13 public: 14 /** 15 * Caller passes in a buffer with data and a count of bytes to read from 16 * that buffer. 17 * @param buf A buffer containing data 18 * @param numberOfBytes Number of bytes of usable data available in the buffer 19 * @return true if data was successfully accepted or false otherwise 20 */ 21 virtual bool accept(char* buf, int numberOfBytes) = 0; 22 virtual ~DataSink() {} 23 }; 24 25 #endif