4 #ifndef CHI_CHI_MODULE_HPP 5 #define CHI_CHI_MODULE_HPP 11 #include "chi/Support/json.hpp" 13 #include <boost/filesystem.hpp> 14 #include <boost/utility/string_view.hpp> 41 std::unique_ptr<NodeType>* toFill) = 0;
54 virtual std::vector<std::string>
typeNames()
const = 0;
61 std::string
fullName()
const {
return mFullName.generic_string(); }
83 const std::set<boost::filesystem::path>&
dependencies()
const {
return mDependencies; }
96 return mDependencies.erase(std::move(depName)) == 1;
106 mLastEditTime = newLastEditTime;
110 boost::filesystem::path mFullName;
114 std::set<boost::filesystem::path> mDependencies;
116 std::time_t mLastEditTime = 0;
120 #endif // CHI_CHI_MODULE_HPP virtual Result generateModule(llvm::Module &module)=0
Generate a llvm::Module from the module.
Forward declares all the chigraph data types.
virtual std::vector< std::string > typeNames() const =0
Get the possible DataType names.
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.
Result addDependency(boost::filesystem::path newDepFullPath)
Add a dependency to the module Loads the module from context() if it isn't already loaded...
ChiModule(Context &contextArg, boost::filesystem::path moduleFullName)
Default constructor.
virtual ~ChiModule()=default
Destructor.
virtual std::vector< std::string > nodeTypeNames() const =0
Get the possible node type names.
std::string fullName() const
Get the full name of the module.
The class that handles the loading, creation, storing, and compilation of modules It also stores a LL...
An abstract class that represents a module of code in Chigraph Can be compiled to a llvm::Module...
const std::set< boost::filesystem::path > & dependencies() const
Get the dependencies.
virtual Result addForwardDeclarations(llvm::Module &module) const =0
Adds forward declartions for the functions in this module.
void updateLastEditTime(std::time_t newLastEditTime=std::time(nullptr))
Update the last edit time, signifying that it's been edited.
boost::filesystem::path fullNamePath() const
Get the full name of the module in a path.
bool removeDependency(std::string depName)
Remove a dependency Does not unload from context.
virtual DataType typeFromName(boost::string_view name)=0
Get a DataType from the name.
The namespace where chigraph lives.
Context & context() const
Get the Context that this module belongs to.
A type of data Loose wrapper around llvm::Type*, except it knows which ChiModule it's in and it embed...
std::time_t lastEditTime() const
Get the time that this module was last edited.
std::string shortName() const
Get the short name of the module (the last bit)
The result object, used for identifiying errors with good diagnostics.