Base worker template for processing tasks. More...
#include <tworker.hpp>
Public Types | |
| enum | logFlag { LOG_ON_EX = 1 , DUMP_ON_EX = 1 << 1 , GUARD = 1 << 2 , INTERNAL = 1 << 3 , LOG_ON_END = 1 << 4 , DUMP_ON_END = 1 << 5 , DEFAULT = LOG_ON_EX } |
Public Member Functions | |
| tworker (const errReport &rpt) | |
| errReport & | getReport () |
| const errReport & | getReport () const BY_CONST_FUNC(getReport()) me &setReport(errReport &rpt) |
| me & | setFlag (nint newFlag) |
| me & | addFlag (nint flag) |
| me & | delFlag (nint clear) |
| nbool | isFlag (nint flag) const |
| nint | getFlag () const |
| me & | setTask (const T &root) |
| me & | setTask (const T *it) BY_SIDE_FUNC(it |
| T * | getTask () |
| const T * | getTask () const BY_CONST_FUNC(getTask()) virtual void rel() |
| R | work () |
| const area & | getArea () const BY_CONST_FUNC(_getArea()) nbool isOk() const |
Public Attributes | |
| me setTask | it |
| me setTask * | this |
Protected Member Functions | |
| virtual void | _prepare () |
| Protected virtual method for preparation before starting the work. | |
| void | _report (baseErr *e) |
| virtual void | _onEndWork () |
| Protected virtual method called after the work is completed. | |
| virtual R | _onWork ()=0 |
| area & | _getArea () |
| void | _onEndErrReport (const errReport &rpt) const |
Friends | |
| template<typename R1 , typename T1 > | |
| struct | workerAdapter |
Base worker template for processing tasks.
tworker is optimized for performing large batch operations. It can collect errors that occur during this process with errReport and can change some operations during work by specifying various flags. Classes that perform large operations such as verifier, visitor, and parser run based on tworker.
tworker exists literally to work(). At this time, the input that is the target of the work is called task. _prepare() is called before work and _onEndWork() is called when work ends.
Since large amounts of work must be performed with deep function depth, errReport must be used to sufficiently detect errors deep in the call stack. tworker can receive an errReport object from outside through setReport(). If errReport is not allocated, dummyErrReport is used instead.
tworker has various flags for logging during work.
log()dump() all collected errors
|
protectedvirtual |
Protected virtual method called after the work is completed.
This hook allows derived classes to perform any necessary cleanup or finalization after _onWork() has finished.
Reimplemented in by::parser, and by::verifier.
Implemented in by::parser.
Protected virtual method for preparation before starting the work.
This hook allows derived classes to perform any necessary setup or initialization before _onWork() is invoked.
Reimplemented in by::starter, by::parser, by::verifier, and by::visitor.