LCOV - code coverage report
Current view: top level - co - objectDataICommand.cpp (source / functions) Hit Total Coverage
Test: Collage Lines: 36 42 85.7 %
Date: 2015-11-03 13:48:53 Functions: 14 16 87.5 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
       3             :  *               2012-2013, 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             : #include "objectDataICommand.h"
      22             : 
      23             : #include "buffer.h"
      24             : #include <pression/plugins/compressorTypes.h>
      25             : 
      26             : namespace co
      27             : {
      28             : namespace detail
      29             : {
      30             : 
      31             : class ObjectDataICommand
      32             : {
      33             : public:
      34      325711 :     ObjectDataICommand()
      35             :         : version( 0, 0 )
      36             :         , datasize( 0 )
      37             :         , sequence( 0 )
      38             :         , compressor( EQ_COMPRESSOR_NONE )
      39             :         , chunks( 1 )
      40      325711 :         , isLast( false )
      41      325711 :     {}
      42             : 
      43             :     uint128_t version;
      44             :     uint64_t datasize;
      45             :     uint32_t sequence;
      46             :     uint32_t compressor;
      47             :     uint32_t chunks;
      48             :     bool isLast;
      49             : };
      50             : 
      51             : }
      52             : 
      53      325708 : ObjectDataICommand::ObjectDataICommand( const ICommand& command )
      54             :     : ObjectICommand( command )
      55      325708 :     , _impl( new detail::ObjectDataICommand )
      56             : {
      57      325708 :     _init();
      58      325708 : }
      59             : 
      60           3 : ObjectDataICommand::ObjectDataICommand( LocalNodePtr local, NodePtr remote,
      61             :                                       ConstBufferPtr buffer, const bool swap_ )
      62             :     : ObjectICommand( local, remote, buffer, swap_ )
      63           3 :     , _impl( new detail::ObjectDataICommand )
      64             : {
      65           3 :     _init();
      66           3 : }
      67             : 
      68             : 
      69         153 : ObjectDataICommand::ObjectDataICommand( const ObjectDataICommand& rhs )
      70             :     : ObjectICommand( rhs )
      71         153 :     , _impl( new detail::ObjectDataICommand( *rhs._impl ))
      72             : {
      73         153 :     _init();
      74         153 : }
      75             : 
      76      325864 : void ObjectDataICommand::_init()
      77             : {
      78      325864 :     if( isValid( ))
      79      325864 :         *this >> _impl->version >> _impl->datasize >> _impl->sequence
      80      651728 :               >> _impl->isLast >> _impl->compressor >> _impl->chunks;
      81      325864 : }
      82             : 
      83      651728 : ObjectDataICommand::~ObjectDataICommand()
      84             : {
      85      325864 :     delete _impl;
      86      325864 : }
      87             : 
      88      325548 : uint128_t ObjectDataICommand::getVersion() const
      89             : {
      90      325548 :     return _impl->version;
      91             : }
      92             : 
      93      162752 : uint32_t ObjectDataICommand::getSequence() const
      94             : {
      95      162752 :     return _impl->sequence;
      96             : }
      97             : 
      98         166 : uint64_t ObjectDataICommand::getDataSize() const
      99             : {
     100         166 :     return _impl->datasize;
     101             : }
     102             : 
     103         162 : uint32_t ObjectDataICommand::getCompressor() const
     104             : {
     105         162 :     return _impl->compressor;
     106             : }
     107             : 
     108         162 : uint32_t ObjectDataICommand::getChunks() const
     109             : {
     110         162 :     return _impl->chunks;
     111             : }
     112             : 
     113      162745 : bool ObjectDataICommand::isLast() const
     114             : {
     115      162745 :     return _impl->isLast;
     116             : }
     117             : 
     118           0 : std::ostream& operator << ( std::ostream& os, const ObjectDataICommand& command )
     119             : {
     120           0 :     os << static_cast< const ObjectICommand& >( command );
     121           0 :     if( command.isValid( ))
     122             :     {
     123           0 :         os << " v" << command.getVersion() << " size " << command.getDataSize()
     124           0 :            << " seq " << command.getSequence() << " last " << command.isLast();
     125             :     }
     126           0 :     return os;
     127             : }
     128             : 
     129          63 : }

Generated by: LCOV version 1.11