| chigraph master Systems programming language written for beginners in LLVM

Public Member Functions | List of all members
chi::ModuleCache Struct Referenceabstract

This class provides an interface for creating module caches. More...

`#include <chi/ModuleCache.hpp>`

Inheritance diagram for chi::ModuleCache:
[legend]

## Public Member Functions
| ModuleCache (Context &ctx)
| Create a module cache with a bound context.
| ModuleCache (const ModuleCache &)=delete
| ModuleCache (ModuleCache &&)=delete
virtual | ~ModuleCache ()=default
| Destructor.
virtual Result | cacheModule (const boost::filesystem::path &moduleName, llvm::Module &compiledModule, std::time_t timeAtFileRead)=0
| Cache a module. More...
virtual std::time_t | cacheUpdateTime (const boost::filesystem::path &moduleName) const =0
| Get the time that a cache was updated. More...
Context & | context () const
| Get the context this cache is bound to. More...
virtual void | invalidateCache (const boost::filesystem::path &moduleName)=0
| Inavlidate the cache, ie. More...
ModuleCache & | operator= (const ModuleCache &)=delete
ModuleCache & | operator= (ModuleCache &&)=delete
virtual std::unique_ptr< llvm::Module > | retrieveFromCache (const boost::filesystem::path &moduleName, std::time_t atLeastThisNew)=0
| Retrieve a module from the cache. More...

## Detailed Description

This class provides an interface for creating module caches.

Definition at line 16 of file ModuleCache.hpp.

## Member Function Documentation

## ◆ cacheModule()

virtual Result chi::ModuleCache::cacheModule | ( | const boost::filesystem::path & | moduleName,
|  | llvm::Module & | compiledModule,
|  | std::time_t | timeAtFileRead
| ) |  |
| pure virtual

Cache a module.

Parameters

  moduleName | The name of the module to cache

Precondition
  `!moduleName.empty()`

Parameters

  compiledModule | The IR that's been compiled from this module
  timeAtFileRead | The time to store as the cache time. Should be the time the module was read from disk

Returns
  The Result

Implemented in chi::DefaultModuleCache.

Referenced by chi::Context::compileModule(), and ModuleCache().

Here is the caller graph for this function:

## ◆ cacheUpdateTime()

virtual std::time_t chi::ModuleCache::cacheUpdateTime | ( | const boost::filesystem::path & | moduleName | ) | const
| pure virtual

Get the time that a cache was updated.

Parameters

  moduleName | The module to get the last update time for

Returns
  The time it was updated, or 0 if there is no cache

Implemented in chi::DefaultModuleCache.

Referenced by ModuleCache().

Here is the caller graph for this function:

## ◆ context()

Context& chi::ModuleCache::context | ( |  | ) | const
| inline

Get the context this cache is bound to.

Returns
  the `Context`

Definition at line 59 of file ModuleCache.hpp.

Referenced by chi::DefaultModuleCache::cachePathForModule(), and chi::DefaultModuleCache::retrieveFromCache().

Here is the caller graph for this function:

## ◆ invalidateCache()

virtual void chi::ModuleCache::invalidateCache | ( | const boost::filesystem::path & | moduleName | ) |
| pure virtual

Inavlidate the cache, ie.

delete the cache file

Parameters

  moduleName | The name of the module to invalidate

Precondition
  `!moduleName.empty()`

Implemented in chi::DefaultModuleCache.

Referenced by ModuleCache().

Here is the caller graph for this function:

## ◆ retrieveFromCache()

virtual std::unique_ptr<llvm::Module> chi::ModuleCache::retrieveFromCache | ( | const boost::filesystem::path & | moduleName,
|  | std::time_t | atLeastThisNew
| ) |  |
| pure virtual

Retrieve a module from the cache.

Parameters

  moduleName | The name of the module to retrieve

Precondition
  `!moduleName.empty()`

Parameters

  atLeastThisNew | Make sure the cache is at least as new as this

Returns
  A llvm::Module, or nullptr if no suitable cache was found

Implemented in chi::DefaultModuleCache.

Referenced by chi::Context::compileModule(), and ModuleCache().

Here is the caller graph for this function:

The documentation for this struct was generated from the following file:

- lib/core/include/chi/ModuleCache.hpp