LCOV - code coverage report
Current view: top level - media/client/ipc/include - IpcClient.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2025-02-18 13:13:53 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :  * If not stated otherwise in this file or this component's LICENSE file the
       3              :  * following copyright and licenses apply:
       4              :  *
       5              :  * Copyright 2023 Sky UK
       6              :  *
       7              :  * Licensed under the Apache License, Version 2.0 (the "License");
       8              :  * you may not use this file except in compliance with the License.
       9              :  * You may obtain a copy of the License at
      10              :  *
      11              :  * http://www.apache.org/licenses/LICENSE-2.0
      12              :  *
      13              :  * Unless required by applicable law or agreed to in writing, software
      14              :  * distributed under the License is distributed on an "AS IS" BASIS,
      15              :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      16              :  * See the License for the specific language governing permissions and
      17              :  * limitations under the License.
      18              :  */
      19              : 
      20              : #ifndef FIREBOLT_RIALTO_CLIENT_IPC_CLIENT_H_
      21              : #define FIREBOLT_RIALTO_CLIENT_IPC_CLIENT_H_
      22              : 
      23              : #include "IIpcClient.h"
      24              : #include <atomic>
      25              : #include <memory>
      26              : 
      27              : namespace firebolt::rialto::client
      28              : {
      29              : class IpcClientAccessor : public IIpcClientAccessor
      30              : {
      31              : public:
      32            1 :     ~IpcClientAccessor() override = default;
      33              :     IIpcClient &getIpcClient() const override;
      34              : };
      35              : 
      36              : /**
      37              :  * @brief The definition of the IpcClient.
      38              :  */
      39              : class IpcClient : public IIpcClient
      40              : {
      41              : public:
      42              :     /**
      43              :      * @brief The constructor.
      44              :      */
      45              :     IpcClient(const std::shared_ptr<ipc::IChannelFactory> &ipcChannelFactory,
      46              :               const std::shared_ptr<ipc::IControllerFactory> &ipcControllerFactory,
      47              :               const std::shared_ptr<ipc::IBlockingClosureFactory> &blockingClosureFactory);
      48              : 
      49              :     /**
      50              :      * @brief Virtual destructor.
      51              :      */
      52              :     ~IpcClient() override;
      53              : 
      54              :     std::weak_ptr<ipc::IChannel> getChannel() const override;
      55              : 
      56              :     std::shared_ptr<ipc::IBlockingClosure> createBlockingClosure() override;
      57              : 
      58              :     std::shared_ptr<google::protobuf::RpcController> createRpcController() override;
      59              : 
      60              :     bool reconnect() override;
      61              : 
      62              :     void registerConnectionObserver(const std::weak_ptr<IConnectionObserver> &observer) override;
      63              : 
      64              : protected:
      65              :     /**
      66              :      * @brief The ipc thread.
      67              :      */
      68              :     std::thread m_ipcThread;
      69              : 
      70              :     /**
      71              :      * @brief The connected ipc communication channel.
      72              :      */
      73              :     std::shared_ptr<ipc::IChannel> m_ipcChannel;
      74              : 
      75              :     /**
      76              :      * @brief Factory for creating the ipc controllers.
      77              :      */
      78              :     std::shared_ptr<ipc::IControllerFactory> m_ipcControllerFactory;
      79              : 
      80              :     /**
      81              :      * @brief Factory for creating a connected ipc channel.
      82              :      */
      83              :     std::shared_ptr<ipc::IChannelFactory> m_ipcChannelFactory;
      84              : 
      85              :     /**
      86              :      * @brief Factory for creating a blocking closure.
      87              :      */
      88              :     std::shared_ptr<ipc::IBlockingClosureFactory> m_blockingClosureFactory;
      89              : 
      90              :     /**
      91              :      * @brief Whether disconnection of ipc has been requested by the client and is ongoing.
      92              :      */
      93              :     std::atomic<bool> m_disconnecting;
      94              : 
      95              :     /**
      96              :      * @brief Current connection status observer
      97              :      */
      98              :     std::weak_ptr<IConnectionObserver> m_connectionObserver;
      99              : 
     100              :     /**
     101              :      * @brief The processing loop for the ipc thread.
     102              :      */
     103              :     void processIpcThread();
     104              : 
     105              :     /**
     106              :      * @brief Establish connection between Rialto Server and Rialto Client
     107              :      */
     108              :     bool connect();
     109              : 
     110              :     /**
     111              :      * @brief Close connection between Rialto Server and Rialto Client
     112              :      */
     113              :     bool disconnect();
     114              : };
     115              : } // namespace firebolt::rialto::client
     116              : 
     117              : #endif // FIREBOLT_RIALTO_CLIENT_IPC_CLIENT_H_
        

Generated by: LCOV version 2.0-1