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

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2011-2014, Stefan Eilemann <eile@eyescale.ch>
       3             :  *                    2011, Carsten Rohn <carsten.rohn@rtt.ag>
       4             :  *               2011-2012, Daniel Nachbaur <danielnachbaur@gmail.com>
       5             :  *
       6             :  * This file is part of Collage <https://github.com/Eyescale/Collage>
       7             :  *
       8             :  * This library is free software; you can redistribute it and/or modify it under
       9             :  * the terms of the GNU Lesser General Public License version 2.1 as published
      10             :  * by the Free Software Foundation.
      11             :  *
      12             :  * This library is distributed in the hope that it will be useful, but WITHOUT
      13             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      14             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      15             :  * details.
      16             :  *
      17             :  * You should have received a copy of the GNU Lesser General Public License
      18             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      19             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      20             :  */
      21             : 
      22             : #ifndef CO_QUEUEMASTER_H
      23             : #define CO_QUEUEMASTER_H
      24             : 
      25             : #include <co/object.h> // base class
      26             : #include <co/types.h>
      27             : 
      28             : namespace co
      29             : {
      30             : namespace detail
      31             : {
      32             : class QueueMaster;
      33             : }
      34             : 
      35             : /**
      36             :  * The producer end of a distributed queue.
      37             :  *
      38             :  * One instance of this class is registered with a LocalNode to for the producer
      39             :  * end of a distributed queue. One or more QueueSlave instances are mapped to
      40             :  * this master instance and consume the data.
      41             :  */
      42             : class QueueMaster : public Object
      43             : {
      44             : public:
      45             :     /** Construct a new queue master. @version 1.0 */
      46             :     CO_API QueueMaster();
      47             : 
      48             :     /** Destruct this queue master. @version 1.0 */
      49             :     virtual CO_API ~QueueMaster();
      50             : 
      51             :     /**
      52             :      * Enqueue a new queue item.
      53             :      *
      54             :      * The returned queue item can stream additional data using the DataOStream
      55             :      * operators. Note that the item is enqueued once it is destroyed, i.e. when
      56             :      * it runs out of scope.
      57             :      *
      58             :      * @return the item to enqueue.
      59             :      * @version 1.0
      60             :      */
      61             :     CO_API QueueItem push();
      62             : 
      63             :     /** Remove all enqueued items. @version 1.0 */
      64             :     CO_API void clear();
      65             : 
      66             : private:
      67             :     detail::QueueMaster* const _impl;
      68             : 
      69             :     CO_API void attach(const uint128_t& id, const uint32_t instanceID) override;
      70             : 
      71           2 :     ChangeType getChangeType() const override { return STATIC; }
      72             :     void getInstanceData(co::DataOStream& os) override;
      73           0 :     void applyInstanceData(co::DataIStream&) override { LBDONTCALL }
      74             :     friend class QueueItem;
      75             :     void _addItem(QueueItem& item);
      76             : };
      77             : 
      78             : } // co
      79             : 
      80             : #endif // CO_QUEUEMASTER_H

Generated by: LCOV version 1.11