|  | chigraph
    master
    Systems programming language written for beginners in LLVM | 
Module that holds graph functions. More...
#include <chi/GraphModule.hpp>
 Inheritance diagram for chi::GraphModule:
 Inheritance diagram for chi::GraphModule: Collaboration diagram for chi::GraphModule:
 Collaboration diagram for chi::GraphModule:| Public Member Functions | |
| GraphModule (Context &cont, boost::filesystem::path fullName, const std::vector< boost::filesystem::path > &dependencies={}) | |
| Construct a GraphModule.  More... | |
| GraphModule (const GraphModule &)=delete | |
| GraphModule (GraphModule &&)=delete | |
| Result | addDependency (boost::filesystem::path newDepFullPath) | 
| Add a dependency to the module Loads the module from context() if it isn't already loaded.  More... | |
| Result | addForwardDeclarations (llvm::Module &module) const override | 
| Adds forward declartions for the functions in this module.  More... | |
| Context & | context () const | 
| Get the Context that this module belongs to.  More... | |
| boost::bimap< unsigned, NodeInstance * > | createLineNumberAssoc () const | 
| Create the associations from line number and function in debug info.  More... | |
| const std::set< boost::filesystem::path > & | dependencies () const | 
| Get the dependencies.  More... | |
| std::string | fullName () const | 
| Get the full name of the module.  More... | |
| boost::filesystem::path | fullNamePath () const | 
| Get the full name of the module in a path.  More... | |
| Result | generateModule (llvm::Module &module) override | 
| Generate a llvm::Module from the module.  More... | |
| std::time_t | lastEditTime () const | 
| Get the time that this module was last edited.  More... | |
| Result | nodeTypeFromName (boost::string_view name, const nlohmann::json &jsonData, std::unique_ptr< NodeType > *toFill) override | 
| Create a node type that is in the module from the name and json.  More... | |
| std::vector< std::string > | nodeTypeNames () const override | 
| Get the possible node type names.  More... | |
| GraphModule & | operator= (const GraphModule &)=delete | 
| GraphModule & | operator= (GraphModule &&)=delete | 
| bool | removeDependency (std::string depName) | 
| Remove a dependency Does not unload from context.  More... | |
| Result | saveToDisk () const | 
| Serialize to disk in the context.  More... | |
| std::string | shortName () const | 
| Get the short name of the module (the last bit)  More... | |
| boost::filesystem::path | sourceFilePath () const | 
| Get the path to the source file It's not garunteed to exist, because it could have not been saved.  More... | |
| DataType | typeFromName (boost::string_view name) override | 
| Get a DataType from the name.  More... | |
| std::vector< std::string > | typeNames () const override | 
| Get the possible DataType names.  More... | |
| void | updateLastEditTime (std::time_t newLastEditTime=std::time(nullptr)) | 
| Update the last edit time, signifying that it's been edited.  More... | |
| Function Creation and Manipulation | |
| GraphFunction * | getOrCreateFunction (std::string name, std::vector< NamedDataType > dataIns, std::vector< NamedDataType > dataOuts, std::vector< std::string > execIns, std::vector< std::string > execOuts, bool *inserted=nullptr) | 
| Create a new function if it does't already exist.  More... | |
| bool | removeFunction (boost::string_view name, bool deleteReferences=true) | 
| Remove a function from the module.  More... | |
| void | removeFunction (GraphFunction &func, bool deleteReferences=true) | 
| Remove a function from the module.  More... | |
| GraphFunction * | functionFromName (boost::string_view name) const | 
| Get a function from the name.  More... | |
| const std::vector< std::unique_ptr< GraphFunction > > & | functions () const | 
| Get functions.  More... | |
| Struct Creation and Manipulation | |
| const std::vector< std::unique_ptr< GraphStruct > > & | structs () const | 
| GraphStruct * | structFromName (boost::string_view name) const | 
| Get a struct by name.  More... | |
| GraphStruct * | getOrCreateStruct (std::string name, bool *inserted=nullptr) | 
| Create a new struct in the module.  More... | |
| bool | removeStruct (boost::string_view name) | 
| Remove a struct from the module by name.  More... | |
| void | removeStruct (GraphStruct &tyToDel) | 
| Remove a struct from the module by pointer.  More... | |
| C Support | |
| void | setCEnabled (bool newValue) | 
| Set if C support is enabled.  More... | |
| bool | cEnabled () const | 
| Gets if C support is enabled.  More... | |
| Result | createNodeTypeFromCCode (boost::string_view code, boost::string_view functionName, std::vector< std::string > clangArgs, std::unique_ptr< NodeType > *toFill) | 
| From C code, create a NodeType.  More... | |
| boost::filesystem::path | pathToCSources () const | 
| Get the path to the .c directory. It is not garunteed to exist, even if cEnabled() is true. | |
Module that holds graph functions.
Definition at line 16 of file GraphModule.hpp.
| chi::GraphModule::GraphModule | ( | Context & | cont, | 
| boost::filesystem::path | fullName, | ||
| const std::vector< boost::filesystem::path > & | dependencies = {} | ||
| ) | 
Construct a GraphModule.
| cont | The context | 
| fullName | The full name of the module | 
| dependencies | The dependencies | 
Definition at line 409 of file GraphModule.cpp.
References chi::ChiModule::addDependency().
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | inherited | 
Add a dependency to the module Loads the module from context() if it isn't already loaded.
| newDepFullPath | The dependency, full path | 
Definition at line 13 of file ChiModule.cpp.
References chi::ChiModule::context(), and chi::Context::loadModule().
Referenced by chi::ChiModule::dependencies(), and GraphModule().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | overridevirtual | 
Adds forward declartions for the functions in this module.
| module | The module to add forward declartions to | 
Implements chi::ChiModule.
Definition at line 425 of file GraphModule.cpp.
References chi::ChiModule::fullName(), and chi::mangleFunctionName().
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | inline | 
Gets if C support is enabled.
Definition at line 136 of file GraphModule.hpp.
References createNodeTypeFromCCode().
Referenced by generateModule(), chi::graphModuleToJson(), nodeTypeFromName(), and nodeTypeNames().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlineinherited | 
Get the Context that this module belongs to.
Definition at line 68 of file ChiModule.hpp.
References chi::ChiModule::addForwardDeclarations(), and chi::ChiModule::generateModule().
Referenced by chi::ChiModule::addDependency(), chi::createGraphFunctionDeclarationFromJson(), createNodeTypeFromCCode(), generateModule(), chi::jsonToGraphStruct(), chi::LangModule::LangModule(), chi::Debugger::nodeFromFrame(), nodeTypeFromName(), removeFunction(), saveToDisk(), sourceFilePath(), chi::Debugger::start(), and chi::LangModule::typeFromName().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| boost::bimap< unsigned int, NodeInstance * > chi::GraphModule::createLineNumberAssoc | ( | ) | const | 
Create the associations from line number and function in debug info.
Definition at line 794 of file GraphModule.cpp.
References functions().
Referenced by chi::FunctionCompiler::initialize(), chi::lineNumberFromNode(), and chi::Debugger::nodeFromFrame().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| Result chi::GraphModule::createNodeTypeFromCCode | ( | boost::string_view | code, | 
| boost::string_view | functionName, | ||
| std::vector< std::string > | clangArgs, | ||
| std::unique_ptr< NodeType > * | toFill | ||
| ) | 
From C code, create a NodeType.
| code | The code | 
| functionName | the function to call | 
| clangArgs | Extra arguments to pass to clang | 
| toFill | The unique_ptr to fill | 
Definition at line 866 of file GraphModule.cpp.
References chi::Result::addEntry(), chi::compileCToLLVM(), chi::ChiModule::context(), pathToCSources(), chi::stringifyLLVMType(), and chi::Context::typeFromModule().
Referenced by cEnabled().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlineinherited | 
Get the dependencies.
Definition at line 83 of file ChiModule.hpp.
References chi::ChiModule::addDependency().
Referenced by chi::Context::compileModule(), and chi::graphModuleToJson().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlineinherited | 
Get the full name of the module.
Definition at line 61 of file ChiModule.hpp.
Referenced by addForwardDeclarations(), chi::Context::addModuleFromJson(), chi::Context::compileModule(), chi::createGraphFunctionDeclarationFromJson(), chi::FunctionCompiler::initialize(), nodeTypeFromName(), chi::NodeType::qualifiedName(), chi::DataType::qualifiedName(), chi::GraphFunction::qualifiedName(), removeFunction(), sourceFilePath(), chi::validateFunctionConnectionsAreTwoWay(), chi::validateFunctionEntryType(), chi::validateFunctionExecOutputs(), and chi::validateFunctionNodeInputs().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlineinherited | 
Get the full name of the module in a path.
Definition at line 64 of file ChiModule.hpp.
Referenced by chi::Context::compileModule().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| GraphFunction * chi::GraphModule::functionFromName | ( | boost::string_view | name | ) | const | 
Get a function from the name.
| name | The name to get | 
Definition at line 598 of file GraphModule.cpp.
Referenced by getOrCreateFunction(), chi::Debugger::nodeFromFrame(), nodeTypeFromName(), and removeFunction().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inline | 
Get functions.
Definition at line 95 of file GraphModule.hpp.
References getOrCreateStruct(), removeStruct(), and structFromName().
Referenced by createLineNumberAssoc(), and chi::graphModuleToJson().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | overridevirtual | 
Generate a llvm::Module from the module.
Usually called by Context::compileModule
| module | The llvm::Module to fill into – must be already filled with forward declarations of dependencies | 
Implements chi::ChiModule.
Definition at line 435 of file GraphModule.cpp.
References cEnabled(), chi::compileCToLLVM(), chi::ChiModule::context(), and pathToCSources().
 Here is the call graph for this function:
 Here is the call graph for this function:| GraphFunction * chi::GraphModule::getOrCreateFunction | ( | std::string | name, | 
| std::vector< NamedDataType > | dataIns, | ||
| std::vector< NamedDataType > | dataOuts, | ||
| std::vector< std::string > | execIns, | ||
| std::vector< std::string > | execOuts, | ||
| bool * | inserted = nullptr | ||
| ) | 
Create a new function if it does't already exist.
| name | The name of the new function | 
| dataIns | The data inputs to the function | 
| dataOuts | The data outputs to the function | 
| execIns | The exec inputs to the function | 
| execOuts | The exec outputs to the function | 
| inserted | Pointer of a bool to fill; sets to true if it was inserted and false if it already existed | 
Definition at line 545 of file GraphModule.cpp.
References functionFromName(), and chi::ChiModule::updateLastEditTime().
Referenced by chi::createGraphFunctionDeclarationFromJson().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| GraphStruct * chi::GraphModule::getOrCreateStruct | ( | std::string | name, | 
| bool * | inserted = nullptr | ||
| ) | 
Create a new struct in the module.
| name | The name of the struct | 
| inserted | True if the struct was new, optional | 
Definition at line 824 of file GraphModule.cpp.
References structFromName(), and chi::ChiModule::updateLastEditTime().
Referenced by functions(), and chi::jsonToGraphStruct().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlineinherited | 
Get the time that this module was last edited.
std::time_t at which it was last edited Definition at line 101 of file ChiModule.hpp.
Referenced by chi::Context::compileModule().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | overridevirtual | 
Create a node type that is in the module from the name and json.
| name | The name of the node type to create | 
| jsonData | The extra JSON data for the node | 
| toFill | The NodeType object to fill | 
Implements chi::ChiModule.
Definition at line 606 of file GraphModule.cpp.
References chi::Result::addEntry(), cEnabled(), chi::ChiModule::context(), chi::ChiModule::fullName(), functionFromName(), chi::parseColonPair(), chi::parseObjectPair(), structFromName(), and chi::Context::typeFromModule().
Referenced by chi::GraphStruct::dataType(), chi::GraphFunction::renameLocalVariable(), chi::GraphFunction::retypeLocalVariable(), and chi::GraphStruct::setName().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | overridevirtual | 
Get the possible node type names.
Implements chi::ChiModule.
Definition at line 779 of file GraphModule.cpp.
References cEnabled().
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | inlineinherited | 
Remove a dependency Does not unload from context.
| depName | The name of the dependency to remove | 
Definition at line 95 of file ChiModule.hpp.
| bool chi::GraphModule::removeFunction | ( | boost::string_view | name, | 
| bool | deleteReferences = true | ||
| ) | 
Remove a function from the module.
| name | The name of the function to remove | 
| deleteReferences | should all the references in the context be deleted? | 
Definition at line 568 of file GraphModule.cpp.
References functionFromName(), and chi::ChiModule::updateLastEditTime().
 Here is the call graph for this function:
 Here is the call graph for this function:| void chi::GraphModule::removeFunction | ( | GraphFunction & | func, | 
| bool | deleteReferences = true | ||
| ) | 
Remove a function from the module.
| func | The function to remove | 
| deleteReferences | should all the references in the context be deleted? | 
Definition at line 581 of file GraphModule.cpp.
References chi::ChiModule::context(), chi::Context::findInstancesOfType(), chi::ChiModule::fullName(), chi::GraphFunction::name(), and chi::ChiModule::updateLastEditTime().
 Here is the call graph for this function:
 Here is the call graph for this function:| bool chi::GraphModule::removeStruct | ( | boost::string_view | name | ) | 
