Skip to content
Snippets Groups Projects
Commit 48212a3b authored by Maxence Naud's avatar Maxence Naud
Browse files

[Add] GraphView helper for manipulation functions, add 'producers()'

parent 2ed4315d
No related branches found
No related tags found
2 merge requests!68Fix for updating aidge bundle,!64Draft: Learning
Pipeline #36708 canceled
/********************************************************************************
* Copyright (c) 2023 CEA-List
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*
********************************************************************************/
#ifndef AIDGE_CORE_UTILS_RECIPIES_H_
#define AIDGE_CORE_UTILS_RECIPIES_H_
#include <memory>
#include <set>
#include "aidge/graph/Node.hpp"
#include "aidge/graph/GraphView.hpp"
namespace Aidge {
/**
* @brief Getter for every Producer operator in a GraphView.
* @param graphview GraphView instance where Producers should be searched.
* @return std::set<std::shared_ptr<Node>>
*/
std::set<std::shared_ptr<Aidge::Node>> producers(std::shared_ptr<Aidge::GraphView> graphview) {
std::set<std::shared_ptr<Node>> res;
const std::set<std::shared_ptr<Node>> nodes = graphview->getNodes();
std::copy_if(nodes.cbegin(),
nodes.cend(),
std::inserter(res, res.begin()),
[](std::shared_ptr<Node> n){ return n->type() == "Producer"; });
return res;
}
} // namespace Aidge
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment