MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
plugin.h File Reference
#include <compare>
#include <fstream>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <tuple>
#include <absl/container/flat_hash_map.h>
#include "mim/config.h"
#include "mim/def.h"
Include dependency graph for plugin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mim::PluginArg
 One -X <plugin>:<arg> a Plugin understands; see Arguments. More...
struct  mim::PluginEnv
 One environment variable a Plugin reads; see Environment Variables. More...
class  mim::Out
 A file name from the command line and the stream to write to;. More...
struct  mim::Version
struct  mim::Plugin
 Basic info and registration function pointer to be returned from a specific plugin. More...
struct  mim::Annex
 Holds info about an entity defined within a Plugin (called Annex). More...

Namespaces

namespace  mim

Macros

#define MIM_VERSION   Version { MIM_VER_MAJOR, MIM_VER_MINOR, MIM_VER_SUFFIX, MIM_GIT_HASH }

Functions

Plugin Argument Lookup

Picks the -X <plugin>:<arg> strings of Driver::args / Phase::args apart.

Each helper matches any of keys - arg_value(args(), "o", "output") - and the last occurrence wins.

template<class... Keys>
std::optional< std::string_view > mim::arg_value (fe::View< std::string > args, Keys... keys)
 Value of <key>=<value>; std::nullopt if none of keys carries one.
std::optional< bool > mim::arg_bool (fe::View< std::string > args, std::initializer_list< std::string_view > on, std::initializer_list< std::string_view > off)
 An on key ↦ true, an off key ↦ false; std::nullopt if neither occurs.
template<class... Keys>
bool mim::arg_flag (fe::View< std::string > args, Keys... keys)
 Whether any of keys occurs.

Plugin Interface

See also
Plugin
using mim::Normalizers = absl::flat_hash_map<flags_t, NormalizeFn>
using mim::Flags2Phases = absl::flat_hash_map<flags_t, std::function<std::unique_ptr<Phase>(World&)>>
 Maps an axiom of a Phase to a function that creates one.
mim::Plugin mim::mim_get_plugin ()

Class Documentation

◆ mim::PluginArg

struct mim::PluginArg

One -X <plugin>:<arg> a Plugin understands; see Arguments.

A Plugin declares these next to the code that picks them apart, so that mim -p <plugin> -h can list them.

Definition at line 34 of file plugin.h.

Class Members
const char * descr What it does; one sentence, Markdown.
const char * syntax How to spell the argument, e.g. "o=<file>, output=<file>".

◆ mim::PluginEnv

struct mim::PluginEnv

One environment variable a Plugin reads; see Environment Variables.

A Plugin declares these next to the code that reads them, so that mim -p <plugin> -h can list them.

Definition at line 41 of file plugin.h.

Class Members
const char * descr What it does; one sentence, Markdown.
const char * name Name of the variable, e.g. "CUDA_HOME".

Macro Definition Documentation

◆ MIM_VERSION

#define MIM_VERSION   Version { MIM_VER_MAJOR, MIM_VER_MINOR, MIM_VER_SUFFIX, MIM_GIT_HASH }

Definition at line 149 of file plugin.h.

Referenced by mim::Driver::Driver(), and mim_get_plugin().