Collage
0.6.1
|
00001 00002 /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com> 00003 * 2012, Stefan.Eilemann@epfl.ch 00004 * 00005 * This library is free software; you can redistribute it and/or modify it under 00006 * the terms of the GNU Lesser General Public License version 2.1 as published 00007 * by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, but WITHOUT 00010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00012 * details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public License 00015 * along with this library; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00017 */ 00018 00019 #ifndef CO_BUFFER_H 00020 #define CO_BUFFER_H 00021 00022 #include <lunchbox/buffer.h> // base class 00023 #include <lunchbox/referenced.h> // base class 00024 00025 #include <co/api.h> 00026 #include <co/types.h> 00027 #include <co/dispatcher.h> // for Dispatcher::Func 00028 00029 00030 namespace co 00031 { 00032 namespace detail { class Buffer; } 00033 00041 class Buffer : public lunchbox::Bufferb, public lunchbox::Referenced 00042 { 00043 public: 00044 CO_API Buffer( BufferListener* listener = 0 ); 00045 CO_API virtual ~Buffer(); 00046 00048 bool isFree() const { return getRefCount() == 0; } 00049 00050 CO_API static size_t getMinSize(); 00051 CO_API static size_t getCacheSize(); 00052 00053 private: 00054 detail::Buffer* const _impl; 00055 LB_TS_VAR( _writeThread ); 00056 00057 virtual void deleteReferenced( const Referenced* object ) const; 00058 }; 00059 00060 std::ostream& operator << ( std::ostream&, const Buffer& ); 00061 } 00062 00063 #endif //CO_BUFFER_H