LCOV - code coverage report
Current view: top level - co - objectICommand.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 29 35 82.9 %
Date: 2014-10-06 Functions: 11 13 84.6 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.com>
       3             :  *               2012-2014, 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      336202 :     ObjectICommand()
      35      336202 :     {}
      36             : 
      37         157 :     ObjectICommand( const ObjectICommand& rhs )
      38             :         : objectID( rhs.objectID )
      39         157 :         , instanceID( rhs.instanceID )
      40         157 :     {}
      41             : 
      42             :     uint128_t objectID;
      43             :     uint32_t instanceID;
      44             : };
      45             : }
      46             : 
      47           4 : ObjectICommand::ObjectICommand( LocalNodePtr local, NodePtr remote,
      48             :                                 ConstBufferPtr buffer, const bool swap_ )
      49             :     : ICommand( local, remote, buffer, swap_ )
      50           4 :     , _impl( new detail::ObjectICommand )
      51             : {
      52           4 :     _init();
      53           4 : }
      54             : 
      55      336198 : ObjectICommand::ObjectICommand( const ICommand& command )
      56             :     : ICommand( command )
      57      336198 :     , _impl( new detail::ObjectICommand )
      58             : {
      59      336198 :     _init();
      60      336198 : }
      61             : 
      62         157 : ObjectICommand::ObjectICommand( const ObjectICommand& rhs )
      63             :     : ICommand( rhs )
      64         157 :     , _impl( new detail::ObjectICommand( *rhs._impl ))
      65             : {
      66         157 :     _init();
      67         157 : }
      68             : 
      69      336359 : void ObjectICommand::_init()
      70             : {
      71      336359 :     if( isValid( ))
      72      336361 :         *this >> _impl->objectID >> _impl->instanceID;
      73      336359 : }
      74             : 
      75      672720 : ObjectICommand::~ObjectICommand()
      76             : {
      77      336360 :     delete _impl;
      78      336359 : }
      79             : 
      80         609 : const uint128_t& ObjectICommand::getObjectID() const
      81             : {
      82         609 :     return _impl->objectID;
      83             : }
      84             : 
      85         610 : uint32_t ObjectICommand::getInstanceID() const
      86             : {
      87         610 :     return _impl->instanceID;
      88             : }
      89             : 
      90           0 : std::ostream& operator << ( std::ostream& os, const ObjectICommand& command )
      91             : {
      92           0 :     os << static_cast< const ICommand& >( command );
      93           0 :     if( command.isValid( ))
      94             :     {
      95           0 :         os << " object " << command.getObjectID()
      96           0 :            << "." << command.getInstanceID();
      97             :     }
      98           0 :     return os;
      99             : }
     100             : 
     101          60 : }

Generated by: LCOV version 1.10