Lumiera  0.pre.03
»edit your freedom«
LifecycleHook Class Reference

#include "include/lifecycle.h"

Description

define and register a callback for a specific lifecycle event.

The purpose of this class is to be defined as a static variable in the implementation of some subsystem (i.e. in the cpp file), providing the ctor with the pointer to a callback function. Thus the specified callback gets enrolled when the corresponding object file is loaded. The event ON_BASIC_INIT is handled specifically, firing off the referred callback function as soon as possible. All other labels are just arbitrary (string) constants and it is necessary that "someone" cares to fire off the lifecycle events at the right place. For example, lumiera-main (and the test runner) calls LifecycleHook::trigger(ON_GLOBAL_INIT) (and..SHUTDOWN)

Note
duplicate or repeated calls with the same callback are NOP

Definition at line 67 of file lifecycle.h.

Public Types

typedef void(* Hook) (void)
 

Public Member Functions

 LifecycleHook (Symbol eventLabel, Hook callbackFun)
 

Static Public Member Functions

static void add (Symbol eventLabel, Hook callbackFun)
 alternative, static interface for registering a callback
 
static void trigger (Symbol eventLabel)
 trigger lifecycle callbacks registered under the given label
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 
+ Inheritance diagram for LifecycleHook:
+ Collaboration diagram for LifecycleHook:

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