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