LCOV - code coverage report
Current view: top level - co - deltaMasterCM.cpp (source / functions) Hit Total Coverage
Test: Collage Lines: 22 23 95.7 %
Date: 2016-12-14 01:26:48 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             : 
      31           7 : DeltaMasterCM::DeltaMasterCM( Object* object )
      32             :         : FullMasterCM( object )
      33             : #pragma warning(push)
      34             : #pragma warning(disable : 4355)
      35           7 :         , _deltaData( this )
      36             : #pragma warning(pop)
      37           7 : {}
      38             : 
      39          14 : DeltaMasterCM::~DeltaMasterCM()
      40          14 : {}
      41             : 
      42         104 : void DeltaMasterCM::_commit()
      43             : {
      44         104 :     if( !_slaves->empty( ))
      45             :     {
      46         104 :         _deltaData.reset();
      47         104 :         _deltaData.enableCommit( _version + 1, *_slaves );
      48         104 :         _object->pack( _deltaData );
      49         104 :         _deltaData.disable();
      50             :     }
      51             : 
      52         104 :     if( _slaves->empty() || _deltaData.hasSentData( ))
      53             :     {
      54             :         // save instance data
      55         104 :         InstanceData* instanceData = _newInstanceData();
      56             : 
      57         104 :         instanceData->os.enableCommit( _version + 1, Nodes( ));
      58         104 :         _object->getInstanceData( instanceData->os );
      59         104 :         instanceData->os.disable();
      60             : 
      61         104 :         if( _deltaData.hasSentData() || instanceData->os.hasSentData( ))
      62             :         {
      63         104 :             ++_version;
      64         104 :             LBASSERT( _version != VERSION_NONE );
      65             : 
      66         104 :             _addInstanceData( instanceData );
      67             :         }
      68             :         else
      69           0 :             _releaseInstanceData( instanceData );
      70             : 
      71             : #if 0
      72             :         LBLOG( LOG_OBJECTS ) << "Committed v" << _version << " " << *_object
      73             :                              << std::endl;
      74             : #endif
      75             :     }
      76         104 : }
      77             : 
      78          66 : }

Generated by: LCOV version 1.11