LCOV - code coverage report
Current view: top level - wirestead - wirestead.hpp (source / functions) Coverage Total Hit
Test: Wirestead Coverage Report Lines: 100.0 % 11 11
Test Date: 2026-08-30 10:35:09 Functions: 100.0 % 6 6
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /*
       2                 :             :  * Copyright 2025 Jinwoo Sung
       3                 :             :  *
       4                 :             :  * Licensed under the Apache License, Version 2.0 (the "License");
       5                 :             :  * you may not use this file except in compliance with the License.
       6                 :             :  * You may obtain a copy of the License at
       7                 :             :  *
       8                 :             :  *     http://www.apache.org/licenses/LICENSE-2.0
       9                 :             :  *
      10                 :             :  * Unless required by applicable law or agreed to in writing, software
      11                 :             :  * distributed under the License is distributed on an "AS IS" BASIS,
      12                 :             :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13                 :             :  * See the License for the specific language governing permissions and
      14                 :             :  * limitations under the License.
      15                 :             :  */
      16                 :             : 
      17                 :             : #pragma once
      18                 :             : 
      19                 :             : #include <memory>
      20                 :             : #include <variant>
      21                 :             : 
      22                 :             : #include "wirestead/base/error_codes.hpp"
      23                 :             : #include "wirestead/base/platform.hpp"
      24                 :             : #include "wirestead/base/visibility.hpp"
      25                 :             : 
      26                 :             : // Public API Context and Interface headers
      27                 :             : #include "wirestead/wrapper/context.hpp"
      28                 :             : #include "wirestead/wrapper/ichannel.hpp"
      29                 :             : #include "wirestead/wrapper/iserver.hpp"
      30                 :             : #include "wirestead/wrapper/runtime_stats.hpp"
      31                 :             : 
      32                 :             : // Wrapper implementations
      33                 :             : #include "wirestead/wrapper/serial/serial.hpp"
      34                 :             : #include "wirestead/wrapper/tcp_client/tcp_client.hpp"
      35                 :             : #include "wirestead/wrapper/tcp_server/tcp_server.hpp"
      36                 :             : #include "wirestead/wrapper/udp/udp.hpp"
      37                 :             : #include "wirestead/wrapper/udp/udp_server.hpp"
      38                 :             : #include "wirestead/wrapper/uds_client/uds_client.hpp"
      39                 :             : #include "wirestead/wrapper/uds_server/uds_server.hpp"
      40                 :             : 
      41                 :             : // High-level Builder API includes
      42                 :             : #include "wirestead/builder/ibuilder.hpp"
      43                 :             : #include "wirestead/builder/serial_builder.hpp"
      44                 :             : #include "wirestead/builder/tcp_client_builder.hpp"
      45                 :             : #include "wirestead/builder/tcp_server_builder.hpp"
      46                 :             : #include "wirestead/builder/udp_builder.hpp"
      47                 :             : #include "wirestead/builder/uds_builder.hpp"
      48                 :             : #include "wirestead/builder/unified_builder.hpp"
      49                 :             : 
      50                 :             : // Configuration Management API includes (optional)
      51                 :             : #ifdef WIRESTEAD_ENABLE_CONFIG
      52                 :             : #include "wirestead/config/config_factory.hpp"
      53                 :             : #include "wirestead/config/config_manager.hpp"
      54                 :             : #include "wirestead/config/iconfig_manager.hpp"
      55                 :             : #endif
      56                 :             : 
      57                 :             : // Io thread policy hook
      58                 :             : #include "wirestead/concurrency/io_thread_hook.hpp"
      59                 :             : 
      60                 :             : // Error handling and logging system includes
      61                 :             : #include "wirestead/diagnostics/error_handler.hpp"
      62                 :             : #include "wirestead/diagnostics/logger.hpp"
      63                 :             : 
      64                 :             : namespace wirestead {
      65                 :             : 
      66                 :             : // === Public Facade Aliases ===
      67                 :             : 
      68                 :             : // Core communication classes
      69                 :             : using TcpClient = wrapper::TcpClient;
      70                 :             : using TcpServer = wrapper::TcpServer;
      71                 :             : using Serial = wrapper::Serial;
      72                 :             : using UdpClient = wrapper::UdpClient;
      73                 :             : using UdpServer = wrapper::UdpServer;
      74                 :             : using UdsClient = wrapper::UdsClient;
      75                 :             : using UdsServer = wrapper::UdsServer;
      76                 :             : 
      77                 :             : // Context classes for callbacks
      78                 :             : using MessageContext = wrapper::MessageContext;
      79                 :             : using ConnectionContext = wrapper::ConnectionContext;
      80                 :             : using ErrorContext = wrapper::ErrorContext;
      81                 :             : using RuntimeStats = wrapper::RuntimeStats;
      82                 :             : 
      83                 :             : // === Public Builder API Convenience Functions ===
      84                 :             : 
      85                 :             : /**
      86                 :             :  * @brief Create a TCP server builder
      87                 :             :  * @param port The port number for the server
      88                 :             :  * @return TcpServerBuilderDefault A configured builder for TcpServer
      89                 :             :  */
      90                 :          92 : inline builder::TcpServerBuilderDefault tcp_server(uint16_t port) { return builder::TcpServerBuilderDefault(port); }
      91                 :             : 
      92                 :             : /**
      93                 :             :  * @brief Create a TCP client builder
      94                 :             :  * @param host The host address to connect to
      95                 :             :  * @param port The port number to connect to
      96                 :             :  * @return TcpClientBuilderDefault A configured builder for TcpClient
      97                 :             :  */
      98                 :          84 : inline builder::TcpClientBuilderDefault tcp_client(const std::string& host, uint16_t port) {
      99                 :          84 :   return builder::TcpClientBuilderDefault(host, port);
     100                 :             : }
     101                 :             : 
     102                 :             : /**
     103                 :             :  * @brief Create a UDS server builder
     104                 :             :  * @param socket_path The path to the Unix Domain Socket file
     105                 :             :  * @return UdsServerBuilderDefault A configured builder for UdsServer
     106                 :             :  */
     107                 :           4 : inline builder::UdsServerBuilderDefault uds_server(const std::string& socket_path) {
     108                 :           4 :   return builder::UdsServerBuilderDefault(socket_path);
     109                 :             : }
     110                 :             : 
     111                 :             : /**
     112                 :             :  * @brief Create a UDS client builder
     113                 :             :  * @param socket_path The path to the Unix Domain Socket file
     114                 :             :  * @return UdsClientBuilderDefault A configured builder for UdsClient
     115                 :             :  */
     116                 :           5 : inline builder::UdsClientBuilderDefault uds_client(const std::string& socket_path) {
     117                 :           5 :   return builder::UdsClientBuilderDefault(socket_path);
     118                 :             : }
     119                 :             : 
     120                 :             : /**
     121                 :             :  * @brief Create a Serial port builder
     122                 :             :  * @param device The serial device path (e.g., "/dev/ttyUSB0")
     123                 :             :  * @param baud_rate The baud rate for serial communication
     124                 :             :  * @return SerialBuilderDefault A configured builder for Serial
     125                 :             :  */
     126                 :          21 : inline builder::SerialBuilderDefault serial(const std::string& device, uint32_t baud_rate) {
     127                 :          21 :   return builder::SerialBuilderDefault(device, baud_rate);
     128                 :             : }
     129                 :             : 
     130                 :             : /**
     131                 :             :  * @brief Create a UDP client builder
     132                 :             :  * @param local_port The local port to bind
     133                 :             :  * @return UdpClientBuilderDefault A configured builder for UDP Client
     134                 :             :  */
     135                 :           2 : inline builder::UdpClientBuilderDefault udp_client(uint16_t local_port) {
     136                 :           2 :   return builder::UdpClientBuilderDefault(local_port);
     137                 :             : }
     138                 :             : 
     139                 :             : /**
     140                 :             :  * @brief Create a UDP server builder (Virtual sessions)
     141                 :             :  * @param local_port The local port to bind
     142                 :             :  * @return UdpServerBuilderDefault A configured builder for UDP Server
     143                 :             :  */
     144                 :             : inline builder::UdpServerBuilderDefault udp_server(uint16_t local_port) {
     145                 :             :   return builder::UdpServerBuilderDefault(local_port);
     146                 :             : }
     147                 :             : 
     148                 :             : }  // namespace wirestead
        

Generated by: LCOV version 2.0-1