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 DGW_SIMPLE_ENTITY_H
12 : #define DGW_SIMPLE_ENTITY_H
13 :
14 : #include "entity.h"
15 : #include "subscribe_manager.h"
16 :
17 : namespace dgw {
18 :
19 : class SimpleEntity : public Entity {
20 : public:
21 : explicit SimpleEntity(const EntityMaterial& material, const uint32_t resIndex);
22 342 : virtual ~SimpleEntity() = default;
23 : SimpleEntity(const SimpleEntity&) = delete;
24 : SimpleEntity(const SimpleEntity&&) = delete;
25 : SimpleEntity& operator=(const SimpleEntity&) = delete;
26 : SimpleEntity& operator=(SimpleEntity&&) = delete;
27 : virtual FsmStatus DoDequeueMbuf(void** mbufPtr) const;
28 :
29 : FsmStatus Dequeue() override;
30 : FsmStatus ResetSrcState() override;
31 : void SelectDstEntities(
32 : const uint64_t key, std::vector<Entity*>& toPushDstEntities, std::vector<Entity*>& reprocessDstEntities,
33 : std::vector<Entity*>& abnormalDstEntities) override;
34 : FsmStatus SendData(const DataObjPtr dataObj) override;
35 : FsmStatus PauseSubscribe(const Entity& fullEntity) override;
36 : FsmStatus ResumeSubscribe(const Entity& notFullEntity) override;
37 : FsmStatus ClearQueue() override;
38 : bool IsDataPeeked() const override;
39 : FsmStatus Uninit() override;
40 :
41 : protected:
42 : virtual FsmStatus DoDequeue();
43 : virtual void PostDeque();
44 : virtual FsmStatus RefreshWithData();
45 : virtual Mbuf* PrepareMbufToPush(DataObjPtr dataObj) const;
46 : virtual FsmStatus DoSendData(Mbuf* const mbuf);
47 : Mbuf* SdmaCopy(Mbuf* const mbuf) const;
48 : bqs::SubscribeManager* GetSubscriber() const;
49 : Mbuf* AllocateMbuf(const uint64_t desBufLen) const;
50 : FsmStatus SdmaCopyData(void* const srcDataBuf, const uint64_t desBufLen, Mbuf* const mbufPtr) const;
51 : FsmStatus SdmaCopyHead(void* const srcHeadBuf, const uint32_t srcHeadBufSize, Mbuf* const mbufPtr) const;
52 : };
53 : } // namespace dgw
54 : #endif
|