Equalizer
1.2.1
|
00001 00002 /* Copyright (c) 2007-2011, Stefan Eilemann <eile@equalizergraphics.com> 00003 * 00004 * This library is free software; you can redistribute it and/or modify it under 00005 * the terms of the GNU Lesser General Public License version 2.1 as published 00006 * by the Free Software Foundation. 00007 * 00008 * This library is distributed in the hope that it will be useful, but WITHOUT 00009 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00010 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00011 * details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this library; if not, write to the Free Software Foundation, Inc., 00015 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00016 */ 00017 00018 #ifndef CO_BUFFER_CONNECTION_H 00019 #define CO_BUFFER_CONNECTION_H 00020 00021 #include <co/connection.h> // base class 00022 #include <co/base/buffer.h> // member 00023 00024 namespace co 00025 { 00029 class BufferConnection : public Connection 00030 { 00031 public: 00032 CO_API BufferConnection(); 00033 CO_API virtual ~BufferConnection(); 00034 00035 CO_API void sendBuffer( ConnectionPtr connection ); 00036 00037 uint64_t getSize() const { return _buffer.getSize(); } 00038 00039 protected: 00040 virtual void readNB( void*, const uint64_t ) 00041 { EQDONTCALL; } 00042 virtual int64_t readSync( void*, const uint64_t, const bool ) 00043 { EQDONTCALL; return -1; } 00044 CO_API virtual int64_t write( const void* buffer, 00045 const uint64_t bytes ); 00046 00047 virtual Notifier getNotifier() const { EQDONTCALL; return 0; } 00048 00049 private: 00050 mutable base::Bufferb _buffer; 00051 }; 00052 } 00053 00054 #endif //CO_BUFFER_CONNECTION_H