1 /** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef _PANDA_TYPE_PARAMS_HPP__ 17 #define _PANDA_TYPE_PARAMS_HPP__ 18 19 #include "type_param.h" 20 21 namespace panda::verifier { 22 class TypeSystem; 23 24 class TypeParams : public TypeParamsIdx { 25 friend class Type; 26 friend class TypeParam; 27 friend class ParametricType; 28 29 public: 30 TypeParams(TypeSystemKind kind, ThreadNum threadnum, const TypeParamsIdx ¶ms = {}) 31 : TypeParamsIdx {params}, kind_ {kind}, threadnum_ {threadnum} 32 { 33 } 34 35 TypeParams() = default; 36 TypeParams(const TypeParams &) = default; 37 TypeParams(TypeParams &&) = default; 38 TypeParams &operator=(const TypeParams &) = default; 39 TypeParams &operator=(TypeParams &&) = default; 40 ~TypeParams() = default; 41 42 bool operator<=(const TypeParams &rhs) const; 43 44 TypeParams &operator>>(const TypeParam &p); 45 46 template <typename Handler> ForEach(Handler && handler)47 void ForEach(Handler &&handler) const 48 { 49 for (const auto &p : *this) { 50 handler(TypeParam {kind_, threadnum_, p}); 51 } 52 } 53 54 TypeSystem &GetTypeSystem() const; 55 56 private: 57 TypeSystemKind kind_; 58 ThreadNum threadnum_; 59 }; 60 } // namespace panda::verifier 61 62 #endif // !_PANDA_TYPE_PARAMS_HPP__ 63