|
LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Register Tasks. More...
#include <task-register.hh>

Public Types | |
| typedef std::list< Task const * > | tasks_list_type |
| Ordered list of tasks. | |
| typedef std::map< int, Task const * > | tasks_by_key_type |
| Associate an integer key to a task. | |
Public Member Functions | |
| const tasks_by_key_type & | task_keys_get () const |
| Access to task_keys_ (read-only) | |
Tasks registering. | |
| void | register_task (const Task &task) |
| Register task task. | |
| void | enable_task (const std::string &task_name, const char *arg=nullptr) |
| Register the task task_name for execution. | |
| int | nb_of_task_to_execute_get () |
| Return the number of tasks to execute. | |
Display TaskRegister content. | |
| std::ostream & | print_task_list (std::ostream &ostr) |
| Display registered Tasks. | |
| std::ostream & | print_task_graph (std::ostream &ostr) |
| Display task graph. | |
| std::ostream & | print_task_order (std::ostream &ostr) |
| Display registered Tasks execution order. | |
Using registered Tasks. | |
} | |
| void | execute () |
| Execute tasks, checking dependencies. | |
Time management. | |
| const misc::timer & | timer_get () const |
| Access to the tasks timer. | |
Private Types | |
| typedef std::map< const std::string, Task const * > | tasks_by_name_type |
| Associate a task name to a task. | |
Private Member Functions | |
| TaskRegister (const TaskRegister &) | |
| TaskRegister & | operator= (const TaskRegister &) |
Private Attributes | |
| tasks_by_name_type | task_list_ |
| 'string to task' map. | |
| tasks_by_key_type | task_keys_ |
| 'key to task' map. | |
| tasks_list_type | task_order_ |
| 'ordered for execution' tasks list. | |
| misc::timer | timer_ |
| Tasks timer. | |
Ctor & dtor. | |
| TaskRegister () | |
| Construct a TaskRegister. | |
| static TaskRegister & | instance () |
| Access to the unique TaskRegister. | |
Task reordering. | |
| void | resolve_dependencies (const Task &task) |
| Resolve dependencies between tasks. | |
| char * | parse_arg (int argc, char *argv[]) |
| Parse argv and determine which tasks to execute. | |
Register Tasks.
The purpose of the TaskRegister class is to collect tasks and organize their execution using their dependencies (like 'make'). For modeling details, see Design Patterns: singleton.
| typedef std::map<int, Task const*> task::TaskRegister::tasks_by_key_type |
Associate an integer key to a task.
|
private |
Associate a task name to a task.
| typedef std::list<Task const*> task::TaskRegister::tasks_list_type |
Ordered list of tasks.
|
private |
|
private |
Construct a TaskRegister.
| void task::TaskRegister::enable_task | ( | const std::string & | task_name, |
| const char * | arg = nullptr |
||
| ) |
Register the task task_name for execution.
References task::Task::arg_set(), task::Task::check(), misc::error::failure, program_name, resolve_dependencies(), task_error, task_list_, and task_order_.
Referenced by main(), task::parse_opt(), and resolve_dependencies().
| void task::TaskRegister::execute | ( | ) |
Execute tasks, checking dependencies.
References misc::timer::pop(), misc::timer::push(), task_order_, and timer_.
Referenced by main().
|
static |
Access to the unique TaskRegister.
Referenced by main(), task::parse_opt(), task::Task::Task(), task::tasks::tasks_graph(), task::tasks::tasks_list(), and task::tasks::tasks_selection().
| int task::TaskRegister::nb_of_task_to_execute_get | ( | ) |
Return the number of tasks to execute.
References task_order_.
|
private |
| char * task::TaskRegister::parse_arg | ( | int | argc, |
| char * | argv[] | ||
| ) |
Parse argv and determine which tasks to execute.
Call 'argp ()'.
References task::parse_opt(), program_args_doc, program_bug_address, program_doc, program_version, and task_list_.
Referenced by main().
| std::ostream & task::TaskRegister::print_task_graph | ( | std::ostream & | ostr | ) |
Display task graph.
References task::Task::dependencies_get(), task::Task::name_get(), and task_list_.
Referenced by task::tasks::tasks_graph().
| std::ostream & task::TaskRegister::print_task_list | ( | std::ostream & | ostr | ) |
| std::ostream & task::TaskRegister::print_task_order | ( | std::ostream & | ostr | ) |
Display registered Tasks execution order.
References task_order_.
Referenced by task::tasks::tasks_selection().
| void task::TaskRegister::register_task | ( | const Task & | task | ) |
Register task task.
References misc::error::failure, task::Task::key_get(), task::Task::name_get(), program_name, task_error, task_keys_, and task_list_.
Referenced by task::Task::Task().
|
private |
Resolve dependencies between tasks.
Resolve dependencies on tasks registered for execution. Make a depth first searh of implicit tasks graph, check cycles and build an ordered list of tasks.
References task::Task::dependencies_get(), enable_task(), misc::error::failure, misc::has(), task::Task::name_get(), program_name, task::Task::resolve_dependencies(), task_error, task_list_, and task_order_.
Referenced by enable_task().
| const TaskRegister::tasks_by_key_type & task::TaskRegister::task_keys_get | ( | ) | const |
|
inline |
|
private |
'key to task' map.
Referenced by register_task(), and task_keys_get().
|
private |
'string to task' map.
Referenced by enable_task(), parse_arg(), print_task_graph(), print_task_list(), register_task(), and resolve_dependencies().
|
private |
'ordered for execution' tasks list.
Referenced by enable_task(), execute(), nb_of_task_to_execute_get(), print_task_order(), and resolve_dependencies().
|
private |
Tasks timer.
Referenced by execute(), and timer_get().