LCOV - code coverage report
Current view: top level - vset/buffer/persistent/file - ad_write_file.hpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 4 5 80.0 %
Date: 2019-09-12 Functions: 3 3 100.0 %

          Line data    Source code
       1             : //
       2             : // Author: Vladimir Migashko <migashko@gmail.com>, (C) 2012
       3             : //
       4             : // Copyright: See COPYING file that comes with this distribution
       5             : //
       6             : 
       7             : #ifndef VSET_VSET_BUFFER_PERSISTENT_FILE_AD_WRITE_FILE_HPP
       8             : #define VSET_VSET_BUFFER_PERSISTENT_FILE_AD_WRITE_FILE_HPP
       9             : 
      10             : #include <vset/buffer/tags.hpp>
      11             : #include <vset/buffer/persistent/tags.hpp>
      12             : 
      13             : #include <unistd.h>
      14             : #include <iostream>
      15             : #include <stdlib.h>
      16             : #include <stdexcept>
      17             : #include <errno.h>
      18             : 
      19             : namespace vset { namespace buffer { namespace persistent{ namespace file{
      20             : 
      21          12 : struct ad_write_file
      22             : {
      23             :   template<typename T>
      24           8 :   void operator()( T& t, const char* data, size_t size, size_t offset )
      25             :   {
      26           8 :     if ( -1 == ::pwrite( t.get_aspect().template get<_descriptor_>(), data, size, static_cast<off_t>(offset) ) )
      27             :     {
      28           0 :       throw std::runtime_error(strerror(errno));
      29             :     }
      30           8 :   }
      31             : };
      32             : 
      33             : }}}}
      34             : 
      35             : #endif

Generated by: LCOV version 1.10