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 339 : 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(const uint64_t key, std::vector<Entity*> &toPushDstEntities,
32 : std::vector<Entity*> &reprocessDstEntities, std::vector<Entity*> &abnormalDstEntities) override;
33 : FsmStatus SendData(const DataObjPtr dataObj) override;
34 : FsmStatus PauseSubscribe(const Entity &fullEntity) override;
35 : FsmStatus ResumeSubscribe(const Entity ¬FullEntity) override;
36 : FsmStatus ClearQueue() override;
37 : bool IsDataPeeked() const override;
38 : FsmStatus Uninit() override;
39 : protected:
40 : virtual FsmStatus DoDequeue();
41 : virtual void PostDeque();
42 : virtual FsmStatus RefreshWithData();
43 : virtual Mbuf* PrepareMbufToPush(DataObjPtr dataObj) const;
44 : virtual FsmStatus DoSendData(Mbuf *const mbuf);
45 : Mbuf* SdmaCopy(Mbuf * const mbuf) const;
46 : bqs::SubscribeManager *GetSubscriber() const;
47 : Mbuf* AllocateMbuf(const uint64_t desBufLen) const;
48 : FsmStatus SdmaCopyData(void *const srcDataBuf, const uint64_t desBufLen, Mbuf *const mbufPtr) const;
49 : FsmStatus SdmaCopyHead(void *const srcHeadBuf, const uint32_t srcHeadBufSize, Mbuf *const mbufPtr) const;
50 : };
51 : }
52 : #endif
|