LCOV - code coverage report
Current view: top level - co - deltaMasterCM.cpp (source / functions) Hit Total Coverage
Test: Collage Lines: 22 23 95.7 %
Date: 2018-01-09 16:37:03 Functions: 6 6 100.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2007-2012, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *                    2010, Cedric Stalder <cedric.stalder@gmail.com>
       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 "deltaMasterCM.h"
      22             : 
      23             : #include "log.h"
      24             : #include "node.h"
      25             : #include "object.h"
      26             : #include "objectDataIStream.h"
      27             : 
      28             : namespace co
      29             : {
      30           7 : DeltaMasterCM::DeltaMasterCM(Object* object)
      31             :     : FullMasterCM(object)
      32             : #pragma warning(push)
      33             : #pragma warning(disable : 4355)
      34           7 :     , _deltaData(this)
      35             : #pragma warning(pop)
      36             : {
      37           7 : }
      38             : 
      39          14 : DeltaMasterCM::~DeltaMasterCM()
      40             : {
      41          14 : }
      42             : 
      43         104 : void DeltaMasterCM::_commit()
      44             : {
      45         104 :     if (!_slaves->empty())
      46             :     {
      47         104 :         _deltaData.reset();
      48         104 :         _deltaData.enableCommit(_version + 1, *_slaves);
      49         104 :         _object->pack(_deltaData);
      50         104 :         _deltaData.disable();
      51             :     }
      52             : 
      53         104 :     if (_slaves->empty() || _deltaData.hasSentData())
      54             :     {
      55             :         // save instance data
      56         104 :         InstanceData* instanceData = _newInstanceData();
      57             : 
      58         104 :         instanceData->os.enableCommit(_version + 1, Nodes());
      59         104 :         _object->getInstanceData(instanceData->os);
      60         104 :         instanceData->os.disable();
      61             : 
      62         104 :         if (_deltaData.hasSentData() || instanceData->os.hasSentData())
      63             :         {
      64         104 :             ++_version;
      65         104 :             LBASSERT(_version != VERSION_NONE);
      66             : 
      67         104 :             _addInstanceData(instanceData);
      68             :         }
      69             :         else
      70           0 :             _releaseInstanceData(instanceData);
      71             : 
      72             : #if 0
      73             :         LBLOG( LOG_OBJECTS ) << "Committed v" << _version << " " << *_object
      74             :                              << std::endl;
      75             : #endif
      76             :     }
      77         104 : }
      78          63 : }

Generated by: LCOV version 1.11