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 : #include "strategy/broadcast_strategy.h"
11 : #include "dgw_client.h"
12 : #include "common/bqs_log.h"
13 : #include "entity_manager.h"
14 : #include "strategy/strategy_manager.h"
15 :
16 : namespace dgw {
17 2 : FsmStatus BroadcastStrategy::Search(const uint32_t groupId, const uint64_t transId, std::vector<EntityPtr> &selEntities,
18 : const uint32_t resIndex)
19 : {
20 2 : const std::vector<EntityPtr> &entitiesInGroup = EntityManager::Instance(resIndex).GetEntitiesInGroup(groupId);
21 2 : if (entitiesInGroup.empty()) {
22 1 : DGW_LOG_ERROR("No entities in group, groupId:%u, transId:%lu", groupId, transId);
23 1 : return FsmStatus::FSM_FAILED;
24 : }
25 1 : selEntities.assign(entitiesInGroup.begin(), entitiesInGroup.end());
26 1 : return FsmStatus::FSM_SUCCESS;
27 : }
28 :
29 : REGISTER_STRATEGY(BROADCAST, BroadcastStrategy);
30 : }
|