Oncaphillis::Ligh++pd

lighttpd::module_fptr Class Reference

#include <src/ligh++pd/module_fptr.h>


Detailed Description

A collection of conditional function pointers.

This should never be used directly but represents a set of helpers for moudule_adapter.

This is a huge bunch of template magic for which the documentation would be rather boring to read. urthermore it's really not intndet to be used directly all the usefull stuff happens in lighttpd::module_adapter.

The basic concept works as follows:

For each public member function a valid module might want to define the module_fptr class defines an internal templated class of the same name which acccepts a module type as a template argument.

This struct defines a pubic pointer to a static non-member function this pointer named "ptr" is either NULL or refers to a function which calls the corresponding member function of a module object with a valid this argument whenever the public member function is defined within the module.

      extern const char myName[] = "mod_hello";

      class myModule : public module_base<myName> {
         result_t handle_uri_clean(Server &s,Connection &c) {
          ...
         };
      };
      
      int main() {

       std::cerr << std:hex << (long) module_fptr::handle_joblist<myModule>::ptr
                 << " "
                 << std:hex << (long) module_fptr::handle_uri_clean<myModule>::ptr
                 << std::endl;

This sould print out a NULL pointer and a non-NULL value since myModule defines a valid handle_uri_clean(Server &,Connection &) method whereas there is no handle_joblist method.

Evenif we would define void handle_joblist it still would NULL since the full signature of the member function (returning result_t and accepting Server and Connection refs) has to fit.

This way it is possible to only define those module methods we're really interested in all the rest will result in NULL pointers.

But ... as I said all this magic is supposed to be hidden within the module_adapter class.

See also:
module_adapter, module_traits::has_function

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

Generated by  doxygen
© 2008; Dr. Sebastian Kloska ( Oncaphillis )
Powered by: [?]