| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2013 The Android Open Source Project | 
|  | 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 | #ifndef ANDROID_HWUI_PAIR_H | 
|  | 18 | #define ANDROID_HWUI_PAIR_H | 
|  | 19 |  | 
| Rob Tsuk | 487a92c | 2015-01-06 13:22:54 -0800 | [diff] [blame] | 20 | #include <utils/TypeHelpers.h> | 
|  | 21 |  | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 22 | namespace android { | 
|  | 23 | namespace uirenderer { | 
|  | 24 |  | 
|  | 25 | template <typename F, typename S> | 
|  | 26 | struct Pair { | 
|  | 27 | F first; | 
|  | 28 | S second; | 
|  | 29 |  | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 30 | Pair() {} | 
|  | 31 | Pair(const Pair& o) : first(o.first), second(o.second) {} | 
|  | 32 | Pair(const F& f, const S& s) : first(f), second(s) {} | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 33 |  | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 34 | inline const F& getFirst() const { return first; } | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 35 |  | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 36 | inline const S& getSecond() const { return second; } | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 37 | }; | 
|  | 38 |  | 
| Chris Blume | 7b8a808 | 2018-11-30 15:51:58 -0800 | [diff] [blame] | 39 | }  // namespace uirenderer | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 40 |  | 
|  | 41 | template <typename F, typename S> | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 42 | struct trait_trivial_ctor<uirenderer::Pair<F, S> > { | 
|  | 43 | enum { value = aggregate_traits<F, S>::has_trivial_ctor }; | 
|  | 44 | }; | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 45 | template <typename F, typename S> | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 46 | struct trait_trivial_dtor<uirenderer::Pair<F, S> > { | 
|  | 47 | enum { value = aggregate_traits<F, S>::has_trivial_dtor }; | 
|  | 48 | }; | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 49 | template <typename F, typename S> | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 50 | struct trait_trivial_copy<uirenderer::Pair<F, S> > { | 
|  | 51 | enum { value = aggregate_traits<F, S>::has_trivial_copy }; | 
|  | 52 | }; | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 53 | template <typename F, typename S> | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 54 | struct trait_trivial_move<uirenderer::Pair<F, S> > { | 
|  | 55 | enum { value = aggregate_traits<F, S>::has_trivial_move }; | 
|  | 56 | }; | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 57 |  | 
| Chris Blume | 7b8a808 | 2018-11-30 15:51:58 -0800 | [diff] [blame] | 58 | }  // namespace android | 
| Romain Guy | c5cbee7 | 2013-03-20 19:15:02 -0700 | [diff] [blame] | 59 |  | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 60 | #endif  // ANDROID_HWUI_PAIR_H |