LCOV - code coverage report
Current view: top level - libs/bsw/cpp2someip/include/someip - TpConfig.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 12 12
Test Date: 2026-09-11 12:05:06 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2026 Accenture
       3              :  *
       4              :  * This program and the accompanying materials are made available under the
       5              :  * terms of the Apache License Version 2.0 which is available at
       6              :  * https://www.apache.org/licenses/LICENSE-2.0
       7              :  *
       8              :  * SPDX-License-Identifier: Apache-2.0
       9              :  ********************************************************************************/
      10              : 
      11              : #pragma once
      12              : 
      13              : #include "someip/SomeIpConstants.h"
      14              : #include "someip/TpReceiver.h"
      15              : #include "someip/TpSender.h"
      16              : #include <cstdint>
      17              : 
      18              : namespace someip
      19              : {
      20              : /**
      21              :  * The TP configuration.
      22              :  */
      23              : class TpConfig
      24              : {
      25              : public:
      26              :     TpConfig(TpConfig const&)            = delete;
      27              :     TpConfig& operator=(TpConfig const&) = delete;
      28              : 
      29              :     ::etl::span<TpSender*> tpSenders;
      30              :     ::etl::span<TpReceiver*> tpReceivers;
      31              : 
      32              : protected:
      33           31 :     TpConfig(::etl::span<TpSender*> const senders, ::etl::span<TpReceiver*> const receivers)
      34           31 :     : tpSenders(senders), tpReceivers(receivers)
      35           31 :     {}
      36              : 
      37              :     ~TpConfig() = default;
      38              : };
      39              : 
      40              : namespace internal
      41              : {
      42              : /**
      43              :  * Internal TP resources.
      44              :  */
      45              : template<uint8_t NumTpStreams, size_t TpBufferSize>
      46              : class TpResources : public TpConfig
      47              : {
      48              : public:
      49           12 :     TpResources()
      50              :     : TpConfig(
      51           12 :         ::etl::span<TpSender*>(&_senderPtr, 1),
      52           24 :         ::etl::span<TpReceiver*>(_receiverList, NumTpStreams))
      53           12 :     , _senderPtr(&_sender)
      54           39 :     , _receiverArray()
      55              :     {
      56           27 :         for (size_t i = 0; i < NumTpStreams; ++i)
      57              :         {
      58           15 :             _receiverList[i] = &(_receiverArray[i]);
      59              :         }
      60           12 :     }
      61              : 
      62              : private:
      63              :     ::someip::declare::TpSender<UDP_PACKET_MAX_SIZE> _sender;
      64              :     TpSender* _senderPtr;
      65              : 
      66              :     ::someip::declare::TpReceiver<TpBufferSize> _receiverArray[NumTpStreams];
      67              :     TpReceiver* _receiverList[NumTpStreams];
      68              : };
      69              : 
      70              : template<size_t TpBufferSize>
      71              : class TpResources<0U, TpBufferSize> : public TpConfig
      72              : {
      73              : public:
      74           19 :     TpResources() : TpConfig({}, {}) {}
      75              : };
      76              : } // namespace internal
      77              : } // namespace someip
        

Generated by: LCOV version 2.0-1