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_PARAMETRIC_HPP__ 17 #define _PANDA_TYPE_PARAMETRIC_HPP__ 18 19 #include "type_params.h" 20 #include "type_sort.h" 21 #include "type_tags.h" 22 #include "type_type.h" 23 24 namespace panda::verifier { 25 class TypeSystem; 26 class TypeParams; 27 28 class ParametricType { 29 public: 30 TypeSystemKind kind_; 31 ThreadNum threadnum_; 32 SortIdx Sort_; ParametricType(TypeSystemKind kind,ThreadNum threadnum,SortIdx sort)33 ParametricType(TypeSystemKind kind, ThreadNum threadnum, SortIdx sort) 34 : kind_ {kind}, threadnum_ {threadnum}, Sort_(sort) 35 { 36 } 37 friend class TypeSystem; 38 39 ParametricType() = delete; 40 ParametricType(const ParametricType &) = default; 41 ParametricType(ParametricType &&) = default; 42 ParametricType &operator=(const ParametricType &) = default; 43 ParametricType &operator=(ParametricType &&) = default; 44 ~ParametricType() = default; 45 46 TypeSystem &GetTypeSystem() const; 47 bool operator[](TypeParamsIdx params) const; 48 Type operator()(TypeParamsIdx params = {}) const; 49 bool operator[](const TypeParams ¶ms) const; 50 Type operator()(const TypeParams ¶ms) const; 51 52 template <typename Handler> 53 void ForAll(Handler &&handler) const; 54 }; 55 } // namespace panda::verifier 56 57 #endif // !_PANDA_TYPE_PARAMETRIC_HPP__ 58