Loading...
Searching...
No Matches
by::tworker< R, T > Class Template Referenceabstract

Base worker template for processing tasks. More...

#include <tworker.hpp>

Inheritance diagram for by::tworker< R, T >:
by::typeProvidable by::clonable

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)
 
errReportgetReport ()
 
const errReportgetReport () 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 areagetArea () const BY_CONST_FUNC(_getArea()) nbool isOk() const
 
- Public Member Functions inherited from by::typeProvidable
nbool operator== (const me &rhs) const
 
nbool operator!= (const me &rhs) const
 
virtual const typegetType () const =0
 
nbool isSub (const type &it) const
 
nbool isSub (const type *it) const BY_SIDE_FUNC(isSub)
 
nbool isSub (const me &it) const
 
nbool isSub (const me *it) const BY_SIDE_FUNC(isSub)
 
nbool isSuper (const type &it) const
 
nbool isSuper (const type *it) const BY_SIDE_FUNC(isSuper)
 
nbool isSuper (const me &it) const
 
nbool isSuper (const me *it) const BY_SIDE_FUNC(isSuper)
 
template<typename T >
nint isSub () const
 
template<typename T >
nint isSuper () const
 
template<typename T >
T * cast ()
 
template<typename T >
const T * cast () const BY_CONST_FUNC(cast< T >()) virtual void *cast(const type &to)
 Safe cast to target type using type hierarchy information.
 
const void * cast (const type &to) const BY_CONST_FUNC(cast(to)) void *cast(const type *it) BY_SIDE_FUNC(cast)
 
- Public Member Functions inherited from by::clonable
virtual me * clone () const =0
 
virtual me * cloneDeep () const
 
virtual void onCloneDeep (const me &from)
 

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
 

Detailed Description

template<typename R, typename T>
class by::tworker< R, T >

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.

Work and Task

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.

errReport

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.

Log Flag

tworker has various flags for logging during work.

  • LOG_ON_EX: Leaves a one-line log when an error occurs
  • DUMP_ON_EX: Dumps the err object including callstack when an error occurs
  • GUARD: Logs when function starts and ends
  • INTERNAL: Logs all logs except errors or GUARD
  • LOG_ON_END: When work is fully completed, leaves a one-line log for all collected errors with log()
  • DUMP_ON_END: When work is fully completed, dump() all collected errors

Member Function Documentation

◆ _onEndWork()

template<typename R , typename T >
virtual void by::tworker< R, T >::_onEndWork ( )
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.

◆ _onWork()

template<typename R , typename T >
virtual R by::tworker< R, T >::_onWork ( )
protectedpure virtual

Implemented in by::parser.

◆ _prepare()

template<typename R , typename T >
virtual void by::tworker< R, T >::_prepare ( )
protectedvirtual

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.


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