Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #ifndef COMMON_COMMON_INC_TSD_MSG_PARSE_REG_H
12 : #define COMMON_COMMON_INC_TSD_MSG_PARSE_REG_H
13 :
14 : #include "proto/tsd_message.pb.h"
15 : #include "tsd_message_parse_client.h"
16 :
17 : namespace tsd {
18 : class MsgParseReg {
19 : public:
20 21 : explicit MsgParseReg(const HDCMessage::MsgType type, ParseFuncType const func) noexcept
21 : {
22 21 : MessageParseClient::GetInstance()->RegisterMsgProcess(type, func);
23 21 : }
24 :
25 : ~MsgParseReg() = default;
26 : }; // class MsgParseReg
27 :
28 : #define TDT_REGISTER_NORMAL_MSG_PARSE_FUNC(name, type, msgParseFunc) \
29 : static MsgParseReg tdtAutoMsgParse##name((type), (msgParseFunc))
30 : } // namespace tsd
31 :
32 : #endif // INC_TDT_MSG_PARSE_REG_H
|