LCOV - code coverage report
Current view: top level - co - objectICommand.cpp (source / functions) Hit Total Coverage
Test: Collage Lines: 32 38 84.2 %
Date: 2016-12-14 01:26:48 Functions: 11 13 84.6 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2012-2015, Daniel Nachbaur <danielnachbaur@gmail.com>
       3             :  *                          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 "objectICommand.h"
      22             : 
      23             : #include "buffer.h"
      24             : 
      25             : 
      26             : namespace co
      27             : {
      28             : namespace detail
      29             : {
      30             : 
      31             : class ObjectICommand
      32             : {
      33             : public:
      34      396082 :     ObjectICommand()
      35      396082 :         : instanceID( CO_INSTANCE_INVALID )
      36      396082 :     {}
      37             : 
      38         156 :     ObjectICommand( const ObjectICommand& rhs )
      39         156 :         : objectID( rhs.objectID )
      40         156 :         , instanceID( rhs.instanceID )
      41         156 :     {}
      42             : 
      43             :     uint128_t objectID;
      44             :     uint32_t instanceID;
      45             : };
      46             : }
      47             : 
      48           4 : ObjectICommand::ObjectICommand( LocalNodePtr local, NodePtr remote,
      49           4 :                                 ConstBufferPtr buffer, const bool swap_ )
      50             :     : ICommand( local, remote, buffer, swap_ )
      51           4 :     , _impl( new detail::ObjectICommand )
      52             : {
      53           4 :     _init();
      54           4 : }
      55             : 
      56      396078 : ObjectICommand::ObjectICommand( const ICommand& command )
      57             :     : ICommand( command )
      58      396078 :     , _impl( new detail::ObjectICommand )
      59             : {
      60      396078 :     _init();
      61      396078 : }
      62             : 
      63         156 : ObjectICommand::ObjectICommand( const ObjectICommand& rhs )
      64             :     : ICommand( rhs )
      65         156 :     , _impl( new detail::ObjectICommand( *rhs._impl ))
      66             : {
      67         156 :     _init();
      68         156 : }
      69             : 
      70      396238 : void ObjectICommand::_init()
      71             : {
      72      396238 :     if( isValid( ))
      73      396237 :         *this >> _impl->objectID >> _impl->instanceID;
      74      396238 : }
      75             : 
      76      792476 : ObjectICommand::~ObjectICommand()
      77             : {
      78      396238 :     delete _impl;
      79      396238 : }
      80             : 
      81         612 : const uint128_t& ObjectICommand::getObjectID() const
      82             : {
      83         612 :     return _impl->objectID;
      84             : }
      85             : 
      86         612 : uint32_t ObjectICommand::getInstanceID() const
      87             : {
      88         612 :     return _impl->instanceID;
      89             : }
      90             : 
      91           0 : std::ostream& operator << ( std::ostream& os, const ObjectICommand& command )
      92             : {
      93           0 :     os << static_cast< const ICommand& >( command );
      94           0 :     if( command.isValid( ))
      95             :     {
      96           0 :         os << " object " << command.getObjectID()
      97           0 :            << "." << command.getInstanceID();
      98             :     }
      99           0 :     return os;
     100             : }
     101             : 
     102          66 : }

Generated by: LCOV version 1.11