nndeploy C++ API  0.2.0
nndeploy C++ API
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nndeploy::dag::Graph Class Reference

Directed Acyclic Graph Node. More...

#include <graph.h>

Inheritance diagram for nndeploy::dag::Graph:
[legend]
Collaboration diagram for nndeploy::dag::Graph:
[legend]

Public Member Functions

base::Status addAudioUrl (const std::string &url)
 Add audio URL. More...
 
EdgeWrapperaddEdge (Edge *edge, bool is_external=true)
 Add edge to graph. More...
 
EdgeWrapperaddEdgeSharedPtr (std::shared_ptr< Edge > edge)
 Add edge to graph (shared pointer version) More...
 
base::Status addImageUrl (const std::string &url)
 Add image URL. More...
 
base::Status addModelUrl (const std::string &url)
 Add model URL. More...
 
base::Status addNode (Node *node, bool is_external=true)
 Add node to graph. More...
 
base::Status addNodeInputAndOutput (NodeWrapper *node_wrapper, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
 Add node's input and output. More...
 
base::Status addNodeSharedPtr (std::shared_ptr< Node > node)
 Add node to graph (shared pointer version) More...
 
base::Status addOtherUrl (const std::string &url)
 Add other type URL. More...
 
virtual base::Status addResourceWithoutState (const std::string &key, const base::Any &value)
 Add stateless global resource. More...
 
virtual base::Status addResourceWithState (const std::string &key, Edge *edge)
 Add stateful global resource. More...
 
base::Status addVideoUrl (const std::string &url)
 Add video URL. More...
 
base::Status connect (Node *predecessor, Node *successor, int predecessor_port=0, int successor_port=0)
 Connect two nodes. More...
 
EdgecreateEdge (const std::string &name)
 Create edge. More...
 
std::shared_ptr< EdgecreateEdgeSharedPtr (const std::string &name)
 Create edge (shared pointer version) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const NodeDesc &desc, base::InferenceType type)
 Template method: Create inference node by node description. More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, const std::string &input_name, const std::string &output_name)
 Template method: Create inference node (string input/output names) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, const std::string &input_name, Edge *output)
 Template method: Create inference node (string input name, edge output) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, Edge *input, const std::string &output_name)
 Template method: Create inference node (edge input, string output name) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, Edge *input, Edge *output)
 Template method: Create inference node (single input single output) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::initializer_list< Edge * > inputs, std::initializer_list< Edge * > outputs)
 Template method: Create inference node (initializer list inputs/outputs) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::initializer_list< Edge * > inputs, std::initializer_list< std::string > output_names)
 Template method: Create inference node (edge initializer list input, string initializer list output names) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::initializer_list< std::string > input_names, std::initializer_list< Edge * > outputs)
 Template method: Create inference node (string initializer list input names, edge initializer list outputs) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::initializer_list< std::string > input_names, std::initializer_list< std::string > output_names)
 Template method: Create inference node (string initializer list input/output names) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
 Template method: Create inference node (multiple inputs/outputs) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::vector< Edge * > inputs, std::vector< std::string > output_names)
 Template method: Create inference node (edge input list, string output name list) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::vector< std::string > input_names, std::vector< Edge * > outputs)
 Template method: Create inference node (string input name list, edge output list) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateInfer (const std::string &name, base::InferenceType type, std::vector< std::string > input_names, std::vector< std::string > output_names)
 Template method: Create inference node (string input/output name lists) More...
 
NodecreateNode (const NodeDesc &desc)
 Create node by node description. More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const NodeDesc &desc, Args &...args)
 Template method: Create node of specified type by node description. More...
 
NodecreateNode (const std::string &key, const std::string &name="")
 Create node by key. More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, const std::string &input_name, const std::string &output_name, Args &...args)
 Template method: Create node (string input/output names) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, const std::string &input_name, Edge *output, Args &...args)
 Template method: Create node (string input name, edge output) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, Edge *input, const std::string &output_name, Args &...args)
 Template method: Create node (edge input, string output name) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, Edge *input, Edge *output, Args &...args)
 Template method: Create node (single input single output) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::initializer_list< Edge * > inputs, std::initializer_list< Edge * > outputs, Args &...args)
 Template method: Create node (initializer list inputs/outputs) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::initializer_list< Edge * > inputs, std::initializer_list< std::string > output_names, Args &...args)
 Template method: Create node (edge initializer list input, string initializer list output names) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::initializer_list< std::string > input_names, std::initializer_list< Edge * > outputs, Args &...args)
 Template method: Create node (string initializer list input names, edge initializer list outputs) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::initializer_list< std::string > input_names, std::initializer_list< std::string > output_names, Args &...args)
 Template method: Create node (string initializer list input/output names) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::vector< Edge * > inputs, std::vector< Edge * > outputs, Args &...args)
 Template method: Create node (multiple inputs/outputs) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::vector< Edge * > inputs, std::vector< std::string > output_names, Args &...args)
 Template method: Create node (edge input list, string output name list) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::vector< std::string > input_names, std::vector< Edge * > outputs, Args &...args)
 Template method: Create node (string input name list, edge output list) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name, std::vector< std::string > input_names, std::vector< std::string > output_names, Args &...args)
 Template method: Create node (string input/output name lists) More...
 
template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type = 0>
NodecreateNode (const std::string &name="", Args &...args)
 Template method: Create node of specified type. More...
 
NodecreateNode4Py (const NodeDesc &desc)
 Create node for Python by node description. More...
 
NodecreateNode4Py (const std::string &key, const std::string &name="")
 Create node for Python. More...
 
virtual base::Status defaultParam ()
 Set default parameters. More...
 
virtual base::Status deinit ()
 Deinitialize graph. More...
 
base::Status deleteEdge (Edge *edge)
 Delete edge from graph. More...
 
base::Status deleteNode (Node *node)
 Delete node from graph. More...
 
virtual base::Status deserialize (const std::string &json_str)
 Deserialize from JSON string. More...
 
virtual base::Status deserialize (rapidjson::Value &json)
 Deserialize from JSON. More...
 
base::Status disconnect (Node *predecessor, Node *successor, int predecessor_port=0, int successor_port=0)
 Disconnect two nodes. More...
 
base::Status dump (std::ostream &oss=std::cout)
 Print graph information. More...
 
virtual std::vector< Edge * > forward ()
 Forward propagation (no input version) More...
 
virtual std::vector< Edge * > forward (Edge *input)
 Forward propagation (single input version) More...
 
virtual std::vector< Edge * > forward (std::vector< Edge * > inputs)
 Forward propagation (multiple inputs version) More...
 
std::vector< std::string > getAudioUrl () const
 Get all audio URL list. More...
 
EdgegetEdge (const std::string &name)
 Get edge by name. More...
 
int getEdgeQueueDropCount ()
 Get edge queue drop count. More...
 
int getEdgeQueueMaxSize ()
 Get maximum size of edge queue. More...
 
base::QueueOverflowPolicy getEdgeQueueOverflowPolicy ()
 Get edge queue overflow policy. More...
 
std::shared_ptr< EdgegetEdgeSharedPtr (const std::string &name)
 Get edge by name (shared pointer version) More...
 
EdgeWrappergetEdgeWrapper (const std::string &name)
 Get edge wrapper by name. More...
 
EdgeWrappergetEdgeWrapper (Edge *edge)
 Get edge wrapper. More...
 
std::shared_ptr< base::ParamgetExternalParam (const std::string &key)
 Get external parameter. More...
 
bool getGraphNodeShareStream ()
 Get whether graph nodes share stream. More...
 
std::vector< std::string > getImageUrl () const
 Get all image URL list. More...
 
NodegetInferNode (int index)
 Get inference node by index. More...
 
NodegetInputNode (int index)
 Get input node by index. More...
 
virtual int getLoopCount ()
 Get loop count. More...
 
virtual std::map< std::string, int > getLoopCountMap ()
 Get loop count map. More...
 
virtual bool getLoopMaxFlag ()
 Get loop max flag. More...
 
std::vector< std::string > getModelUrl () const
 Get all model URL list. More...
 
NodegetNode (const std::string &name)
 Get node by name. More...
 
NodegetNode (int index)
 Get node by index. More...
 
NodegetNodeByKey (const std::string &key)
 Get node by key. More...
 
int getNodeCount ()
 Get total number of nodes. More...
 
base::ParamgetNodeParam (const std::string &node_name)
 Get node parameter. More...
 
std::shared_ptr< base::ParamgetNodeParamSharedPtr (const std::string &node_name)
 Get node parameter (shared pointer version) More...
 
std::vector< Node * > getNodes ()
 Get all nodes. More...
 
std::vector< Node * > getNodesByKey (const std::string &key)
 Get all nodes matching the key. More...
 
std::shared_ptr< NodegetNodeSharedPtr (const std::string &name)
 Get node by name (shared pointer version) More...
 
std::vector< std::string > getNodesName ()
 Get all node names. More...
 
std::vector< std::string > getNodesNameRecursive ()
 Recursively get all node names (including nodes in subgraphs) More...
 
std::vector< Node * > getNodesRecursive ()
 Recursively get all nodes (including nodes in subgraphs) More...
 
std::map< std::string, std::shared_ptr< RunStatus > > getNodesRunStatus ()
 Get run status of all nodes. More...
 
