![]() |
chigraph
master
Systems programming language written for beginners in LLVM
|
An abstract class that represents a module of code in Chigraph Can be compiled to a llvm::Module. More...
#include <chi/ChiModule.hpp>
Public Member Functions | |
ChiModule (Context &contextArg, boost::filesystem::path moduleFullName) | |
Default constructor. More... | |
virtual | ~ChiModule ()=default |
Destructor. | |
Result | addDependency (boost::filesystem::path newDepFullPath) |
Add a dependency to the module Loads the module from context() if it isn't already loaded. More... | |
virtual Result | addForwardDeclarations (llvm::Module &module) const =0 |
Adds forward declartions for the functions in this module. More... | |
Context & | context () const |
Get the Context that this module belongs to. 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... | |
virtual Result | generateModule (llvm::Module &module)=0 |
Generate a llvm::Module from the module. More... | |
std::time_t | lastEditTime () const |
Get the time that this module was last edited. More... | |
virtual Result | nodeTypeFromName (boost::string_view name, const nlohmann::json &jsonData, std::unique_ptr< NodeType > *toFill)=0 |
Create a node type that is in the module from the name and json. More... | |
virtual std::vector< std::string > | nodeTypeNames () const =0 |
Get the possible node type names. More... | |
bool | removeDependency (std::string depName) |
Remove a dependency Does not unload from context. More... | |
std::string | shortName () const |
Get the short name of the module (the last bit) More... | |
virtual DataType | typeFromName (boost::string_view name)=0 |
Get a DataType from the name. More... | |
virtual std::vector< std::string > | typeNames () const =0 |
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... | |
An abstract class that represents a module of code in Chigraph Can be compiled to a llvm::Module.
Definition at line 24 of file ChiModule.hpp.
chi::ChiModule::ChiModule | ( | Context & | contextArg, |
boost::filesystem::path | moduleFullName | ||
) |
Default constructor.
This is usually run by Context::loadModule
contextArg | The context to create the module insides |
moduleFullName | The full name of the module |
Definition at line 8 of file ChiModule.cpp.
Result chi::ChiModule::addDependency | ( | boost::filesystem::path | newDepFullPath | ) |
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 context(), and chi::Context::loadModule().
Referenced by dependencies(), and chi::GraphModule::GraphModule().
|
pure virtual |
Adds forward declartions for the functions in this module.
module | The module to add forward declartions to |
Implemented in chi::LangModule, and chi::GraphModule.
Referenced by context().
|
inline |
Get the Context that this module belongs to.
Definition at line 68 of file ChiModule.hpp.
References addForwardDeclarations(), and generateModule().
Referenced by addDependency(), chi::createGraphFunctionDeclarationFromJson(), chi::GraphModule::createNodeTypeFromCCode(), chi::GraphModule::generateModule(), chi::jsonToGraphStruct(), chi::LangModule::LangModule(), chi::Debugger::nodeFromFrame(), chi::GraphModule::nodeTypeFromName(), chi::GraphModule::removeFunction(), chi::GraphModule::saveToDisk(), chi::GraphModule::sourceFilePath(), chi::Debugger::start(), and chi::LangModule::typeFromName().
|
inline |
Get the dependencies.
Definition at line 83 of file ChiModule.hpp.
References addDependency().
Referenced by chi::Context::compileModule(), and chi::graphModuleToJson().
|
inline |
Get the full name of the module.
Definition at line 61 of file ChiModule.hpp.
Referenced by chi::GraphModule::addForwardDeclarations(), chi::Context::addModuleFromJson(), chi::Context::compileModule(), chi::createGraphFunctionDeclarationFromJson(), chi::FunctionCompiler::initialize(), chi::GraphModule::nodeTypeFromName(), chi::NodeType::qualifiedName(), chi::DataType::qualifiedName(), chi::GraphFunction::qualifiedName(), chi::GraphModule::removeFunction(), chi::GraphModule::sourceFilePath(), chi::validateFunctionConnectionsAreTwoWay(), chi::validateFunctionEntryType(), chi::validateFunctionExecOutputs(), and chi::validateFunctionNodeInputs().
|
inline |
Get the full name of the module in a path.
Definition at line 64 of file ChiModule.hpp.
Referenced by chi::Context::compileModule().
|
pure virtual |
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 |
Implemented in chi::LangModule, and chi::GraphModule.
Referenced by chi::Context::compileModule(), and context().
|
inline |
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().
|
pure virtual |
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 |
Implemented in chi::GraphModule, and chi::LangModule.
|
pure virtual |
Get the possible node type names.
Implemented in chi::GraphModule, and chi::LangModule.
|
inline |
Remove a dependency Does not unload from context.
depName | The name of the dependency to remove |
Definition at line 95 of file ChiModule.hpp.
|
inline |
Get the short name of the module (the last bit)
Definition at line 58 of file ChiModule.hpp.
Referenced by chi::Context::compileModule(), chi::GraphModule::pathToCSources(), and chi::validateFunction().
|
pure virtual |
Get a DataType from the name.
name | The name of the type |
Implemented in chi::GraphModule, and chi::LangModule.
Referenced by chi::Context::typeFromModule().
|
pure virtual |
Get the possible DataType names.
std::vector
of all the names of types this module has Implemented in chi::GraphModule, and chi::LangModule.
|
inline |
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(), chi::GraphModule::getOrCreateFunction(), chi::GraphFunction::getOrCreateLocalVariable(), chi::GraphModule::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(), chi::GraphModule::removeFunction(), chi::GraphFunction::removeLocalVariable(), chi::GraphFunction::removeNode(), chi::GraphModule::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().