LCOV - code coverage report
Current view: top level - co - buffer.h (source / functions) Hit Total Coverage
Test: Collage Lines: 1 1 100.0 %
Date: 2018-01-09 16:37:03 Functions: 2 2 100.0 %

          Line data    Source code
       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             : namespace co
      32             : {
      33             : namespace detail
      34             : {
      35             : class Buffer;
      36             : }
      37             : 
      38             : /**
      39             :  * A receive buffer for a Connection.
      40             :  *
      41             :  * The buffer does not auto-delete, that is, a BufferPtr is not a smart
      42             :  * pointer. Instead, the BufferListener interface notifies when a buffer is
      43             :  * reusable. The BufferCache uses this to recycle unreferenced buffers, i.e.,
      44             :  * unused by any ICommand.
      45             :  */
      46             : class Buffer : public lunchbox::Bufferb, public lunchbox::Referenced
      47             : {
      48             : public:
      49             :     /** Construct a new buffer. @version 1.0 */
      50             :     CO_API explicit Buffer(BufferListener* listener = 0);
      51             : 
      52             :     /** Destruct this buffer. @version 1.0 */
      53             :     CO_API virtual ~Buffer();
      54             : 
      55             :     /** @return true if the buffer is no longer in use. @version 1.0 */
      56             :     CO_API bool isFree() const;
      57             : 
      58             :     void setUsed(); //!< @internal
      59             : 
      60             : private:
      61             :     detail::Buffer* const _impl;
      62        1426 :     LB_TS_VAR(_writeThread);
      63             : 
      64             :     void notifyFree() override;
      65             : };
      66             : 
      67             : std::ostream& operator<<(std::ostream&, const Buffer&);
      68             : }
      69             : 
      70             : #endif // CO_BUFFER_H

Generated by: LCOV version 1.11