mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities::tools::tool Class Referenceabstract

Base class for command line tools. as result. More...

#include <tool.h>

Inheritance diagram for mcrl2::utilities::tools::tool:
mcrl2::utilities::tools::input_input_tool mcrl2::utilities::tools::input_output_output_tool mcrl2::utilities::tools::input_tool mcrl2::utilities::tools::xinput_tool mcrl2::utilities::tools::input_input_output_tool mcrl2::utilities::tools::input_output_tool mcrl2::utilities::tools::xinput_output_tool

Public Member Functions

 tool (const std::string &name, const std::string &author, const std::string &what_is, const std::string &tool_description, std::string known_issues="")
 Constructor.
 
virtual ~tool ()
 Destructor.
 
virtual bool run ()=0
 Run the tool. The options must be set manually.
 
const std::string & timing_filename () const
 Return the filename in which timings must be saved.
 
execution_timertimer ()
 Return reference to the timer that can be used.
 
int execute (int argc, char *argv[])
 Run the tool with the given command line options.
 

Protected Member Functions

virtual void add_options (interface_description &desc)
 Add options to an interface description.
 
virtual void parse_options (const command_line_parser &parser)
 Parse non-standard options.
 
virtual bool pre_run (int &, char **)
 Executed only if run would be executed and invoked before run.
 
virtual void check_standard_options (const command_line_parser &parser)
 Parse standard options.
 
virtual void check_positional_options (const command_line_parser &parser)
 Checks if the number of positional options is OK. By default this function handles standard options: -v, -d and -q Furthermore, it checks that all options occur at most once.
 
virtual std::string synopsis () const
 Returns the synopsis of the tool.
 

Protected Attributes

std::string m_name
 The name of the tool.
 
std::string m_author
 The name of the developer(s)
 
std::string m_what_is
 One-line "what is" description of the tool.
 
std::string m_tool_description
 The description of the tool.
 
std::string m_known_issues
 Known issues of the tool.
 
std::string m_timing_filename
 The filename to which timings must be written.
 
execution_timer m_timer
 The timer which can be used by the tools.
 
bool m_timing_enabled
 Determines whether timing output should be written.
 

Detailed Description

Base class for command line tools. as result.

Definition at line 38 of file tool.h.

Constructor & Destructor Documentation

◆ tool()

mcrl2::utilities::tools::tool::tool ( const std::string &  name,
const std::string &  author,
const std::string &  what_is,
const std::string &  tool_description,
std::string  known_issues = "" 
)
inline

Constructor.

Definition at line 146 of file tool.h.

◆ ~tool()

virtual mcrl2::utilities::tools::tool::~tool ( )
inlinevirtual

Destructor.

Definition at line 163 of file tool.h.

Member Function Documentation

◆ add_options()

virtual void mcrl2::utilities::tools::tool::add_options ( interface_description &  desc)
inlineprotectedvirtual

Add options to an interface description.

Parameters
descAn interface description

Definition at line 67 of file tool.h.

◆ check_positional_options()

virtual void mcrl2::utilities::tools::tool::check_positional_options ( const command_line_parser &  parser)
inlineprotectedvirtual

Checks if the number of positional options is OK. By default this function handles standard options: -v, -d and -q Furthermore, it checks that all options occur at most once.

Parameters
parserA command line parser

Reimplemented in mcrl2::utilities::tools::input_input_output_tool, mcrl2::utilities::tools::input_input_tool, mcrl2::utilities::tools::input_output_output_tool, mcrl2::utilities::tools::input_output_tool, mcrl2::utilities::tools::input_tool, mcrl2::utilities::tools::xinput_output_tool, and mcrl2::utilities::tools::xinput_tool.

Definition at line 132 of file tool.h.

◆ check_standard_options()

virtual void mcrl2::utilities::tools::tool::check_standard_options ( const command_line_parser &  parser)
inlineprotectedvirtual

Parse standard options.

Parameters
parserA command line parser

Definition at line 95 of file tool.h.

◆ execute()

int mcrl2::utilities::tools::tool::execute ( int  argc,
char *  argv[] 
)
inline

Run the tool with the given command line options.

Parameters
argcNumber of command line arguments
argvCommand line arguments
Returns
The execution result
Postcondition
If timing was enabled, timer().report() has been called

Definition at line 187 of file tool.h.

◆ parse_options()

virtual void mcrl2::utilities::tools::tool::parse_options ( const command_line_parser &  parser)
inlineprotectedvirtual

◆ pre_run()

virtual bool mcrl2::utilities::tools::tool::pre_run ( int &  ,
char **   
)
inlineprotectedvirtual

Executed only if run would be executed and invoked before run.

Returns
Whether run should still be executed

Definition at line 88 of file tool.h.

◆ run()

virtual bool mcrl2::utilities::tools::tool::run ( )
pure virtual

Run the tool. The options must be set manually.

Returns
True if the tool execution was successful.

◆ synopsis()

virtual std::string mcrl2::utilities::tools::tool::synopsis ( ) const
inlineprotectedvirtual

◆ timer()

execution_timer & mcrl2::utilities::tools::tool::timer ( )
inline

Return reference to the timer that can be used.

Definition at line 177 of file tool.h.

◆ timing_filename()

const std::string & mcrl2::utilities::tools::tool::timing_filename ( ) const
inline

Return the filename in which timings must be saved.

Definition at line 171 of file tool.h.

Member Data Documentation

◆ m_author

std::string mcrl2::utilities::tools::tool::m_author
protected

The name of the developer(s)

Definition at line 45 of file tool.h.

◆ m_known_issues

std::string mcrl2::utilities::tools::tool::m_known_issues
protected

Known issues of the tool.

Definition at line 54 of file tool.h.

◆ m_name

std::string mcrl2::utilities::tools::tool::m_name
protected

The name of the tool.

Definition at line 42 of file tool.h.

◆ m_timer

execution_timer mcrl2::utilities::tools::tool::m_timer
protected

The timer which can be used by the tools.

Definition at line 60 of file tool.h.

◆ m_timing_enabled

bool mcrl2::utilities::tools::tool::m_timing_enabled
protected

Determines whether timing output should be written.

Definition at line 63 of file tool.h.

◆ m_timing_filename

std::string mcrl2::utilities::tools::tool::m_timing_filename
protected

The filename to which timings must be written.

Definition at line 57 of file tool.h.

◆ m_tool_description

std::string mcrl2::utilities::tools::tool::m_tool_description
protected

The description of the tool.

Definition at line 51 of file tool.h.

◆ m_what_is

std::string mcrl2::utilities::tools::tool::m_what_is
protected

One-line "what is" description of the tool.

Definition at line 48 of file tool.h.


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