LCOV - code coverage report
Current view: top level - co - eventConnection.h (source / functions) Hit Total Coverage
Test: Collage Lines: 1 7 14.3 %
Date: 2016-12-14 01:26:48 Functions: 1 4 25.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2010-2014, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *
       4             :  * This file is part of Collage <https://github.com/Eyescale/Collage>
       5             :  *
       6             :  * This library is free software; you can redistribute it and/or modify it under
       7             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       8             :  * by the Free Software Foundation.
       9             :  *
      10             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      11             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      12             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      13             :  * details.
      14             :  *
      15             :  * You should have received a copy of the GNU Lesser General Public License
      16             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      17             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             :  */
      19             : 
      20             : #ifndef CO_EVENT_CONNECTION_H
      21             : #define CO_EVENT_CONNECTION_H
      22             : 
      23             : #include <co/connection.h>   // base class
      24             : 
      25             : #include "buffer.h"
      26             : #include "pipeConnection.h"
      27             : 
      28             : #include <lunchbox/lock.h>
      29             : 
      30             : namespace co
      31             : {
      32             :     /**
      33             :      * A connection signalling an event.
      34             :      *
      35             :      * The connection is only useful to signal something to a ConnectionSet. No
      36             :      * data can be read or written from it.
      37             :      */
      38             :     class EventConnection : public Connection
      39             :     {
      40             :     public:
      41             :         CO_API EventConnection();
      42             :         CO_API virtual ~EventConnection();
      43             : 
      44             :         CO_API bool connect() override;
      45          54 :         CO_API void close() override { _close(); }
      46             : 
      47             :         CO_API void set();
      48             :         CO_API void reset();
      49             : 
      50             :         CO_API Notifier getNotifier() const override;
      51             : 
      52             :     protected:
      53           0 :         void readNB( void*, const uint64_t ) override
      54           0 :             { LBDONTCALL; }
      55           0 :         int64_t readSync( void*, const uint64_t, const bool ) override
      56           0 :             { LBDONTCALL; return -1; }
      57           0 :         CO_API int64_t write( const void*, const uint64_t ) override
      58           0 :             { LBDONTCALL; return -1; }
      59             : 
      60             :     private:
      61             : #ifdef _WIN32
      62             :         void* _event;
      63             : #else
      64             :         PipeConnectionPtr _connection;
      65             :         lunchbox::Lock _lock;
      66             :         bool _set;
      67             : #endif
      68             : 
      69             :         Buffer _buffer;
      70             : 
      71             :         void _close();
      72             :     };
      73             : }
      74             : 
      75             : #endif //CO_EVENT_CONNECTION_H

Generated by: LCOV version 1.11