#include <simple_module.h>
Inheritance diagram for SimpleModule:
Public Methods | |
SimpleModule (SuifEnv* suif_env, LString name) | |
Constructor. More... | |
virtual void | execute (suif_vector<LString>* args) = 0 |
This method should implement the function for this module. More... | |
virtual String | get_help_string (void) const |
Get a human readable help string. More... | |
virtual String | get_description (void) const |
Get a human readable help string. | |
virtual | ~SimpleModule () |
Destructor. | |
virtual Module* | clone () const |
virtual void | execute () |
virtual bool | delete_me () const |
virtual bool | parse_command_line ( TokenStream* command_line_stream ) |
virtual FileSetBlock* | get_file_set_block (void) |
Get the FileSetBlock in current SuifEnv. | |
void | check_file_set_block (void) |
Check that the current SuifEnv has a FileSetBlock. More... | |
void | check_arg_count (suif_vector<LString>* args, unsigned cnt) |
Check number of arguments. More... |
Example on how to use SimpleModule:
class MyPass : public SimpleModule { public: MyPass(SuifEnv* senv) : SimpleModule("my_pass", senv) {}; virtual void execute(suif_vector<LString>*); virtual String get_description(void) const; } extern "C" void EXPORT init_my_pass(SuifEnv* suif_env) { ModuleSubSystem* module_subsystem = suif_env->get_module_subsystem(); module_subsystem->test_and_register_module(new MyPass(suif_env)); }
The SimpleModule is designed so that it is reused in every invocation. I.e. it will not be cloned or deleted by the suifdriver.
The execute() method of Module is replace by SimpleModule::execute(), which takes a vector of strings as command line arguments. The subclass of SimpleModule is expected to define this method. This method is responsible for checking and interpreting the command line arguments.
If the command line argument consists of only "-h", or "-help", or "-?", then a string from get_description() will be printed on cerr. And the execute() method will not be called.
|
|
Destructor.
|
Check number of arguments.
args | the vector of arguments. |
cnt | the right number of arguments. |
SuifException |
if the number of arguments in args is not
exactly cnt.
|
|
Check that the current SuifEnv has a FileSetBlock.
SuifException |
if a FileSetBlock is not loaded in SuifEnv.
|
|
|
|
|
This method should implement the function for this module.
args |
command line arguments.
|
Reimplemented in ExecPass, LinkSuifPass, and MarkLibPass.
|
|
Get the FileSetBlock in current SuifEnv.
|
Get a human readable help string.
Reimplemented in ExecPass, and LinkSuifPass.
|