ODIN
List of all members

#include <tjstatic.h>

Inheritance diagram for StaticHandler< T >:
Inheritance graph
[legend]

Detailed Description

template<class T>
class StaticHandler< T >

This template class handles static members of all classes that must be initialised exactly once. The rationale behind this is that some of the classes posses static members on which a certain action has to be performed EXACTLY once BEFORE anything else happens with that class. The 'StaticHandler' serves as as a base class for classes that require this feature. It makes this easier by keeping track of how often the static members have been initialised so that this is done only once. The following steps must be performed to make use of the StaticHandler:

  1. Deriving the class C from the template class StaticHandler by adding 'public StaticHandler<C>' to the list of base classes
  2. Adding the static member function 'static void init_static();' to the public section of the class. This function should contain the actions that will be performed only once for the static members.
  3. Adding the static member function 'static void destroy_static();' to the public section of the class. This function should contain the actions to deallocate memory allocated by init_static()
  4. Adding the line 'bool StaticHandler<C>::staticdone=false;' to the source code of the class C

Definition at line 95 of file tjstatic.h.


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