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 <etl/array.h>
14 :
15 : #include <cmath>
16 : #include <cstddef>
17 :
18 : namespace someip
19 : {
20 : namespace types
21 : {
22 : template<class CODING_, class T, size_t N>
23 2 : bool validateSimpleCoding(::etl::array<T, N> const& data)
24 : {
25 : using simple_array_iterator = typename ::etl::array<T, N>::const_iterator;
26 :
27 2 : simple_array_iterator const endIter = data.cend();
28 :
29 4 : for (simple_array_iterator iter = data.cbegin(); iter < endIter; ++iter)
30 : {
31 3 : if (CODING_::validate(static_cast<float_t>(*iter)) == false)
32 : {
33 1 : return false;
34 : }
35 : }
36 :
37 1 : return true;
38 : }
39 :
40 : template<class T, size_t N>
41 2 : bool validateComplexCoding(::etl::array<T, N> const& data)
42 : {
43 : using complex_array_iterator = typename ::etl::array<T, N>::const_iterator;
44 2 : complex_array_iterator const endIter = data.cend();
45 :
46 5 : for (complex_array_iterator iter = data.cbegin(); iter < endIter; ++iter)
47 : {
48 4 : if (iter->isValid() == false)
49 : {
50 1 : return false;
51 : }
52 : }
53 :
54 1 : return true;
55 : }
56 :
57 : } // namespace types
58 : } // namespace someip
|