LCOV - code coverage report
Current view: top level - package/client/client_tcp - client_tcp_map.hpp (source / functions) Hit Total Coverage
Test: wfc_io-coverage.info Lines: 0 1 0.0 %
Date: 2019-09-05 Functions: 0 2 0.0 %

          Line data    Source code
       1             : //
       2             : // Author: Vladimir Migashko <migashko@gmail.com>, (C) 2013-2018
       3             : //
       4             : // Copyright: See COPYING file that comes with this distribution
       5             : //
       6             : 
       7             : #pragma once
       8             : 
       9             : #include "client_tcp_adapter.hpp"
      10             : #include "client_tcp_config.hpp"
      11             : #include <iow/io/io_id.hpp>
      12             : #include <wfc/iinterface.hpp>
      13             : #include <wfc/mutex.hpp>
      14             : #include <list>
      15             : #include <map>
      16             : 
      17             : namespace wfc{ namespace io{
      18             : 
      19             : 
      20           0 : class client_tcp_map
      21             :   : public iinterface
      22             : {
      23             :   class handler_wrapper;
      24             : public:
      25             :   typedef rwlock<std::mutex> mutex_type;
      26             :   typedef client_tcp_adapter client_type;
      27             :   typedef std::shared_ptr<client_type> client_ptr;
      28             :   typedef std::weak_ptr<client_type> client_wptr;
      29             :   typedef client_type::io_service_type io_service_type;
      30             :   typedef client_tcp_config options_type;
      31             : 
      32             :   explicit client_tcp_map( io_service_type& io);
      33             : 
      34             :   void reconfigure(const options_type& opt);
      35             : 
      36             :   void stop();
      37             : 
      38             :   client_ptr find( io_id_t id ) const;
      39             : 
      40             :   client_ptr upsert( io_id_t id);
      41             : 
      42             :   client_ptr create();
      43             :   void free(client_ptr cli);
      44             : 
      45             :   // iinterface
      46             :   virtual void reg_io( io_id_t id, std::weak_ptr< ::wfc::iinterface > src) override;
      47             : 
      48             :   virtual void unreg_io( io_id_t id) override;
      49             : 
      50             :   virtual void perform_io( iinterface::data_ptr d, io_id_t id, output_handler_t handler) override;
      51             : 
      52             : private:
      53             : 
      54             :   client_ptr find_( io_id_t id ) const;
      55             : 
      56             :   client_ptr create_();
      57             : 
      58             :   void stop_all_clients();
      59             : 
      60             : private:
      61             :   typedef std::map< io_id_t, client_ptr> client_map_t;
      62             :   typedef std::list<client_ptr> client_list_t;
      63             :   io_service_type& _io;
      64             :   options_type _opt;
      65             :   client_map_t _clients;
      66             :   mutable mutex_type _mutex;
      67             :   client_list_t _startup_pool;
      68             :   client_list_t _primary_pool;
      69             :   client_list_t _secondary_pool;
      70             :   bool _startup_flag = true;
      71             :   bool _stop_flag = false;
      72             : 
      73             : };
      74             : 
      75             : }}

Generated by: LCOV version 1.10