LCOV - code coverage report
Current view: top level - co - objectICommand.cpp (source / functions) Hit Total Coverage
Test: Collage Lines: 30 36 83.3 %
Date: 2015-11-03 13:48:53 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      326655 :     ObjectICommand()
      35      326655 :         : instanceID( CO_INSTANCE_INVALID )
      36      326655 :     {}
      37             : 
      38         157 :     ObjectICommand( const ObjectICommand& rhs )
      39             :         : objectID( rhs.objectID )
      40         157 :         , instanceID( rhs.instanceID )
      41         157 :     {}
      42             : 
      43             :     uint128_t objectID;
      44             :     uint32_t instanceID;
      45             : };
      46             : }
      47             : 
      48           4 : ObjectICommand::ObjectICommand( LocalNodePtr local, NodePtr remote,
      49             :                                 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      326651 : ObjectICommand::ObjectICommand( const ICommand& command )
      57             :     : ICommand( command )
      58      326651 :     , _impl( new detail::ObjectICommand )
      59             : {
      60      326651 :     _init();
      61      326651 : }
      62             : 
      63         157 : ObjectICommand::ObjectICommand( const ObjectICommand& rhs )
      64             :     : ICommand( rhs )
      65         157 :     , _impl( new detail::ObjectICommand( *rhs._impl ))
      66             : {
      67         157 :     _init();
      68         157 : }
      69             : 
      70      326812 : void ObjectICommand::_init()
      71             : {
      72      326812 :     if( isValid( ))
      73      326811 :         *this >> _impl->objectID >> _impl->instanceID;
      74      326812 : }
      75             : 
      76      653624 : ObjectICommand::~ObjectICommand()
      77             : {
      78      326812 :     delete _impl;
      79      326812 : }
      80             : 
      81         609 : const uint128_t& ObjectICommand::getObjectID() const
      82             : {
      83         609 :     return _impl->objectID;
      84             : }
      85             : 
      86         610 : uint32_t ObjectICommand::getInstanceID() const
      87             : {
      88         610 :     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          63 : }

Generated by: LCOV version 1.11