Collage  1.2.1
High-performance C++ library for developing object-oriented distributed applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
buffer.h
1 
2 /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
3  * 2012-2014, Stefan.Eilemann@epfl.ch
4  *
5  * This file is part of Collage <https://github.com/Eyescale/Collage>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 2.1 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef CO_BUFFER_H
22 #define CO_BUFFER_H
23 
24 #include <co/api.h>
25 #include <co/types.h>
26 
27 #include <lunchbox/buffer.h> // base class
28 #include <lunchbox/referenced.h> // base class
29 #include <lunchbox/thread.h> // LB_TS_VAR macro
30 
31 
32 namespace co
33 {
34 namespace detail { class Buffer; }
35 
44 class Buffer : public lunchbox::Bufferb, public lunchbox::Referenced
45 {
46 public:
48  CO_API explicit Buffer( BufferListener* listener = 0 );
49 
51  CO_API virtual ~Buffer();
52 
54  CO_API bool isFree() const;
55 
56  void setUsed();
57 
58 private:
59  detail::Buffer* const _impl;
60  LB_TS_VAR( _writeThread );
61 
62  void notifyFree() override;
63 };
64 
65 std::ostream& operator << ( std::ostream&, const Buffer& );
66 }
67 
68 #endif //CO_BUFFER_H
Defines export visibility macros for library Collage.
virtual CO_API ~Buffer()
Destruct this buffer.
A receive buffer for a Connection.
Definition: buffer.h:44
CO_API Buffer(BufferListener *listener=0)
Construct a new buffer.
CO_API bool isFree() const
A listener interface to buffer state changes.