Remove a struct from the module by name.
| name | The name of the struct to remove | 
Definition at line 840 of file GraphModule.cpp.
References chi::ChiModule::updateLastEditTime().
Referenced by functions(), and removeStruct().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| void chi::GraphModule::removeStruct | ( | GraphStruct & | tyToDel | ) | 
Remove a struct from the module by pointer.
| tyToDel | Struct to delete, must be in this module | 
tyToDel->module() == this Definition at line 855 of file GraphModule.cpp.
References chi::GraphStruct::module(), chi::GraphStruct::name(), and removeStruct().
 Here is the call graph for this function:
 Here is the call graph for this function:| Result chi::GraphModule::saveToDisk | ( | ) | const | 
Serialize to disk in the context.
Definition at line 514 of file GraphModule.cpp.
References chi::Result::addEntry(), chi::ChiModule::context(), chi::graphModuleToJson(), and sourceFilePath().
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | inline | 
Set if C support is enabled.
| newValue | true to enable C support, false to disable it | 
Definition at line 132 of file GraphModule.hpp.
| 
 | inlineinherited | 
Get the short name of the module (the last bit)
Definition at line 58 of file ChiModule.hpp.
Referenced by chi::Context::compileModule(), pathToCSources(), and chi::validateFunction().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| boost::filesystem::path chi::GraphModule::sourceFilePath | ( | ) | const | 
Get the path to the source file It's not garunteed to exist, because it could have not been saved.
Definition at line 862 of file GraphModule.cpp.
References chi::ChiModule::context(), chi::ChiModule::fullName(), and chi::Context::workspacePath().
Referenced by pathToCSources(), saveToDisk(), and chi::Debugger::setBreakpoint().
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| GraphStruct * chi::GraphModule::structFromName | ( | boost::string_view | name | ) | const | 
Get a struct by name.
| name | The name of the struct | 
Definition at line 817 of file GraphModule.cpp.
Referenced by functions(), getOrCreateStruct(), nodeTypeFromName(), and typeFromName().
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | overridevirtual | 
Get a DataType from the name.
| name | The name of the type | 
Implements chi::ChiModule.
Definition at line 771 of file GraphModule.cpp.
References structFromName().
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | overridevirtual | 
Get the possible DataType names.
std::vector of all the names of types this module has Implements chi::ChiModule.
Definition at line 416 of file GraphModule.cpp.
| 
 | inlineinherited | 
