common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / nsframework / framework_unified / client / include / ns__CWORD77__template.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 ////////////////////////////////////////////////////////////////////////////////
18 /// \ingroup  tag_HMI_CWORD77_Controller
19 /// \brief
20 ///
21 ////////////////////////////////////////////////////////////////////////////////
22 //@{
23
24 #ifndef FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
25 #define FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
26
27 #include <iterator>
28 #include <algorithm>
29
30 /// Template for Map range transformation
31 template< class OCont, class IIter, class MapFn >
32 OCont mapRange(const IIter &begin, const IIter &end, MapFn fn) {
33   OCont c;
34   std::transform(begin, end, std::inserter(c, c.begin()), fn);
35   return c;
36 }
37
38
39 /// Template to get Array begining
40 template< class T, UI_32 N >
41 const T *ArrBeg(const T(&arr)[ N ]) {
42   return &arr[ 0 ];
43 }
44
45 /// Template to get Array ending
46 template< class T, UI_32 N >
47 const T *ArrEnd(const T(&arr)[ N ]) {
48   return &arr[ 0 ] + N;
49 }
50
51 /// Template to convert structure to Map
52 template< class Cont, class T, class C, class TFn >
53 const Cont GetMap(const T *mapTable, C N, TFn transform) {
54   return mapRange< Cont >(&mapTable[0], &mapTable[0] + N, transform);
55 }
56
57 ServiceResponseTableItem TransformServiceResponseTableIteminMap(const ServiceResponse &uch);
58
59 #endif  // FRAMEWORK_UNIFIED_CLIENT_INCLUDE_NS__CWORD77__TEMPLATE_H_
60 //@}