LCOV - code coverage report
Current view: top level - vset/vtree/aspect - ad_update_node_key.hpp (source / functions) Hit Total Coverage
Test: v-set-coverage.info Lines: 12 12 100.0 %
Date: 2019-09-12 Functions: 13 14 92.9 %

          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_VTREE_ASPECT_AD_UPDATE_NODE_KEY_HPP
       8             : #define VSET_VTREE_ASPECT_AD_UPDATE_NODE_KEY_HPP
       9             : 
      10             : #include <vset/vtree/aspect/tags.hpp>
      11             : #include <string.h>
      12             : #include <stdlib.h>
      13             : 
      14             : namespace vset{ namespace vtree{
      15             : 
      16          29 : struct ad_update_node_key
      17             : {
      18             :   template<typename T, typename Iterator>
      19       38230 :   Iterator operator()(T& t, Iterator itr )
      20             :   {
      21             :     typedef Iterator iterator;
      22             :     typedef typename T::key_type key_type;
      23             :     typedef typename iterator::value_type::second_type array_pointer;
      24             :     typedef typename T::aspect::template advice_cast<_key_compare_>::type compare_type;
      25       38230 :     compare_type& compare = t.get_aspect().template get<_key_compare_>();
      26       38230 :     array_pointer arr = itr->second;
      27             :     
      28       88482 :     if ( !(!compare(arr->front(), itr->first.first)    && !compare(itr->first.first, arr->front()) )
      29       39225 :          || !(!compare(arr->back(),  itr->first.second)   && !compare(itr->first.second, arr->back()) )
      30             :        )
      31             :     {
      32       26193 :       t.get_container().erase(itr);
      33             :       
      34       26193 :       const typename T::aspect::template advice_cast<_get_key_>::type& get_key = t.get_aspect().template get<_get_key_>();
      35       26193 :       const key_type& k1f = get_key(t, arr->front());
      36       26193 :       const key_type& k1b = get_key(t, arr->back());
      37             : 
      38       26193 :       itr = t.get_aspect().template get<_insert_to_container_>()(t, std::make_pair( /*arr->front(), arr->back()*/k1f, k1b ), arr );
      39             :     }
      40             : 
      41       38230 :     return itr;
      42             :   }
      43             : };
      44             : 
      45             : }}
      46             : 
      47             : #endif

Generated by: LCOV version 1.10