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

            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              : #include "someip/ServiceDescription.h"
      12              : 
      13              : #include "someip/SomeIpConstants.h"
      14              : #include "someip/init.h"
      15              : 
      16              : namespace someip
      17              : {
      18              : template<>
      19          150 : ServiceDescription make<ServiceDescription>()
      20              : {
      21              :     return {
      22              :         minor_version::INVALID,
      23              :         ttl::INVALID,
      24              :         service_id::INVALID,
      25              :         instance_id::ANY,
      26              :         eventgroup_id::ALL,
      27              : #ifdef PLATFORM_SUPPORT_IPV6
      28              :         ::ip::make_ip6(0U),
      29              : #else
      30              :         ::ip::make_ip4(0U),
      31              : #endif
      32              :         port::INVALID,
      33              :         SomeIpConstants::INVALID_PROTO,
      34          150 :         major_version::INVALID};
      35              : }
      36              : 
      37           19 : bool matches(ServiceDescription const& lhs, ServiceDescription const& rhs)
      38              : {
      39           18 :     return (lhs.serviceId == rhs.serviceId) && (lhs.instanceId == rhs.instanceId)
      40           37 :            && (lhs.eventGroup == rhs.eventGroup) && (lhs.majorVersion == rhs.majorVersion);
      41              : }
      42              : 
      43           33 : bool isInstanceOf(ServiceDescription const& lhs, ServiceDescription const& rhs)
      44              : {
      45           33 :     return (lhs.serviceId == rhs.serviceId)
      46           32 :            && ((lhs.instanceId == rhs.instanceId) || (lhs.instanceId == instance_id::ANY)
      47           19 :                || (rhs.instanceId == instance_id::ANY))
      48           31 :            && (lhs.eventGroup == rhs.eventGroup)
      49           66 :            && ((lhs.majorVersion == rhs.majorVersion) || (lhs.majorVersion == major_version::ANY)
      50           34 :                || (rhs.majorVersion == major_version::ANY));
      51              : }
      52              : 
      53           38 : bool isEventgroupOfService(ServiceDescription const& lhs, ServiceDescription const& rhs)
      54              : {
      55           57 :     return ((containsEventGroup(lhs)) && (!containsEventGroup(rhs)))
      56           17 :            && (lhs.serviceId == rhs.serviceId)
      57           16 :            && ((lhs.instanceId == instance_id::ANY) || (rhs.instanceId == instance_id::ANY)
      58           12 :                || (lhs.instanceId == rhs.instanceId))
      59           57 :            && (lhs.majorVersion == rhs.majorVersion);
      60              : }
      61              : 
      62          146 : bool containsEventGroup(ServiceDescription const& desc)
      63              : {
      64          146 :     return (desc.eventGroup != eventgroup_id::ALL);
      65              : }
      66              : 
      67              : } // namespace someip
        

Generated by: LCOV version 2.0-1