MCPcopy Create free account
hub / github.com/chigraph/chigraph / GraphModule

Class GraphModule

libchigraph/include/chi/GraphModule.hpp:16–161  ·  view source on GitHub ↗

Module that holds graph functions

Source from the content-addressed store, hash-verified

14namespace chi {
15/// Module that holds graph functions
16struct GraphModule : public ChiModule {
17 /// Construct a GraphModule
18 /// \param cont The context
19 /// \param fullName The full name of the module
20 /// \param dependencies The dependencies
21 GraphModule(Context& cont, boost::filesystem::path fullName,
22 const std::vector<boost::filesystem::path>& dependencies = {});
23
24 // No copy or move -- pointer only
25 GraphModule(const GraphModule&) = delete;
26 GraphModule(GraphModule&&) = delete;
27 GraphModule& operator=(const GraphModule&) = delete;
28 GraphModule& operator=(GraphModule&&) = delete;
29
30 // ChiModule interface
31 ///////////////////////
32
33 Result nodeTypeFromName(boost::string_view name, const nlohmann::json& jsonData,
34 std::unique_ptr<NodeType>* toFill) override;
35
36 DataType typeFromName(boost::string_view name) override;
37 std::vector<std::string> nodeTypeNames() const override;
38
39 std::vector<std::string> typeNames() const override;
40
41 Result addForwardDeclarations(llvm::Module& module) const override;
42
43 Result generateModule(llvm::Module& module) override;
44
45 /////////////////////
46
47 /// Create the associations from line number and function in debug info
48 /// \return A bimap of function to line number
49 boost::bimap<unsigned, NodeInstance*> createLineNumberAssoc() const;
50
51 /// Serialize to disk in the context
52 /// \return The Result
53 Result saveToDisk() const;
54
55 /// Get the path to the source file
56 /// It's not garunteed to exist, because it could have not been saved
57 /// \return The path
58 boost::filesystem::path sourceFilePath() const;
59
60 /// \name Function Creation and Manipulation
61 /// \{
62
63 /// Create a new function if it does't already exist
64 /// \param name The name of the new function
65 /// \param dataIns The data inputs to the function
66 /// \param dataOuts The data outputs to the function
67 /// \param execIns The exec inputs to the function
68 /// \param execOuts The exec outputs to the function
69 /// \param inserted Pointer of a bool to fill; sets to true if it was inserted and false if it
70 /// already existed
71 /// \return The function
72 GraphFunction* getOrCreateFunction(std::string name, std::vector<NamedDataType> dataIns,
73 std::vector<NamedDataType> dataOuts,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected