Fawkes API  Fawkes Development Version
fawkes::MainLoopAspectIniFin Class Reference

Initializer/finalizer for the MainLoopAspect. More...

#include <>>

Inheritance diagram for fawkes::MainLoopAspectIniFin:

Public Member Functions

 MainLoopAspectIniFin (MainLoopEmployer *employer, BlockedTimingExecutor *btexec)
 Constructor. More...
 
virtual void init (Thread *thread)
 Initialize thread. More...
 
virtual void finalize (Thread *thread)
 Finalize thread. More...
 
virtual bool thread_started (Thread *thread) throw ()
 Thread started successfully. More...
 
virtual bool thread_init_failed (Thread *thread) throw ()
 Thread initialization failed. More...
 
- Public Member Functions inherited from fawkes::AspectIniFin
 AspectIniFin (const char *aspect_name) __attribute__((nonnull))
 Constructor. More...
 
virtual ~AspectIniFin ()
 Virtual empty destructor. More...
 
virtual bool prepare_finalize (Thread *thread)
 Default finalize preparation. More...
 
const char * get_aspect_name () const
 Get aspect name. More...
 
- Public Member Functions inherited from fawkes::ThreadNotificationListener
virtual ~ThreadNotificationListener ()
 Virtual empty destructor. More...
 

Detailed Description

Initializer/finalizer for the MainLoopAspect.

Author
Tim Niemueller

Definition at line 40 of file mainloop.h.

Constructor & Destructor Documentation

◆ MainLoopAspectIniFin()

fawkes::MainLoopAspectIniFin::MainLoopAspectIniFin ( MainLoopEmployer employer,
BlockedTimingExecutor btexec 
)

Constructor.

Parameters
employermain loop employer to register main loop to
btexecblocked timing executor to pass to thread

Definition at line 44 of file mainloop.cpp.

Member Function Documentation

◆ finalize()

void fawkes::MainLoopAspectIniFin::finalize ( Thread thread)
virtual

Finalize thread.

The aspect for the given thread must be initialized. Use dynamic_cast to cast the thread into the expected aspect class. An exception must be thrown if this fails. If anything fails during initialization of the aspect an Exception must be thrown. This will not prevent the thread from being removed. Use prepare_finalize() to report problems that should prevent the thread from being unloaded.

Parameters
threadthread to finalize

Implements fawkes::AspectIniFin.

Definition at line 82 of file mainloop.cpp.

References fawkes::Exception::append(), fawkes::Thread::name(), and fawkes::MainLoopEmployer::set_mainloop_thread().

Referenced by thread_init_failed().

◆ init()

void fawkes::MainLoopAspectIniFin::init ( Thread thread)
virtual

Initialize thread.

The aspect for the given thread must be initialized. Use dynamic_cast to cast the thread into the expected aspect class. An exception must be thrown if this fails. If anything fails during initialization of the aspect an Exception must be thrown.

Parameters
threadthread to initialize

Implements fawkes::AspectIniFin.

Definition at line 54 of file mainloop.cpp.

References fawkes::Thread::add_notification_listener(), fawkes::Exception::append(), fawkes::MainLoopAspect::init_MainLoopAspect(), fawkes::Thread::name(), fawkes::Thread::opmode(), and fawkes::Thread::OPMODE_WAITFORWAKEUP.

◆ thread_init_failed()

bool fawkes::MainLoopAspectIniFin::thread_init_failed ( Thread thread)
throw (
)
virtual

Thread initialization failed.

This method is called by ThreadList if one of the threads in the list failed to initialize. This is not necessarily the thread that you registered the notification for. However, the argument is always the thread that you registered for, no matter which thread in the list failed.

Parameters
threadthread that you registered for
Returns
true to stay registered for further thread notifications, false to unregister.

Implements fawkes::ThreadNotificationListener.

Definition at line 121 of file mainloop.cpp.

References finalize().

◆ thread_started()

bool fawkes::MainLoopAspectIniFin::thread_started ( Thread thread)
throw (
)
virtual

Thread started successfully.

This is called by the thread itself when the thread started successfully.

Parameters
threadthread that started successfully
Returns
true to stay registered for further thread notifications, false to unregister.

Implements fawkes::ThreadNotificationListener.

Definition at line 104 of file mainloop.cpp.

References fawkes::MainLoopEmployer::set_mainloop_thread().


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