LCOV - code coverage report
Current view: top level - co - objectICommand.cpp (source / functions) Hit Total Coverage
Test: Collage Lines: 32 38 84.2 %
Date: 2018-01-09 16:37:03 Functions: 11 13 84.6 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2012-2017, 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             : namespace co
      26             : {
      27             : namespace detail
      28             : {
      29             : class ObjectICommand
      30             : {
      31             : public:
      32      372738 :     ObjectICommand()
      33      372738 :         : instanceID(CO_INSTANCE_INVALID)
      34             :     {
      35      372738 :     }
      36             : 
      37         156 :     ObjectICommand(const ObjectICommand& rhs)
      38         156 :         : objectID(rhs.objectID)
      39         156 :         , instanceID(rhs.instanceID)
      40             :     {
      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)
      50             :     : ICommand(local, remote, buffer)
      51           4 :     , _impl(new detail::ObjectICommand)
      52             : {
      53           4 :     _init();
      54           4 : }
      55             : 
      56      372733 : ObjectICommand::ObjectICommand(const ICommand& command)
      57             :     : ICommand(command)
      58      372733 :     , _impl(new detail::ObjectICommand)
      59             : {
      60      372734 :     _init();
      61      372734 : }
      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      372894 : void ObjectICommand::_init()
      71             : {
      72      372894 :     if (isValid())
      73      372893 :         *this >> _impl->objectID >> _impl->instanceID;
      74      372894 : }
      75             : 
      76      745788 : ObjectICommand::~ObjectICommand()
      77             : {
      78      372894 :     delete _impl;
      79      372894 : }
      80             : 
      81         600 : const uint128_t& ObjectICommand::getObjectID() const
      82             : {
      83         600 :     return _impl->objectID;
      84             : }
      85             : 
      86         600 : uint32_t ObjectICommand::getInstanceID() const
      87             : {
      88         600 :     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          63 : }

Generated by: LCOV version 1.11