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 : #ifndef ADX_DATA_DUMP_COMPONENT_H
11 : #define ADX_DATA_DUMP_COMPONENT_H
12 : #include <map>
13 : #include <vector>
14 : #include "adx_component.h"
15 : #include "adx_comm_opt_manager.h"
16 : #include "adx_msg_proto.h"
17 : namespace Adx {
18 : class AdxDumpReceive : public AdxComponent {
19 : public:
20 25 : ~AdxDumpReceive() override {}
21 : int32_t Init() override;
22 3 : const std::string GetInfo() override { return "DataDump"; }
23 4 : ComponentType GetType() override { return ComponentType::COMPONENT_DUMP; }
24 : int32_t Process(const CommHandle &handle, const SharedPtr<MsgProto> &proto) override;
25 : int32_t UnInit() override;
26 : int32_t Terminate() override;
27 : private:
28 : int32_t Receive(const CommHandle &handle, const SharedPtr<MsgProto> &proto);
29 : void StoreSession(uint32_t deviceId, AdxCommHandle handle);
30 : void ReleaseSession(uint32_t deviceId, AdxCommHandle handle);
31 : bool init_;
32 : std::mutex mutex_;
33 : std::map<uint32_t, std::vector<AdxCommHandle>> handles_;
34 : };
35 : }
36 : #endif
|