this is an AST-like representation of a function in a graph It is used for IDE-like behavior, codegen, and JSON generation.
| 21 | /// this is an AST-like representation of a function in a graph |
| 22 | /// It is used for IDE-like behavior, codegen, and JSON generation. |
| 23 | struct GraphFunction { |
| 24 | /// Construct a graph--don't call this directly use GraphModule::getorCreateFunction |
| 25 | /// \param mod The owning module |
| 26 | /// \param name The name of the function |
| 27 | /// \param dataIns The data inputs to the function |
| 28 | /// \param dataOuts The data outputs of the function |
| 29 | /// \param execIns The exec inputs to the function |
| 30 | /// \param execOuts The exec outputs to the function |
| 31 | GraphFunction(GraphModule& mod, std::string name, std::vector<NamedDataType> dataIns, |
| 32 | std::vector<NamedDataType> dataOuts, std::vector<std::string> execIns, |
| 33 | std::vector<std::string> execOuts); |
| 34 | |
| 35 | GraphFunction(const GraphFunction&) = delete; |
| 36 | GraphFunction(GraphFunction&&) = delete; |
| 37 | |
| 38 | GraphFunction& operator=(const GraphFunction&) = delete; |
| 39 | GraphFunction& operator=(GraphFunction&&) = delete; |
| 40 | |
| 41 | /// Destructor |
| 42 | ~GraphFunction() = default; |
| 43 | |
| 44 | /// \name Node Manipulation |
| 45 | /// Functions for mainpulating nodes; getting, adding |
| 46 | /// \{ |
| 47 | |
| 48 | /// Get the nodes in the function |
| 49 | /// Usually called by connectData or connectExec or GraphFunction |
| 50 | /// \return The nodes, mapped by id, value |
| 51 | std::unordered_map<boost::uuids::uuid, std::unique_ptr<NodeInstance>>& nodes() { |
| 52 | return mNodes; |
| 53 | } |
| 54 | /// \copydoc GraphFunction::nodes |
| 55 | const std::unordered_map<boost::uuids::uuid, std::unique_ptr<NodeInstance>>& nodes() const { |
| 56 | return mNodes; |
| 57 | } |
| 58 | |
| 59 | /// Get a node with a given ID |
| 60 | /// \param id The ID of the node |
| 61 | /// \return The NodeInstance, or nullptr if the ID wasn't found |
| 62 | NodeInstance* nodeByID(const boost::uuids::uuid& id) const; |
| 63 | |
| 64 | /// Gets the node with type lang:entry |
| 65 | /// returns nullptr on failure |
| 66 | /// Also returns nullptr if there are two entry nodes, which is illegal |
| 67 | /// \return the entry node |
| 68 | NodeInstance* entryNode() const noexcept; |
| 69 | |
| 70 | /// Add a node to the graph |
| 71 | /// \param[in] type The type of the node |
| 72 | /// \param[in] x The x location of the node |
| 73 | /// \param[in] y The y location of the node |
| 74 | /// \param[in] id The node ID |
| 75 | /// \param[out] toFill The nodeInstance to fill to, optional. |
| 76 | /// \return The result |
| 77 | Result insertNode(std::unique_ptr<NodeType> type, float x, float y, |
| 78 | boost::uuids::uuid id = boost::uuids::random_generator()(), |
| 79 | NodeInstance** toFill = nullptr); |
| 80 |
nothing calls this directly
no outgoing calls
no test coverage detected