std::map< std::string, std::shared_ptr< RunStatus > > getNodesRunStatusRecursive ()
 Recursively get run status of all nodes (including nodes in subgraphs) More...
 
virtual std::map< std::string, std::map< std::string, std::string > > getNodeValue ()
 Get node value map. More...
 
NodeWrappergetNodeWrapper (const std::string &name)
 Get node wrapper by name. More...
 
NodeWrappergetNodeWrapper (Node *node)
 Get node wrapper. More...
 
std::vector< std::string > getOtherUrl () const
 Get all other type URL list. More...
 
NodegetOutputNode (int index)
 Get output node by index. More...
 
virtual base::Any & getResourceWithoutState (const std::string &key)
 Get stateless global resource. More...
 
virtual EdgegetResourceWithState (const std::string &key)
 Get stateful global resource. More...
 
virtual std::set< std::string > getUnusedNodeNames ()
 Get unused node name set. More...
 
std::vector< std::string > getVideoUrl () const
 Get all video URL list. More...
 
 Graph (const std::string &name)
 Constructor. More...
 
 Graph (const std::string &name, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
 Constructor. More...
 
virtual base::Status init ()
 Initialize graph. More...
 
virtual bool interrupt ()
 Interrupt execution. More...
 
bool isForwardApiOk ()
 Check if forward API is working properly. More...
 
base::Status markInputEdge (std::vector< Edge * > inputs)
 Mark input edges. More...
 
base::Status markOutputEdge (std::vector< Edge * > outputs)
 Mark output edges. More...
 
virtual std::vector< Edge * > operator() ()
 Operator overload (no input version) More...
 
virtual std::vector< Edge * > operator() (Edge *input)
 Operator overload (single input version) More...
 
virtual std::vector< Edge * > operator() (std::vector< Edge * > inputs)
 Operator overload (multiple inputs version) More...
 
base::Status removeAudioUrl (const std::string &url)
 Remove audio URL. More...
 
base::Status removeImageUrl (const std::string &url)
 Remove image URL. More...
 
virtual void removeInOutNode ()
 Remove input/output nodes. More...
 
base::Status removeModelUrl (const std::string &url)
 Remove model URL. More...
 
base::Status removeOtherUrl (const std::string &url)
 Remove other type URL. More...
 
virtual void removeUnusedNodeNames (const std::set< std::string > &node_names)
 Remove unused node name set. More...
 
virtual void removeUnusedNodeNames (const std::string &node_name)
 Remove unused node name. More...
 
base::Status removeVideoUrl (const std::string &url)
 Remove video URL. More...
 
virtual base::Status run ()
 Run graph. More...
 
virtual std::string serialize ()
 Serialize to JSON string. More...
 
virtual base::Status serialize (rapidjson::Value &json, rapidjson::Document::AllocatorType &allocator)
 Serialize to JSON. More...
 
base::Status setEdgeQueueMaxSize (int queue_max_size)
 Set maximum size of edge queue. More...
 
base::Status setEdgeQueueOverflowPolicy (base::QueueOverflowPolicy policy, int drop_count=1)
 Set edge queue overflow policy. More...
 
base::Status setExternalParam (const std::string &key, std::shared_ptr< base::Param > param)
 Set external parameter. More...
 
void setGraphNodeShareStream (bool flag)
 Set whether graph nodes share stream. More...
 
virtual base::Status setInput (Edge *input, int index=-1)
 Set input edge. More...
 
virtual base::Status setInputs (std::vector< Edge * > inputs)
 Set input edge list. More...
 
virtual base::Status setInputSharedPtr (std::shared_ptr< Edge > input, int index=-1)
 Set input edge (shared pointer version) More...
 
virtual base::Status setInputsSharedPtr (std::vector< std::shared_ptr< Edge >> inputs)
 Set input edge list (shared pointer version) More...
 
virtual void setLoopCount (int loop_count)
 Set loop count. More...
 
virtual void setLoopMaxFlag (bool is_loop_max_flag)
 Set loop max flag. More...
 
base::Status setNodeDesc (Node *node, const NodeDesc &desc)
 Set node description. More...
 
base::Status setNodeParallelType (const std::string &node_name, base::ParallelType parallel_type)
 Set node parallel type. More...
 
base::Status setNodeParam (const std::string &node_name, base::Param *param)
 Set node parameter. More...
 
base::Status setNodeParamSharedPtr (const std::string &node_name, std::shared_ptr< base::Param > param)
 Set node parameter (shared pointer version) More...
 
virtual void setNodeValue (const std::string &node_name, const std::string &key, const std::string &value)
 Set node value. More...
 
virtual void setNodeValue (const std::string &node_value_str)
 Set node value (string format) More...
 
virtual void setNodeValue (std::map< std::string, std::map< std::string, std::string >> node_value_map)
 Set node value map. More...
 
virtual base::Status setOutput (Edge *output, int index=-1)
 Set output edge. More...
 
virtual base::Status setOutputs (std::vector< Edge * > outputs)
 Set output edge list. More...
 
virtual base::Status setOutputSharedPtr (std::shared_ptr< Edge > output, int index=-1)
 Set output edge (shared pointer version) More...
 
virtual base::Status setOutputsSharedPtr (std::vector< std::shared_ptr< Edge >> outputs)
 Set output edge list (shared pointer version) More...
 
virtual void setTraceFlag (bool flag)
 Set trace flag. More...
 
virtual void setUnusedNodeNames (const std::set< std::string > &node_names)
 Set unused node name set. More...
 
virtual void setUnusedNodeNames (const std::string &node_name)
 Set unused node name. More...
 
virtual bool synchronize ()
 Synchronize execution. More...
 
virtual base::Status toStaticGraph ()
 Convert to static graph. More...
 
std::vector< Edge * > trace ()
 Trace execution (no input version) More...
 
std::vector< Edge * > trace (Edge *input)
 Trace execution (single input version) More...
 
std::vector< Edge * > trace (std::vector< Edge * > inputs)
 Trace execution (multiple inputs version) More...
 
base::Status updateNodeIO (Node *node, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
 Update node's input and output. More...
 
base::Status updteEdge (EdgeWrapper *edge_wrapper, Edge *edge, bool is_external=true)
 Update edge. More...
 
virtual ~Graph ()
 Destructor. More...
 
- Public Member Functions inherited from nndeploy::dag::Node
base::Status addDropdownParam (const std::string &dropdown_param, const std::vector< std::string > &dropdown_values)
 Add dropdown parameter. More...
 
base::Status addIoParam (const std::string &io_param)
 Add IO parameter. More...
 
base::Status addRequiredParam (const std::string &required_param)
 Add required parameter. More...
 
base::Status addUiParam (const std::string &ui_param)
 Add UI parameter. More...
 
bool checkInputs (std::vector< Edge * > &inputs)
 Check input edges. More...
 
virtual bool checkInterruptStatus ()
 Check interrupt status. More...
 
bool checkOutputs (std::vector< Edge * > &outputs)
 Check output edges. More...
 
bool checkOutputs (std::vector< std::string > &outputs_name)
 Check output edge names. More...
 
base::Status clearDropdownParams ()
 Clear dropdown parameters. More...
 
virtual void clearInterrupt ()
 Clear interrupt status. More...
 
base::Status clearIoParams ()
 Clear IO parameters. More...
 
base::Status clearRequiredParams ()
 Clear required parameters. More...
 
base::Status clearUiParams ()
 Clear UI parameters. More...
 
virtual EdgecreateInternalOutputEdge (const std::string &name)
 Create internal output edge. More...
 
virtual EdgecreateResourceWithState (const std::string &key)
 Create stateful resource. More...
 
std::vector< Edge * > getAllInput ()
 Get all input edges. More...
 
std::vector< Edge * > getAllOutput ()
 Get all output edges. More...
 
size_t getCompletedSize ()
 Get completed count. More...
 
CompositeNodegetCompositeNode ()
 Get parent composite node. More...
 
bool getConstructed ()
 Get whether it's constructed. More...
 
bool getDebugFlag ()
 Get debug flag. More...
 
std::string getDesc ()
 Get node description. More...
 
std::string getDeveloper ()
 Get developer information. More...
 
virtual base::DeviceType getDeviceType ()
 Get device type. More...
 
std::map< std::string, std::vector< std::string > > getDropdownParams ()
 Get dropdown parameters. More...
 
GraphgetGraph ()
 Get parent graph. More...
 
bool getGraphFlag ()
 Get graph flag. More...
 
bool getInitialized ()
 Get whether it's initialized. More...
 
EdgegetInput (int index=0)
 Get input edge. More...
 
int getInputCount ()
 Get input edge count. More...
 
template<typename T >
T * getInputData (int index=0)
 Get input data (template method) More...
 
int getInputIndex (const std::string &name)
 Get input edge index by name. More...
 
std::string getInputName (int index=0)
 Get input edge name at specified index. More...
 
std::vector< std::string > getInputNames ()
 Get all input edge names. More...
 
std::vector< std::shared_ptr< EdgeTypeInfo > > getInputTypeInfo ()
 Get input type information. More...
 
std::vector< std::string > getIoParams ()
 Get IO parameter list. More...
 
IOType getIoType ()
 Get IO type. More...
 
std::string getKey ()
 Get node key. More...
 
virtual int64_t getMemorySize ()
 Get memory size. More...
 
std::string getName ()
 Get node name. More...
 
NodeType getNodeType ()
 Get node type. More...
 
EdgegetOutput (int index=0)
 Get output edge. More...
 
int getOutputCount ()
 Get output edge count. More...
 
int getOutputIndex (const std::string &name)
 Get output edge index by name. More...
 
std::string getOutputName (int index=0)
 Get output edge name at specified index. More...
 
std::vector< std::string > getOutputNames ()
 Get all output edge names. More...
 
std::vector< std::shared_ptr< EdgeTypeInfo > > getOutputTypeInfo ()
 Get output type information. More...
 
virtual base::ParallelType getParallelType ()
 Get parallel type. More...
 
virtual base::ParamgetParam ()
 Get parameter. More...
 
virtual base::Status getParam (const std::string &key, base::Any &any)
 Get parameter (Any type) More...
 
virtual std::shared_ptr< base::ParamgetParamSharedPtr ()
 Get parameter (shared pointer) More...
 
virtual std::vector< std::string > getRealOutputsName ()
 Get real output names. More...
 
std::vector< std::string > getRequiredParams ()
 Get required parameter list. More...
 
template<typename T >
getResourceWithoutState (const std::string &key)
 Get stateless resource (template method) More...
 
template<typename T >
T * getResourceWithState (const std::string &key)
 Get stateful resource (template method) More...
 
size_t getRunSize ()
 Get run count. More...
 
virtual std::shared_ptr< RunStatusgetRunStatus ()
 Get run status. More...
 
std::string getSource ()
 Get source information. More...
 
device::StreamgetStream ()
 Get compute stream. More...
 
bool getTimeProfileFlag ()
 Get time profile flag. More...
 
bool getTraceFlag ()
 Get trace flag. More...
 
std::vector< std::string > getUiParams ()
 Get UI parameter list. More...
 
std::string getVersion ()
 Get version number. More...
 
bool isDynamicInput ()
 Check if it's dynamic input. More...
 
bool isDynamicOutput ()
 Check if it's dynamic output. More...
 
bool isInputsChanged (std::vector< Edge * > inputs)
 Check if inputs changed. More...
 
bool isRunning ()
 Check if it's running. More...
 
virtual base::Status loadFile (const std::string &path)
 Load from file. More...
 
 Node (const std::string &name)
 Constructor. More...
 
 Node (const std::string &name, std::vector< Edge * > inputs, std::vector< Edge * > outputs)
 Constructor. More...
 
base::Status removeDropdownParam (const std::string &dropdown_param)
 Remove dropdown parameter. More...
 
base::Status removeIoParam (const std::string &io_param)
 Remove IO parameter. More...
 
base::Status removeRequiredParam (const std::string &required_param)
 Remove required parameter. More...
 
base::Status removeUiParam (const std::string &ui_param)
 Remove UI parameter. More...
 
virtual base::Status saveFile (const std::string &path)
 Save to file. More...
 
base::Status setCompositeNode (CompositeNode *composite_node)
 Set parent composite node. More...
 
void setDebugFlag (bool flag)
 Set debug flag. More...
 
void setDesc (const std::string &desc)
 Set node description. More...
 
void setDeveloper (const std::string &developer)
 Set developer information. More...
 
virtual base::Status setDeviceType (base::DeviceType device_type)
 Set device type. More...
 
base::Status setDropdownParams (const std::map< std::string, std::vector< std::string >> &dropdown_params)
 Set dropdown parameters. More...
 
void setDynamicInput (bool is_dynamic_input)
 Set whether it's dynamic input. More...
 
void setDynamicOutput (bool is_dynamic_output)
 Set whether it's dynamic output. More...
 
base::Status setGraph (Graph *graph)
 Set parent graph. More...
 
void setGraphFlag (bool flag)
 Set graph flag. More...
 
void setInitializedFlag (bool flag)
 Set initialized flag. More...
 
void setInnerFlag (bool flag)
 Set inner flag. More...
 
virtual base::Status setInputName (const std::string &name, int index=0)
 Set input edge name. More...
 
virtual base::Status setInputNames (const std::vector< std::string > &names)
 Set all input edge names. More...
 
base::Status setInputTypeInfo (std::shared_ptr< EdgeTypeInfo > input_type_info, std::string desc="")
 Set input type information. More...
 
template<typename T >
base::Status setInputTypeInfo (std::string desc="")
 Set input type information (template method) More...
 
base::Status setIoParams (const std::vector< std::string > &io_params)
 Set IO parameter list. More...
 
void setIoType (IOType io_type)
 Set IO type. More...
 
virtual base::Status setIterInput (Edge *input, int index=-1)
 Set iteration input edge. More...
 
void setKey (const std::string &key)
 Set node key. More...
 
virtual base::Status setMemory (device::Buffer *buffer)
 Set memory buffer. More...
 
void setName (const std::string &name)
 Set node name. More...
 
void setNodeType (NodeType node_type)
 Set node type. More...
 
template<typename T >
base::Status setOutputData (T *obj, int index=0, bool is_external=true)
 Set output data (template method) More...
 
virtual base::Status setOutputName (const std::string &name, int index=0)
 Set output edge name. More...
 
virtual base::Status setOutputNames (const std::vector< std::string > &names)
 Set all output edge names. More...
 
base::Status setOutputTypeInfo (std::shared_ptr< EdgeTypeInfo > output_type_info, std::string desc="")
 Set output type information. More...
 
template<typename T >
base::Status setOutputTypeInfo (std::string desc="")
 Set output type information (template method) More...
 
virtual base::Status setParallelType (const base::ParallelType &paralle_type)
 Set parallel type. More...
 
virtual base::Status setParam (base::Param *param)
 Set parameter. More...
 
virtual base::Status setParam (const std::string &key, base::Any &any)
 Set parameter (Any type) More...
 
virtual base::Status setParam (const std::string &key, const std::string &value)
 Set parameter (string type) More...
 
virtual base::Status setParamSharedPtr (std::shared_ptr< base::Param > param)
 Set parameter (shared pointer) More...
 
base::Status setRequiredParams (const std::vector< std::string > &required_params)
 Set required parameter list. More...
 
template<typename T >
base::Status setResourceWithState (const std::string &key, T *value, bool is_external=true)
 Set stateful resource (template method) More...
 
void setRunningFlag (bool flag)
 Set running flag. More...
 
void setSource (const std::string &source)
 Set source information. More...
 
void setStream (device::Stream *stream)
 Set compute stream. More...
 
void setTimeProfileFlag (bool flag)
 Set time profile flag. More...
 
base::Status setUiParams (const std::vector< std::string > &ui_params)
 Set UI parameter list. More...
 
base::Status setVersion (const std::string &version)
 Set version number. More...
 
virtual base::EdgeUpdateFlag updateInput ()
 Update input. More...
 
virtual ~Node ()
 

Protected Member Functions

virtual base::Status construct ()
 Construct graph. More...
 
virtual base::Status executor ()
 Execute graph. More...
 
virtual base::Status removeUnusedNodeAndEdge ()
 Remove unused nodes and edges. More...
 

Protected Attributes

std::vector< std::string > audio_url_
 Audio URL list. More...
 
std::vector< EdgeWrapper * > edge_repository_
 Edge repository. More...
 
std::shared_ptr< Executorexecutor_
 Executor. More...
 
std::map< std::string, std::shared_ptr< base::Param > > external_param_repository_
 External parameter repository. More...
 
std::vector< std::string > image_url_
 Image URL list. More...
 
bool is_forward_api_ok_ = true
 Whether forward API is working properly. More...
 
bool is_graph_node_share_stream_ = true
 Whether graph nodes share stream. More...
 
bool is_loop_max_flag_ = true
 Whether it's loop max flag. More...
 
bool is_remove_in_out_node_ = false
 Whether to remove input/output nodes. More...
 
std::vector< std::string > model_url_
 Model URL list. More...
 
std::vector< NodeWrapper * > node_repository_
 Node repository. More...
 
std::map< std::string, std::map< std::string, std::string > > node_value_map_
 
std::vector< std::string > other_url_
 Other URL list. More...
 
int queue_drop_count_ = 1
 Queue drop count. More...
 
int queue_max_size_ = 16
 Queue maximum size. More...
 
base::QueueOverflowPolicy queue_overflow_policy_
 Queue overflow policy. More...
 
std::map< std::string, Edge * > resource_with_state_
 Global resources (stateful) More...
 
std::map< std::string, base::Any > resource_without_state_
 Global resources (stateless) More...
 
std::vector< NodeWrapper * > run_node_repository_
 Run node repository. More...
 
std::vector< std::shared_ptr< Edge > > shared_edge_repository_
 Shared edge repository. More...
 
std::vector< std::shared_ptr< Node > > shared_node_repository_
 Shared node repository. More...
 
std::set< std::string > unused_node_names_
 Unused node name set. More...
 
std::set< std::string > used_edge_names_
 Used edge name set. More...
 
std::set< std::string > used_node_names_
 Used node name set. More...
 
std::vector< std::string > video_url_
 Video URL list. More...
 
- Protected Attributes inherited from nndeploy::dag::Node
size_t completed_size_ = 0
 Completed count. More...
 
CompositeNodecomposite_node_ = nullptr
 Parent composite node pointer. More...
 
bool constructed_ = false
 Whether constructed. More...
 
std::string desc_
 Node description. More...
 
std::string developer_
 Developer information. More...
 
base::DeviceType device_type_
 Device type. More...
 
std::map< std::string, std::vector< std::string > > dropdown_params_
 Dropdown parameter mapping. More...
 
std::map< std::string, std::shared_ptr< base::Param > > external_param_
 External parameter mapping. More...
 
Graphgraph_ = nullptr
 Parent graph pointer. More...
 
bool initialized_ = false
 Whether initialized. More...
 
std::vector< std::shared_ptr< EdgeTypeInfo > > input_type_info_
 Input type information. More...
 
std::vector< Edge * > inputs_
 Input edge list. More...
 
std::map< std::string, Edge * > internal_outputs_
 Internal output edge mapping. More...
 
std::vector< std::string > io_params_
 IO parameter list. More...
 
IOType io_type_ = IOType::kIOTypeNone
 IO type. More...
 
bool is_composite_node_ = false
 Whether it's composite node. More...
 
bool is_condition_ = false
 Whether it's condition node. More...
 
bool is_debug_ = false
 Whether debugging is enabled. More...
 
bool is_dynamic_input_ = false
 When node input/output is dynamic, cannot set input_type_info_ and output_type_info_. More...
 
bool is_dynamic_output_ = false
 Whether it's dynamic output. More...
 
bool is_external_stream_ = false
 Whether it's external stream. More...
 
bool is_graph_ = false
 Whether it's graph node. More...
 
bool is_inner_ = false
 Whether it's internal node in graph. More...
 
bool is_loop_ = false
 Whether it's loop node. More...
 
bool is_running_ = false
 Whether running. More...
 
bool is_time_profile_ = false
 Whether time profiling is enabled. More...
 
bool is_trace_ = false
 Whether tracing is enabled (when serialized to json, it must be static graph) More...
 
std::string key_
 Node key. More...
 
int loop_count_ = -1
 Loop count. More...
 
std::string name_
 Node name. More...
 
NodeType node_type_ = NodeType::kNodeTypeIntermediate
 Node type. More...
 
std::vector< std::shared_ptr< EdgeTypeInfo > > output_type_info_
 Output type information. More...
 
std::vector< Edge * > outputs_
 Output edge list. More...
 
base::ParallelType parallel_type_ = base::kParallelTypeNone
 Parallel type. More...
 
bool parallel_type_set_ = false
 Whether parallel type is set. More...
 
std::shared_ptr< base::Paramparam_
 Node parameters. More...
 
std::vector< std::string > required_params_
 Required parameter list. More...
 
size_t run_size_ = 0
 Run count. More...
 
std::string source_
 Source information. More...
 
std::atomic< bool > stop_ {false}
 Stop flag. More...
 
device::Streamstream_ = nullptr
 Compute stream pointer. More...
 
bool traced_ = false
 Whether traced. More...
 
std::vector< std::string > ui_params_
 UI parameter list. More...
 
std::string version_ = "1.0.0"
 Version number. More...
 

Detailed Description

Directed Acyclic Graph Node.

Graph class inherits from Node class, representing a directed acyclic graph (DAG) It can contain multiple nodes and edges to build complex computation graphs

Definition at line 31 of file graph.h.

Constructor & Destructor Documentation

◆ Graph() [1/2]

nndeploy::dag::Graph::Graph ( const std::string &  name)

Constructor.

Parameters
nameName of the graph

◆ Graph() [2/2]

nndeploy::dag::Graph::Graph ( const std::string &  name,
std::vector< Edge * >  inputs,
std::vector< Edge * >  outputs 
)

Constructor.

Parameters
nameName of the graph
inputsList of input edges
outputsList of output edges

◆ ~Graph()

virtual nndeploy::dag::Graph::~Graph ( )
virtual

Destructor.

Member Function Documentation

◆ addAudioUrl()

base::Status nndeploy::dag::Graph::addAudioUrl ( const std::string &  url)

Add audio URL.

Parameters
urlURL path of the audio file
Returns
Operation status

◆ addEdge()

EdgeWrapper* nndeploy::dag::Graph::addEdge ( Edge edge,
bool  is_external = true 
)

Add edge to graph.

Parameters
edgeEdge pointer to add
is_externalWhether it's an external edge, default is true
Returns
Edge wrapper pointer

◆ addEdgeSharedPtr()

EdgeWrapper* nndeploy::dag::Graph::addEdgeSharedPtr ( std::shared_ptr< Edge edge)

Add edge to graph (shared pointer version)

Parameters
edgeEdge shared pointer to add
Returns
Edge wrapper pointer

◆ addImageUrl()

base::Status nndeploy::dag::Graph::addImageUrl ( const std::string &  url)

Add image URL.

Parameters
urlURL path of the image file
Returns
Operation status

◆ addModelUrl()

base::Status nndeploy::dag::Graph::addModelUrl ( const std::string &  url)

Add model URL.

Parameters
urlURL path of the model file
Returns
Operation status

◆ addNode()

base::Status nndeploy::dag::Graph::addNode ( Node node,
bool  is_external = true 
)

Add node to graph.

Parameters
nodeNode pointer to add
is_externalWhether it's an external node, default is true
Returns
Operation status

◆ addNodeInputAndOutput()

base::Status nndeploy::dag::Graph::addNodeInputAndOutput ( NodeWrapper node_wrapper,
std::vector< Edge * >  inputs,
std::vector< Edge * >  outputs 
)

Add node's input and output.

Parameters
node_wrapperNode wrapper
inputsInput edge list
outputsOutput edge list
Returns
Operation status

◆ addNodeSharedPtr()

base::Status nndeploy::dag::Graph::addNodeSharedPtr ( std::shared_ptr< Node node)

Add node to graph (shared pointer version)

Parameters
nodeNode shared pointer to add
Returns
Operation status

◆ addOtherUrl()

base::Status nndeploy::dag::Graph::addOtherUrl ( const std::string &  url)

Add other type URL.

Parameters
urlURL path of other files
Returns
Operation status

◆ addResourceWithoutState()

virtual base::Status nndeploy::dag::Graph::addResourceWithoutState ( const std::string &  key,
const base::Any &  value 
)
virtual

Add stateless global resource.

Parameters
keyResource key
valueResource value
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ addResourceWithState()

virtual base::Status nndeploy::dag::Graph::addResourceWithState ( const std::string &  key,
Edge edge 
)
virtual

Add stateful global resource.

Parameters
keyResource key
edgeResource edge pointer
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ addVideoUrl()

base::Status nndeploy::dag::Graph::addVideoUrl ( const std::string &  url)

Add video URL.

Parameters
urlURL path of the video file
Returns
Operation status

◆ connect()

base::Status nndeploy::dag::Graph::connect ( Node predecessor,
Node successor,
int  predecessor_port = 0,
int  successor_port = 0 
)

Connect two nodes.

Parameters
predecessorPredecessor node
successorSuccessor node
predecessor_portOutput port of predecessor node, default is 0
successor_portInput port of successor node, default is 0
Returns
Operation status

◆ construct()

virtual base::Status nndeploy::dag::Graph::construct ( )
protectedvirtual

Construct graph.

Returns
Operation status

◆ createEdge()

Edge* nndeploy::dag::Graph::createEdge ( const std::string &  name)

Create edge.

Parameters
nameName of the edge
Returns
Created edge pointer

◆ createEdgeSharedPtr()

std::shared_ptr<Edge> nndeploy::dag::Graph::createEdgeSharedPtr ( const std::string &  name)

Create edge (shared pointer version)

Parameters
nameName of the edge
Returns
Created edge shared pointer

◆ createInfer() [1/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const NodeDesc desc,
base::InferenceType  type 
)

Template method: Create inference node by node description.

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
descNode description object
typeInference type
Returns
Created inference node pointer

Definition at line 2473 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [2/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
const std::string &  input_name,
const std::string &  output_name 
)

Template method: Create inference node (string input/output names)

模板方法实现:创建推理节点(字符串输入输出名称)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
input_nameInput edge name
output_nameOutput edge name
Returns
Created inference node pointer

Definition at line 2001 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [3/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
const std::string &  input_name,
Edge output 
)

Template method: Create inference node (string input name, edge output)

模板方法实现:创建推理节点(字符串输入名称,边输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
input_nameInput edge name
outputOutput edge
Returns
Created inference node pointer

Definition at line 2082 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [4/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
Edge input,
const std::string &  output_name 
)

Template method: Create inference node (edge input, string output name)

模板方法实现:创建推理节点(边输入,字符串输出名称)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
inputInput edge
output_nameOutput edge name
Returns
Created inference node pointer

Definition at line 2044 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [5/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
Edge input,
Edge output 
)

Template method: Create inference node (single input single output)

模板方法实现:创建推理节点(单输入单输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
inputInput edge
outputOutput edge
Returns
Created inference node pointer

Definition at line 1967 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [6/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::initializer_list< Edge * >  inputs,
std::initializer_list< Edge * >  outputs 
)

Template method: Create inference node (initializer list inputs/outputs)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
inputsInput edge initializer list
outputsOutput edge initializer list
Returns
Created inference node pointer

Definition at line 2293 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [7/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::initializer_list< Edge * >  inputs,
std::initializer_list< std::string >  output_names 
)

Template method: Create inference node (edge initializer list input, string initializer list output names)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
inputsInput edge initializer list
output_namesOutput edge name initializer list
Returns
Created inference node pointer

Definition at line 2381 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [8/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::initializer_list< std::string >  input_names,
std::initializer_list< Edge * >  outputs 
)

Template method: Create inference node (string initializer list input names, edge initializer list outputs)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
input_namesInput edge name initializer list
outputsOutput edge initializer list
Returns
Created inference node pointer

Definition at line 2425 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [9/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::initializer_list< std::string >  input_names,
std::initializer_list< std::string >  output_names 
)

Template method: Create inference node (string initializer list input/output names)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
input_namesInput edge name initializer list
output_namesOutput edge name initializer list
Returns
Created inference node pointer

Definition at line 2329 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [10/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::vector< Edge * >  inputs,
std::vector< Edge * >  outputs 
)

Template method: Create inference node (multiple inputs/outputs)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
inputsInput edge list
outputsOutput edge list
Returns
Created inference node pointer

Definition at line 2117 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [11/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::vector< Edge * >  inputs,
std::vector< std::string >  output_names 
)

Template method: Create inference node (edge input list, string output name list)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
inputsInput edge list
output_namesOutput edge name list
Returns
Created inference node pointer

Definition at line 2205 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [12/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::vector< std::string >  input_names,
std::vector< Edge * >  outputs 
)

Template method: Create inference node (string input name list, edge output list)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
input_namesInput edge name list
outputsOutput edge list
Returns
Created inference node pointer

Definition at line 2249 of file graph.h.

Here is the call graph for this function:

◆ createInfer() [13/13]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createInfer ( const std::string &  name,
base::InferenceType  type,
std::vector< std::string >  input_names,
std::vector< std::string >  output_names 
)

Template method: Create inference node (string input/output name lists)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
typeInference type
input_namesInput edge name list
output_namesOutput edge name list
Returns
Created inference node pointer

Definition at line 2153 of file graph.h.

Here is the call graph for this function:

◆ createNode() [1/16]

Node* nndeploy::dag::Graph::createNode ( const NodeDesc desc)

Create node by node description.

Parameters
descNode description object
Returns
Created node pointer

◆ createNode() [2/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const NodeDesc desc,
Args &...  args 
)

Template method: Create node of specified type by node description.

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
descNode description object
argsConstructor parameters
Returns
Created node pointer

Definition at line 2550 of file graph.h.

Here is the call graph for this function:

◆ createNode() [3/16]

Node* nndeploy::dag::Graph::createNode ( const std::string &  key,
const std::string &  name = "" 
)

Create node by key.

Parameters
keyNode type key
nameNode name, default is empty string
Returns
Created node pointer

◆ createNode() [4/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
const std::string &  input_name,
const std::string &  output_name,
Args &...  args 
)

Template method: Create node (string input/output names)

模板方法实现:创建节点(字符串输入输出名称)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
input_nameInput edge name
output_nameOutput edge name
argsConstructor parameters
Returns
Created node pointer

Definition at line 1477 of file graph.h.

Here is the call graph for this function:

◆ createNode() [5/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
const std::string &  input_name,
Edge output,
Args &...  args 
)

Template method: Create node (string input name, edge output)

模板方法实现:创建节点(字符串输入名称,边输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
input_nameInput edge name
outputOutput edge
argsConstructor parameters
Returns
Created node pointer

Definition at line 1556 of file graph.h.

Here is the call graph for this function:

◆ createNode() [6/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
Edge input,
const std::string &  output_name,
Args &...  args 
)

Template method: Create node (edge input, string output name)

模板方法实现:创建节点(边输入,字符串输出名称)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
inputInput edge
output_nameOutput edge name
argsConstructor parameters
Returns
Created node pointer

Definition at line 1518 of file graph.h.

Here is the call graph for this function:

◆ createNode() [7/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
Edge input,
Edge output,
Args &...  args 
)

Template method: Create node (single input single output)

模板方法实现:创建节点(单输入单输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
inputInput edge
outputOutput edge
argsConstructor parameters
Returns
Created node pointer

Definition at line 1443 of file graph.h.

Here is the call graph for this function:

◆ createNode() [8/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::initializer_list< Edge * >  inputs,
std::initializer_list< Edge * >  outputs,
Args &...  args 
)

Template method: Create node (initializer list inputs/outputs)

模板方法实现:创建节点(初始化列表输入输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
inputsInput edge initializer list
outputsOutput edge initializer list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1778 of file graph.h.

Here is the call graph for this function:

◆ createNode() [9/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::initializer_list< Edge * >  inputs,
std::initializer_list< std::string >  output_names,
Args &...  args 
)

Template method: Create node (edge initializer list input, string initializer list output names)

模板方法实现:创建节点(边初始化列表输入,字符串初始化列表输出名称)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
inputsInput edge initializer list
output_namesOutput edge name initializer list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1872 of file graph.h.

Here is the call graph for this function:

◆ createNode() [10/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::initializer_list< std::string >  input_names,
std::initializer_list< Edge * >  outputs,
Args &...  args 
)

Template method: Create node (string initializer list input names, edge initializer list outputs)

模板方法实现:创建节点(字符串初始化列表输入名称,边初始化列表输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
input_namesInput edge name initializer list
outputsOutput edge initializer list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1920 of file graph.h.

Here is the call graph for this function:

◆ createNode() [11/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::initializer_list< std::string >  input_names,
std::initializer_list< std::string >  output_names,
Args &...  args 
)

Template method: Create node (string initializer list input/output names)

模板方法实现:创建节点(字符串初始化列表输入输出名称)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
input_namesInput edge name initializer list
output_namesOutput edge name initializer list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1816 of file graph.h.

Here is the call graph for this function:

◆ createNode() [12/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::vector< Edge * >  inputs,
std::vector< Edge * >  outputs,
Args &...  args 
)

Template method: Create node (multiple inputs/outputs)

模板方法实现:创建节点(多输入多输出)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
inputsInput edge list
outputsOutput edge list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1594 of file graph.h.

Here is the call graph for this function:

◆ createNode() [13/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::vector< Edge * >  inputs,
std::vector< std::string >  output_names,
Args &...  args 
)

Template method: Create node (edge input list, string output name list)

模板方法实现:创建节点(边输入列表,字符串输出名称列表)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
inputsInput edge list
output_namesOutput edge name list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1732 of file graph.h.

Here is the call graph for this function:

◆ createNode() [14/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::vector< std::string >  input_names,
std::vector< Edge * >  outputs,
Args &...  args 
)

Template method: Create node (string input name list, edge output list)

模板方法实现:创建节点(字符串输入名称列表,边输出列表)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
input_namesInput edge name list
outputsOutput edge list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1686 of file graph.h.

Here is the call graph for this function:

◆ createNode() [15/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name,
std::vector< std::string >  input_names,
std::vector< std::string >  output_names,
Args &...  args 
)

Template method: Create node (string input/output name lists)

模板方法实现:创建节点(字符串输入输出名称列表)

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name
input_namesInput edge name list
output_namesOutput edge name list
argsConstructor parameters
Returns
Created node pointer

Definition at line 1632 of file graph.h.

Here is the call graph for this function:

◆ createNode() [16/16]

template<typename T , typename... Args, typename std::enable_if< std::is_base_of< Node, T >{}, int >::type >
Node * nndeploy::dag::Graph::createNode ( const std::string &  name = "",
Args &...  args 
)

Template method: Create node of specified type.

模板方法实现:创建指定类型的节点

Template Parameters
TNode type, must inherit from Node
ArgsConstructor parameter types
Parameters
nameNode name, default is empty string
argsConstructor parameters
Returns
Created node pointer
Template Parameters
T节点类型,必须继承自Node
Args构造函数参数类型
Parameters
name节点名称
args构造函数参数
Returns
创建的节点指针

Definition at line 1420 of file graph.h.

Here is the call graph for this function:

◆ createNode4Py() [1/2]

Node* nndeploy::dag::Graph::createNode4Py ( const NodeDesc desc)

Create node for Python by node description.

Parameters
descNode description object
Returns
Created node pointer

◆ createNode4Py() [2/2]

Node* nndeploy::dag::Graph::createNode4Py ( const std::string &  key,
const std::string &  name = "" 
)

Create node for Python.

Parameters
keyNode type key
nameNode name, default is empty string
Returns
Created node pointer

◆ defaultParam()

virtual base::Status nndeploy::dag::Graph::defaultParam ( )
virtual

◆ deinit()

virtual base::Status nndeploy::dag::Graph::deinit ( )
virtual

Deinitialize graph.

Returns
Operation status

Reimplemented from nndeploy::dag::Node.

Reimplemented in nndeploy::dag::Loop, and nndeploy::dag::Condition.

◆ deleteEdge()

base::Status nndeploy::dag::Graph::deleteEdge ( Edge edge)

Delete edge from graph.

Parameters
edgeEdge pointer to delete
Returns
Operation status

◆ deleteNode()

base::Status nndeploy::dag::Graph::deleteNode ( Node node)

Delete node from graph.

Parameters
nodeNode pointer to delete
Returns
Operation status

◆ deserialize() [1/2]

virtual base::Status nndeploy::dag::Graph::deserialize ( const std::string &  json_str)
virtual

Deserialize from JSON string.

Parameters
json_strJSON string
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ deserialize() [2/2]

virtual base::Status nndeploy::dag::Graph::deserialize ( rapidjson::Value &  json)
virtual

Deserialize from JSON.

Parameters
jsonJSON value object
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

Reimplemented in nndeploy::llm::Decode, nndeploy::dag::FixedLoop, and nndeploy::dag::Condition.

◆ disconnect()

base::Status nndeploy::dag::Graph::disconnect ( Node predecessor,
Node successor,
int  predecessor_port = 0,
int  successor_port = 0 
)

Disconnect two nodes.

Parameters
predecessorPredecessor node
successorSuccessor node
predecessor_portOutput port of predecessor node, default is 0
successor_portInput port of successor node, default is 0
Returns
Operation status

◆ dump()

base::Status nndeploy::dag::Graph::dump ( std::ostream &  oss = std::cout)

Print graph information.

Parameters
ossOutput stream, default is standard output
Returns
Operation status

◆ executor()

virtual base::Status nndeploy::dag::Graph::executor ( )
protectedvirtual

Execute graph.

Returns
Operation status

Reimplemented in nndeploy::dag::Loop, and nndeploy::dag::Condition.

◆ forward() [1/3]

virtual std::vector<Edge *> nndeploy::dag::Graph::forward ( )
virtual

Forward propagation (no input version)

Returns
Output edge list

Reimplemented from nndeploy::dag::Node.

◆ forward() [2/3]

virtual std::vector<Edge *> nndeploy::dag::Graph::forward ( Edge input)
virtual

Forward propagation (single input version)

Parameters
inputInput edge
Returns
Output edge list

Reimplemented from nndeploy::dag::Node.

Reimplemented in nndeploy::llm::Prefill, and nndeploy::llm::Decode.

◆ forward() [3/3]

virtual std::vector<Edge *> nndeploy::dag::Graph::forward ( std::vector< Edge * >  inputs)
virtual

Forward propagation (multiple inputs version)

Parameters
inputsInput edge list
Returns
Output edge list

Reimplemented from nndeploy::dag::Node.

◆ getAudioUrl()

std::vector<std::string> nndeploy::dag::Graph::getAudioUrl ( ) const

Get all audio URL list.

Returns
List of audio URLs

◆ getEdge()

Edge* nndeploy::dag::Graph::getEdge ( const std::string &  name)

Get edge by name.

Parameters
nameName of the edge
Returns
Edge pointer, returns nullptr if not found

◆ getEdgeQueueDropCount()

int nndeploy::dag::Graph::getEdgeQueueDropCount ( )

Get edge queue drop count.

Returns
Number of items to drop

◆ getEdgeQueueMaxSize()

int nndeploy::dag::Graph::getEdgeQueueMaxSize ( )

Get maximum size of edge queue.

Returns
Maximum size of the queue

◆ getEdgeQueueOverflowPolicy()

base::QueueOverflowPolicy nndeploy::dag::Graph::getEdgeQueueOverflowPolicy ( )

Get edge queue overflow policy.

Returns
Overflow policy

◆ getEdgeSharedPtr()

std::shared_ptr<Edge> nndeploy::dag::Graph::getEdgeSharedPtr ( const std::string &  name)

Get edge by name (shared pointer version)

Parameters
nameName of the edge
Returns
Edge shared pointer, returns nullptr if not found

◆ getEdgeWrapper() [1/2]

EdgeWrapper* nndeploy::dag::Graph::getEdgeWrapper ( const std::string &  name)

Get edge wrapper by name.

Parameters
nameEdge name
Returns
Edge wrapper pointer

◆ getEdgeWrapper() [2/2]

EdgeWrapper* nndeploy::dag::Graph::getEdgeWrapper ( Edge edge)

Get edge wrapper.

Parameters
edgeEdge pointer
Returns
Edge wrapper pointer

◆ getExternalParam()

std::shared_ptr<base::Param> nndeploy::dag::Graph::getExternalParam ( const std::string &  key)
virtual

Get external parameter.

Parameters
keyParameter key
Returns
Parameter shared pointer, returns nullptr if not found

Reimplemented from nndeploy::dag::Node.

◆ getGraphNodeShareStream()

bool nndeploy::dag::Graph::getGraphNodeShareStream ( )

Get whether graph nodes share stream.

Returns
Flag indicating whether stream is shared

◆ getImageUrl()

std::vector<std::string> nndeploy::dag::Graph::getImageUrl ( ) const

Get all image URL list.

Returns
List of image URLs

◆ getInferNode()

Node* nndeploy::dag::Graph::getInferNode ( int  index)

Get inference node by index.

Parameters
indexInference node index
Returns
Inference node pointer

◆ getInputNode()

Node* nndeploy::dag::Graph::getInputNode ( int  index)

Get input node by index.

Parameters
indexInput node index
Returns
Input node pointer

◆ getLoopCount()

virtual int nndeploy::dag::Graph::getLoopCount ( )
virtual

Get loop count.

Returns
Number of loops

Reimplemented from nndeploy::dag::Node.

◆ getLoopCountMap()

virtual std::map<std::string, int> nndeploy::dag::Graph::getLoopCountMap ( )
virtual

Get loop count map.

Returns
Map from node name to loop count

◆ getLoopMaxFlag()

virtual bool nndeploy::dag::Graph::getLoopMaxFlag ( )
virtual

Get loop max flag.

Returns
Whether it's loop max flag

◆ getModelUrl()

std::vector<std::string> nndeploy::dag::Graph::getModelUrl ( ) const

Get all model URL list.

Returns
List of model URLs

◆ getNode() [1/2]

Node* nndeploy::dag::Graph::getNode ( const std::string &  name)

Get node by name.

Parameters
nameNode name
Returns
Node pointer, returns nullptr if not found

◆ getNode() [2/2]

Node* nndeploy::dag::Graph::getNode ( int  index)

Get node by index.

Parameters
indexNode index
Returns
Node pointer, returns nullptr if index is invalid

◆ getNodeByKey()

Node* nndeploy::dag::Graph::getNodeByKey ( const std::string &  key)

Get node by key.

Parameters
keyNode type key
Returns
Node pointer, returns nullptr if not found

◆ getNodeCount()

int nndeploy::dag::Graph::getNodeCount ( )

Get total number of nodes.

Returns
Number of nodes

◆ getNodeParam()

base::Param* nndeploy::dag::Graph::getNodeParam ( const std::string &  node_name)

Get node parameter.

Parameters
node_nameNode name
Returns
Parameter pointer, returns nullptr if not found

◆ getNodeParamSharedPtr()

std::shared_ptr<base::Param> nndeploy::dag::Graph::getNodeParamSharedPtr ( const std::string &  node_name)

Get node parameter (shared pointer version)

Parameters
node_nameNode name
Returns
Parameter shared pointer, returns nullptr if not found

◆ getNodes()

std::vector<Node *> nndeploy::dag::Graph::getNodes ( )

Get all nodes.

Returns
List of node pointers

◆ getNodesByKey()

std::vector<Node *> nndeploy::dag::Graph::getNodesByKey ( const std::string &  key)

Get all nodes matching the key.

Parameters
keyNode type key
Returns
List of matching node pointers

◆ getNodeSharedPtr()

std::shared_ptr<Node> nndeploy::dag::Graph::getNodeSharedPtr ( const std::string &  name)

Get node by name (shared pointer version)

Parameters
nameNode name
Returns
Node shared pointer, returns nullptr if not found

◆ getNodesName()

std::vector<std::string> nndeploy::dag::Graph::getNodesName ( )

Get all node names.

Returns
List of node names

◆ getNodesNameRecursive()

std::vector<std::string> nndeploy::dag::Graph::getNodesNameRecursive ( )

Recursively get all node names (including nodes in subgraphs)

Returns
List of node names

◆ getNodesRecursive()

std::vector<Node *> nndeploy::dag::Graph::getNodesRecursive ( )

Recursively get all nodes (including nodes in subgraphs)

Returns
List of node pointers

◆ getNodesRunStatus()

std::map<std::string, std::shared_ptr<RunStatus> > nndeploy::dag::Graph::getNodesRunStatus ( )

Get run status of all nodes.

Returns
Map from node name to run status

◆ getNodesRunStatusRecursive()

std::map<std::string, std::shared_ptr<RunStatus> > nndeploy::dag::Graph::getNodesRunStatusRecursive ( )

Recursively get run status of all nodes (including nodes in subgraphs)

Returns
Map from node name to run status

◆ getNodeValue()

virtual std::map<std::string, std::map<std::string, std::string> > nndeploy::dag::Graph::getNodeValue ( )
virtual

Get node value map.

Returns
Node value map in format {node_name: {key: value}}

◆ getNodeWrapper() [1/2]

NodeWrapper* nndeploy::dag::Graph::getNodeWrapper ( const std::string &  name)

Get node wrapper by name.

Parameters
nameNode name
Returns
Node wrapper pointer

◆ getNodeWrapper() [2/2]

NodeWrapper* nndeploy::dag::Graph::getNodeWrapper ( Node node)

Get node wrapper.

Parameters
nodeNode pointer
Returns
Node wrapper pointer

◆ getOtherUrl()

std::vector<std::string> nndeploy::dag::Graph::getOtherUrl ( ) const

Get all other type URL list.

Returns
List of other type URLs

◆ getOutputNode()

Node* nndeploy::dag::Graph::getOutputNode ( int  index)

Get output node by index.

Parameters
indexOutput node index
Returns
Output node pointer

◆ getResourceWithoutState()

virtual base::Any& nndeploy::dag::Graph::getResourceWithoutState ( const std::string &  key)
virtual

Get stateless global resource.

Parameters
keyResource key
Returns
Reference to resource value

Reimplemented from nndeploy::dag::Node.

◆ getResourceWithState()

virtual Edge* nndeploy::dag::Graph::getResourceWithState ( const std::string &  key)
virtual

Get stateful global resource.

Parameters
keyResource key
Returns
Resource edge pointer

Reimplemented from nndeploy::dag::Node.

◆ getUnusedNodeNames()

virtual std::set<std::string> nndeploy::dag::Graph::getUnusedNodeNames ( )
virtual

Get unused node name set.

Returns
Unused node name set

◆ getVideoUrl()

std::vector<std::string> nndeploy::dag::Graph::getVideoUrl ( ) const

Get all video URL list.

Returns
List of video URLs

◆ init()

virtual base::Status nndeploy::dag::Graph::init ( )
virtual

Initialize graph.

Returns
Operation status

Reimplemented from nndeploy::dag::Node.

Reimplemented in nndeploy::dag::Loop, and nndeploy::dag::Condition.

◆ interrupt()

virtual bool nndeploy::dag::Graph::interrupt ( )
virtual

Interrupt execution.

Returns
Whether interruption succeeded

Reimplemented from nndeploy::dag::Node.

◆ isForwardApiOk()

bool nndeploy::dag::Graph::isForwardApiOk ( )

Check if forward API is working properly.

Returns
Whether it's working properly

◆ markInputEdge()

base::Status nndeploy::dag::Graph::markInputEdge ( std::vector< Edge * >  inputs)

Mark input edges.

Parameters
inputsInput edge list
Returns
Operation status

◆ markOutputEdge()

base::Status nndeploy::dag::Graph::markOutputEdge ( std::vector< Edge * >  outputs)

Mark output edges.

Parameters
outputsOutput edge list
Returns
Operation status

◆ operator()() [1/3]

virtual std::vector<Edge *> nndeploy::dag::Graph::operator() ( )
virtual

Operator overload (no input version)

Returns
Output edge list

Reimplemented from nndeploy::dag::Node.

◆ operator()() [2/3]

virtual std::vector<Edge *> nndeploy::dag::Graph::operator() ( Edge input)
virtual

Operator overload (single input version)

Parameters
inputInput edge
Returns
Output edge list

Reimplemented from nndeploy::dag::Node.

◆ operator()() [3/3]

virtual std::vector<Edge *> nndeploy::dag::Graph::operator() ( std::vector< Edge * >  inputs)
virtual

Operator overload (multiple inputs version)

Parameters
inputsInput edge list
Returns
Output edge list

Reimplemented from nndeploy::dag::Node.

◆ removeAudioUrl()

base::Status nndeploy::dag::Graph::removeAudioUrl ( const std::string &  url)

Remove audio URL.

Parameters
urlURL path of the audio file to remove
Returns
Operation status

◆ removeImageUrl()

base::Status nndeploy::dag::Graph::removeImageUrl ( const std::string &  url)

Remove image URL.

Parameters
urlURL path of the image file to remove
Returns
Operation status

◆ removeInOutNode()

virtual void nndeploy::dag::Graph::removeInOutNode ( )
virtual

Remove input/output nodes.

◆ removeModelUrl()

base::Status nndeploy::dag::Graph::removeModelUrl ( const std::string &  url)

Remove model URL.

Parameters
urlURL path of the model file to remove
Returns
Operation status

◆ removeOtherUrl()

base::Status nndeploy::dag::Graph::removeOtherUrl ( const std::string &  url)

Remove other type URL.

Parameters
urlURL path of other files to remove
Returns
Operation status

◆ removeUnusedNodeAndEdge()

virtual base::Status nndeploy::dag::Graph::removeUnusedNodeAndEdge ( )
protectedvirtual

Remove unused nodes and edges.

Returns
Operation status

◆ removeUnusedNodeNames() [1/2]

virtual void nndeploy::dag::Graph::removeUnusedNodeNames ( const std::set< std::string > &  node_names)
virtual

Remove unused node name set.

Parameters
node_namesNode name set

◆ removeUnusedNodeNames() [2/2]

virtual void nndeploy::dag::Graph::removeUnusedNodeNames ( const std::string &  node_name)
virtual

Remove unused node name.

Parameters
node_nameNode name

◆ removeVideoUrl()

base::Status nndeploy::dag::Graph::removeVideoUrl ( const std::string &  url)

Remove video URL.

Parameters
urlURL path of the video file to remove
Returns
Operation status

◆ run()

virtual base::Status nndeploy::dag::Graph::run ( )
virtual

Run graph.

Returns
Operation status

Implements nndeploy::dag::Node.

Reimplemented in nndeploy::dag::Loop, and nndeploy::dag::Condition.

◆ serialize() [1/2]

virtual std::string nndeploy::dag::Graph::serialize ( )
virtual

Serialize to JSON string.

Returns
JSON string

Reimplemented from nndeploy::dag::Node.

Reimplemented in nndeploy::dag::Condition, and nndeploy::dag::Condition.

◆ serialize() [2/2]

virtual base::Status nndeploy::dag::Graph::serialize ( rapidjson::Value &  json,
rapidjson::Document::AllocatorType &  allocator 
)
virtual

Serialize to JSON.

Parameters
jsonJSON value object
allocatorJSON allocator
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

Reimplemented in nndeploy::llm::Decode, nndeploy::dag::FixedLoop, and nndeploy::dag::Condition.

◆ setEdgeQueueMaxSize()

base::Status nndeploy::dag::Graph::setEdgeQueueMaxSize ( int  queue_max_size)

Set maximum size of edge queue.

Parameters
queue_max_sizeMaximum size of the queue
Returns
Operation status

◆ setEdgeQueueOverflowPolicy()

base::Status nndeploy::dag::Graph::setEdgeQueueOverflowPolicy ( base::QueueOverflowPolicy  policy,
int  drop_count = 1 
)

Set edge queue overflow policy.

Parameters
policyOverflow policy
drop_countNumber of items to drop, default is 1
Returns
Operation status

◆ setExternalParam()

base::Status nndeploy::dag::Graph::setExternalParam ( const std::string &  key,
std::shared_ptr< base::Param param 
)
virtual

Set external parameter.

Parameters
keyParameter key
paramParameter shared pointer
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setGraphNodeShareStream()

void nndeploy::dag::Graph::setGraphNodeShareStream ( bool  flag)

Set whether graph nodes share stream.

Parameters
flagFlag indicating whether to share stream

◆ setInput()

virtual base::Status nndeploy::dag::Graph::setInput ( Edge input,
int  index = -1 
)
virtual

Set input edge.

Parameters
inputInput edge pointer
indexIndex position, default is -1 meaning append to end
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setInputs()

virtual base::Status nndeploy::dag::Graph::setInputs ( std::vector< Edge * >  inputs)
virtual

Set input edge list.

Parameters
inputsList of input edges
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setInputSharedPtr()

virtual base::Status nndeploy::dag::Graph::setInputSharedPtr ( std::shared_ptr< Edge input,
int  index = -1 
)
virtual

Set input edge (shared pointer version)

Parameters
inputInput edge shared pointer
indexIndex position, default is -1 meaning append to end
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setInputsSharedPtr()

virtual base::Status nndeploy::dag::Graph::setInputsSharedPtr ( std::vector< std::shared_ptr< Edge >>  inputs)
virtual

Set input edge list (shared pointer version)

Parameters
inputsList of input edge shared pointers
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setLoopCount()

virtual void nndeploy::dag::Graph::setLoopCount ( int  loop_count)
virtual

Set loop count.

Parameters
loop_countNumber of loops

Reimplemented from nndeploy::dag::Node.

◆ setLoopMaxFlag()

virtual void nndeploy::dag::Graph::setLoopMaxFlag ( bool  is_loop_max_flag)
virtual

Set loop max flag.

Parameters
is_loop_max_flagWhether it's loop max flag

◆ setNodeDesc()

base::Status nndeploy::dag::Graph::setNodeDesc ( Node node,
const NodeDesc desc 
)

Set node description.

Parameters
nodeNode pointer
descNode description object
Returns
Operation status

◆ setNodeParallelType()

base::Status nndeploy::dag::Graph::setNodeParallelType ( const std::string &  node_name,
base::ParallelType  parallel_type 
)

Set node parallel type.

Parameters
node_nameNode name
parallel_typeParallel type
Returns
Operation status

◆ setNodeParam()

base::Status nndeploy::dag::Graph::setNodeParam ( const std::string &  node_name,
base::Param param 
)

Set node parameter.

Parameters
node_nameNode name
paramParameter pointer
Returns
Operation status

◆ setNodeParamSharedPtr()

base::Status nndeploy::dag::Graph::setNodeParamSharedPtr ( const std::string &  node_name,
std::shared_ptr< base::Param param 
)

Set node parameter (shared pointer version)

Parameters
node_nameNode name
paramParameter shared pointer
Returns
Operation status

◆ setNodeValue() [1/3]

virtual void nndeploy::dag::Graph::setNodeValue ( const std::string &  node_name,
const std::string &  key,
const std::string &  value 
)
virtual

Set node value.

Parameters
node_nameNode name
keyKey
valueValue

◆ setNodeValue() [2/3]

virtual void nndeploy::dag::Graph::setNodeValue ( const std::string &  node_value_str)
virtual

Set node value (string format)

Parameters
node_value_strNode value string in format "node_name:key:value"

◆ setNodeValue() [3/3]

virtual void nndeploy::dag::Graph::setNodeValue ( std::map< std::string, std::map< std::string, std::string >>  node_value_map)
virtual

Set node value map.

Parameters
node_value_mapNode value map in format {node_name: {key: value}}

◆ setOutput()

virtual base::Status nndeploy::dag::Graph::setOutput ( Edge output,
int  index = -1 
)
virtual

Set output edge.

Parameters
outputOutput edge pointer
indexIndex position, default is -1 meaning append to end
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setOutputs()

virtual base::Status nndeploy::dag::Graph::setOutputs ( std::vector< Edge * >  outputs)
virtual

Set output edge list.

Parameters
outputsList of output edges
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setOutputSharedPtr()

virtual base::Status nndeploy::dag::Graph::setOutputSharedPtr ( std::shared_ptr< Edge output,
int  index = -1 
)
virtual

Set output edge (shared pointer version)

Parameters
outputOutput edge shared pointer
indexIndex position, default is -1 meaning append to end
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setOutputsSharedPtr()

virtual base::Status nndeploy::dag::Graph::setOutputsSharedPtr ( std::vector< std::shared_ptr< Edge >>  outputs)
virtual

Set output edge list (shared pointer version)

Parameters
outputsList of output edge shared pointers
Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ setTraceFlag()

virtual void nndeploy::dag::Graph::setTraceFlag ( bool  flag)
virtual

Set trace flag.

Parameters
flagWhether to enable tracing

Reimplemented from nndeploy::dag::Node.

◆ setUnusedNodeNames() [1/2]

virtual void nndeploy::dag::Graph::setUnusedNodeNames ( const std::set< std::string > &  node_names)
virtual

Set unused node name set.

Parameters
node_namesNode name set

◆ setUnusedNodeNames() [2/2]

virtual void nndeploy::dag::Graph::setUnusedNodeNames ( const std::string &  node_name)
virtual

Set unused node name.

Parameters
node_nameNode name

◆ synchronize()

virtual bool nndeploy::dag::Graph::synchronize ( )
virtual

Synchronize execution.

Returns
Whether synchronization succeeded

Reimplemented from nndeploy::dag::Node.

◆ toStaticGraph()

virtual base::Status nndeploy::dag::Graph::toStaticGraph ( )
virtual

Convert to static graph.

Returns
Operation status

Reimplemented from nndeploy::dag::Node.

◆ trace() [1/3]

std::vector<Edge *> nndeploy::dag::Graph::trace ( )

Trace execution (no input version)

Returns
Output edge list

◆ trace() [2/3]

std::vector<Edge *> nndeploy::dag::Graph::trace ( Edge input)

Trace execution (single input version)

Parameters
inputInput edge
Returns
Output edge list

◆ trace() [3/3]

std::vector<Edge *> nndeploy::dag::Graph::trace ( std::vector< Edge * >  inputs)

Trace execution (multiple inputs version)

Parameters
inputsInput edge list
Returns
Output edge list

◆ updateNodeIO()

base::Status nndeploy::dag::Graph::updateNodeIO ( Node node,
std::vector< Edge * >  inputs,
std::vector< Edge * >  outputs 
)

Update node's input and output.

Parameters
nodeNode pointer
inputsNew input edge list
outputsNew output edge list
Returns
Operation status

◆ updteEdge()

base::Status nndeploy::dag::Graph::updteEdge ( EdgeWrapper edge_wrapper,
Edge edge,
bool  is_external = true 
)

Update edge.

Parameters
edge_wrapperEdge wrapper pointer
edgeNew edge pointer
is_externalWhether it's an external edge, default is true
Returns
Operation status

Member Data Documentation

◆ audio_url_

std::vector<std::string> nndeploy::dag::Graph::audio_url_
protected

Audio URL list.

Definition at line 1360 of file graph.h.

◆ edge_repository_

std::vector<EdgeWrapper *> nndeploy::dag::Graph::edge_repository_
protected

Edge repository.

Definition at line 1365 of file graph.h.

◆ executor_

std::shared_ptr<Executor> nndeploy::dag::Graph::executor_
protected

Executor.

Definition at line 1372 of file graph.h.

◆ external_param_repository_

std::map<std::string, std::shared_ptr<base::Param> > nndeploy::dag::Graph::external_param_repository_
protected

External parameter repository.

Definition at line 1378 of file graph.h.

◆ image_url_

std::vector<std::string> nndeploy::dag::Graph::image_url_
protected

Image URL list.

Definition at line 1358 of file graph.h.

◆ is_forward_api_ok_

bool nndeploy::dag::Graph::is_forward_api_ok_ = true
protected

Whether forward API is working properly.

Definition at line 1380 of file graph.h.

◆ is_graph_node_share_stream_

bool nndeploy::dag::Graph::is_graph_node_share_stream_ = true
protected

Whether graph nodes share stream.

Definition at line 1364 of file graph.h.

◆ is_loop_max_flag_

bool nndeploy::dag::Graph::is_loop_max_flag_ = true
protected

Whether it's loop max flag.

Definition at line 1379 of file graph.h.

◆ is_remove_in_out_node_

bool nndeploy::dag::Graph::is_remove_in_out_node_ = false
protected

Whether to remove input/output nodes.

Definition at line 1382 of file graph.h.

◆ model_url_

std::vector<std::string> nndeploy::dag::Graph::model_url_
protected

Model URL list.

Definition at line 1361 of file graph.h.

◆ node_repository_

std::vector<NodeWrapper *> nndeploy::dag::Graph::node_repository_
protected

Node repository.

Definition at line 1366 of file graph.h.

◆ node_value_map_

std::map<std::string, std::map<std::string, std::string> > nndeploy::dag::Graph::node_value_map_
protected

Definition at line 1393 of file graph.h.

◆ other_url_

std::vector<std::string> nndeploy::dag::Graph::other_url_
protected

Other URL list.

Definition at line 1362 of file graph.h.

◆ queue_drop_count_

int nndeploy::dag::Graph::queue_drop_count_ = 1
protected

Queue drop count.

Definition at line 1376 of file graph.h.

◆ queue_max_size_

int nndeploy::dag::Graph::queue_max_size_ = 16
protected

Queue maximum size.

Definition at line 1373 of file graph.h.

◆ queue_overflow_policy_

base::QueueOverflowPolicy nndeploy::dag::Graph::queue_overflow_policy_
protected
Initial value:

Queue overflow policy.

Definition at line 1374 of file graph.h.

◆ resource_with_state_

std::map<std::string, Edge *> nndeploy::dag::Graph::resource_with_state_
protected

Global resources (stateful)

Used to store global resources For example, history_tokens needed in the sample stage

Definition at line 1407 of file graph.h.

◆ resource_without_state_

std::map<std::string, base::Any> nndeploy::dag::Graph::resource_without_state_
protected

Global resources (stateless)

Used to store global resources For example, tokenizer_encode and tokenizer_decode stages can share the same tokenizer_cpp

Definition at line 1400 of file graph.h.

◆ run_node_repository_

std::vector<NodeWrapper *> nndeploy::dag::Graph::run_node_repository_
protected

Run node repository.

Definition at line 1367 of file graph.h.

◆ shared_edge_repository_

std::vector<std::shared_ptr<Edge> > nndeploy::dag::Graph::shared_edge_repository_
protected

Shared edge repository.

Definition at line 1368 of file graph.h.

◆ shared_node_repository_

std::vector<std::shared_ptr<Node> > nndeploy::dag::Graph::shared_node_repository_
protected

Shared node repository.

Definition at line 1369 of file graph.h.

◆ unused_node_names_

std::set<std::string> nndeploy::dag::Graph::unused_node_names_
protected

Unused node name set.

Definition at line 1383 of file graph.h.

◆ used_edge_names_

std::set<std::string> nndeploy::dag::Graph::used_edge_names_
protected

Used edge name set.

Definition at line 1371 of file graph.h.

◆ used_node_names_

std::set<std::string> nndeploy::dag::Graph::used_node_names_
protected

Used node name set.

Definition at line 1370 of file graph.h.

◆ video_url_

std::vector<std::string> nndeploy::dag::Graph::video_url_
protected

Video URL list.

Definition at line 1359 of file graph.h.


The documentation for this class was generated from the following file: