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