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

            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              : 
      15              : #include <ip/IPEndpoint.h>
      16              : 
      17              : #include <cstdint>
      18              : 
      19              : namespace someip
      20              : {
      21              : class SdEndpoint : public ::ip::IPEndpoint
      22              : {
      23              : public:
      24              :     SdEndpoint();
      25              :     SdEndpoint(::ip::IPAddress const& ipAddr, uint16_t port, uint8_t proto);
      26              :     SdEndpoint(SdEndpoint const& other);
      27              : 
      28              :     SdEndpoint& operator=(SdEndpoint const& other);
      29              : 
      30              :     bool isValid() const;
      31              :     void clear();
      32              : 
      33              :     void setProto(uint8_t proto);
      34              :     uint8_t getProto() const;
      35              : 
      36              : private:
      37              :     uint8_t _proto;
      38              : };
      39              : 
      40          630 : inline SdEndpoint::SdEndpoint() : ::ip::IPEndpoint(), _proto(SomeIpConstants::INVALID_PROTO) {}
      41              : 
      42           34 : inline SdEndpoint::SdEndpoint(
      43           34 :     ::ip::IPAddress const& ipAddr, uint16_t const port, uint8_t const proto)
      44           34 : : ::ip::IPEndpoint(ipAddr, port), _proto(proto)
      45           34 : {}
      46              : 
      47           21 : inline SdEndpoint::SdEndpoint(SdEndpoint const& other) = default;
      48              : 
      49           43 : inline bool SdEndpoint::isValid() const
      50              : {
      51           43 :     return isSet() && (_proto != SomeIpConstants::INVALID_PROTO) && (getPort() != 0);
      52              : }
      53              : 
      54            1 : inline void SdEndpoint::clear()
      55              : {
      56            1 :     ::ip::IPEndpoint::clear();
      57            1 :     _proto = SomeIpConstants::INVALID_PROTO;
      58            1 : }
      59              : 
      60            1 : inline void SdEndpoint::setProto(uint8_t const proto) { _proto = proto; }
      61              : 
      62           21 : inline uint8_t SdEndpoint::getProto() const { return _proto; }
      63              : 
      64            2 : inline SdEndpoint& SdEndpoint::operator=(SdEndpoint const& other)
      65              : {
      66            2 :     if (this != &other)
      67              :     {
      68            1 :         setAddress(other.getAddress());
      69            1 :         setPort(other.getPort());
      70            1 :         _proto = other._proto;
      71              :     }
      72              : 
      73            2 :     return *this;
      74              : }
      75              : 
      76              : } // namespace someip
        

Generated by: LCOV version 2.0-1