Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ModuleFunction< FPTR > Class Template Reference

Represents a function pointer symbol in a shared object. More...

#include <symbol.h>

Inheritance diagram for ModuleFunction< FPTR >:

Inheritance graph
[legend]
Collaboration diagram for ModuleFunction< FPTR >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleFunction ()
 Create a NULL function pointer:.

 ModuleFunction (const ModuleSymbol &s)
 Create a module function pointer from a module symbol:.

 ModuleFunction (const ModuleFunction &mf)
 Copy constructor as usual.

 ~ModuleFunction ()
FPTR fptr () const
 Get the function pointer casted properly (just like ptr()):.

FPTR operator * () const
 Get the function pointer casted properly; just like fptr().


Detailed Description

template<typename FPTR>
class ModuleFunction< FPTR >

Represents a function pointer symbol in a shared object.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This class is effectively right the same as class ModuleSymbol, just that the stored pointer is of type FPTR as specified as template parameter.

Hence, it is only "wrapping some casting candy around ModuleSymbol" to avoid using casts all the time and enable you to easily put it into structures like

   struct MyModuleMethods
   {
       ModuleFunction<int(*)(double)> double_to_int;
       ModuleFunction<char*(*)()> get_version_string;
   };

Just assign the ModuleSymbol returned by SharedObject::lookup() to the corresponding ModuleFunction<>; these can then called easily:

   MyModuleMethods mmm;
   int rv = *(mmm.double_to_int)( 3.14 );
   printf("%s", *(mmm.get_version_string)() );

This is a completely "C++-safe" type (assignment & copy constructor).
See the docu for file pool.h for detailed information.

Definition at line 103 of file symbol.h.


Constructor & Destructor Documentation

template<typename FPTR>
ModuleFunction< FPTR >::ModuleFunction  )  [inline]
 

Create a NULL function pointer:.

Definition at line 107 of file symbol.h.

template<typename FPTR>
ModuleFunction< FPTR >::ModuleFunction const ModuleSymbol s  )  [inline]
 

Create a module function pointer from a module symbol:.

Definition at line 109 of file symbol.h.

template<typename FPTR>
ModuleFunction< FPTR >::ModuleFunction const ModuleFunction< FPTR > &  mf  )  [inline]
 

Copy constructor as usual.

Definition at line 111 of file symbol.h.

template<typename FPTR>
ModuleFunction< FPTR >::~ModuleFunction  )  [inline]
 

Definition at line 112 of file symbol.h.


Member Function Documentation

template<typename FPTR>
FPTR ModuleFunction< FPTR >::fptr  )  const [inline]
 

Get the function pointer casted properly (just like ptr()):.

Definition at line 115 of file symbol.h.

References ModuleSymbol::ptr().

Referenced by ModuleFunction< FPTR >::operator *().

template<typename FPTR>
FPTR ModuleFunction< FPTR >::operator *  )  const [inline]
 

Get the function pointer casted properly; just like fptr().

Definition at line 118 of file symbol.h.

References ModuleFunction< FPTR >::fptr().


The documentation for this class was generated from the following file:
Generated on Sat Feb 19 22:35:31 2005 for Ray by doxygen 1.3.5