CGRA-ME
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
AutoRegisterMapper Class Reference

Special helper for registering mappers to the default mapper registry. More...

#include <Mapper.h>

Public Member Functions

 AutoRegisterMapper (std::string mapper_id, MapperMaker maker, bool is_composite, std::string mapper_description, std::vector< ImplicitTuple< std::string, ImplicitlyToString, std::string >> required_arg_names_defaults_and_descriptions, std::vector< std::pair< std::string, std::string >> optional_arg_regexes_and_descriptions)
 Register a mapper with the default registry. See MapperRegistry::registerMapper for documentation. More...
 

Static Public Member Functions

static const MapperRegistrygetDefaultRegistry ()
 Public read-only access to the mapper registry that this class automatically adds mappers to. More...
 

Static Private Member Functions

static MapperRegistrygetDefaultMutableRegisty ()
 

Detailed Description

Special helper for registering mappers to the default mapper registry.

Simply make a static (eg. file scope) variable of this type initialized with your ID, description, maker callback, and arg specs. The mapper will then be available to choose from at the command-line. This still works if dynamic linking of shared objects is used. Be careful about static initialization order! (only use variables defined in the same file, and above the current line) At the time of writing, the default registry has the seed, max_threads, verbosity model_dump_filename and model_IIS_dump_filename common default keys.

Ex.:

AutoRegisterMapper my_arm("MyMapperName",
[](const ConfigStore& args) {
return std::make_unique<MyMapperClass>(args);
},
false, // not composite
"my mapper short description\n"
"my mapper long description is after the newline"
{ // required args. Should only use [_a-z] for consistency and avoiding regex active characters
{"max_threads", 1, ""}, // standard option
{"seed", 0, ""}, // standard option
{"verbosity", 0, ""}, // standard option
{"required_arg_1", false, "A short description"},
{"another_required_arg", "default", "Another short description"},
{"req_arg_3", "", "short desc\n"
"long desc after the newline"},
},
{ // optional arg regexes
{"my_prefix_.*", "hidden options"},
{"do_[a-z]+_faster", "do something faster"},
}
);

Definition at line 200 of file Mapper.h.

Constructor & Destructor Documentation

◆ AutoRegisterMapper()

AutoRegisterMapper::AutoRegisterMapper ( std::string  mapper_id,
MapperMaker  maker,
bool  is_composite,
std::string  mapper_description,
std::vector< ImplicitTuple< std::string, ImplicitlyToString, std::string >>  required_arg_names_defaults_and_descriptions,
std::vector< std::pair< std::string, std::string >>  optional_arg_regexes_and_descriptions 
)

Register a mapper with the default registry. See MapperRegistry::registerMapper for documentation.

Definition at line 236 of file Mapper.cpp.

Member Function Documentation

◆ getDefaultMutableRegisty()

MapperRegistry & AutoRegisterMapper::getDefaultMutableRegisty ( )
staticprivate

Definition at line 224 of file Mapper.cpp.

◆ getDefaultRegistry()

static const MapperRegistry& AutoRegisterMapper::getDefaultRegistry ( )
inlinestatic

Public read-only access to the mapper registry that this class automatically adds mappers to.

Definition at line 214 of file Mapper.h.


The documentation for this class was generated from the following files:
AutoRegisterMapper
Special helper for registering mappers to the default mapper registry.
Definition: Mapper.h:200
ConfigStore
Definition: ConfigStore.h:76