1 /* 2 * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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 SRC_TRACE_BASE_MAP_H 17 #define SRC_TRACE_BASE_MAP_H 18 19 #define MAP_ERASE_COMMON(...) \ 20 void Erase(__VA_ARGS__) \ 21 { \ 22 auto streamIdHookidMap = internalMap_.find(t1); \ 23 if (streamIdHookidMap != internalMap_.end()) { 24 25 #define MAP_ERASE_WITH_SINGLE_PARME(T1) \ 26 MAP_ERASE_COMMON(T1 t1) \ 27 internalMap_.erase(streamIdHookidMap); \ 28 } \ 29 } 30 31 #define MAP_ERASE_WITH_DOUBLE_PARME(T1, T2) \ 32 MAP_ERASE_COMMON(T1 t1, T2 t2) \ 33 (*streamIdHookidMap).second.Erase(t2); \ 34 } \ 35 } 36 37 #define DOUBLE_MAP_ERASE_WITH_DOUBLE_PARME(T1, T2) \ 38 MAP_ERASE_COMMON(T1 t1, T2 t2) \ 39 auto hookId = (*streamIdHookidMap).second.find(t2); \ 40 if (hookId != (*streamIdHookidMap).second.end()) { \ 41 (*streamIdHookidMap).second.erase(hookId); \ 42 } \ 43 } \ 44 } 45 46 #define MAP_ERASE_WITH_TRIPLE_PARME(T1, T2, T3) \ 47 MAP_ERASE_COMMON(T1 t1, T2 t2, T3 t3) \ 48 (*streamIdHookidMap).second.Erase(t2, t3); \ 49 } \ 50 } 51 52 #define MAP_ERASE_WITH_QUATRA_PARME(T1, T2, T3, T4) \ 53 MAP_ERASE_COMMON(T1 t1, T2 t2, T3 t3, T4 t4) \ 54 (*streamIdHookidMap).second.Erase(t2, t3, t4); \ 55 } \ 56 } 57 58 #endif // SRC_TRACE_BASE_MAP_H 59