Update the last edit time, signifying that it's been edited.
| newLastEditTime | The new time, or current time for default | 
Definition at line 105 of file ChiModule.hpp.
Referenced by chi::GraphFunction::addDataInput(), chi::GraphFunction::addDataOutput(), chi::GraphFunction::addExecInput(), chi::GraphFunction::addExecOutput(), chi::GraphStruct::addType(), chi::connectData(), chi::connectExec(), chi::disconnectData(), chi::disconnectExec(), getOrCreateFunction(), chi::GraphFunction::getOrCreateLocalVariable(), getOrCreateStruct(), chi::GraphFunction::getOrInsertEntryNode(), chi::GraphFunction::insertNode(), chi::Context::loadModule(), chi::GraphStruct::modifyType(), chi::GraphFunction::removeDataInput(), chi::GraphFunction::removeDataOutput(), chi::GraphFunction::removeExecInput(), chi::GraphFunction::removeExecOutput(), removeFunction(), chi::GraphFunction::removeLocalVariable(), chi::GraphFunction::removeNode(), removeStruct(), chi::GraphStruct::removeType(), chi::GraphFunction::renameDataInput(), chi::GraphFunction::renameDataOutput(), chi::GraphFunction::renameExecInput(), chi::GraphFunction::renameExecOutput(), chi::GraphFunction::renameLocalVariable(), chi::GraphFunction::retypeDataInput(), chi::GraphFunction::retypeLocalVariable(), chi::GraphStruct::setName(), chi::GraphFunction::setName(), and chi::NodeInstance::setType().
 Here is the caller graph for this function:
 Here is the caller graph for this function: