glbinding  2.0.0.00e2ff521289
A C++ binding for the OpenGL API, generated using the gl.xml specification.
glbinding::Function< ReturnType, Arguments > Class Template Reference

The Function represents an OpenGL API function with additional features, including: More...

#include <glbinding/include/glbinding/Function.h>

Inheritance diagram for glbinding::Function< ReturnType, Arguments >:
glbinding::AbstractFunction

Public Types

using Signature = ReturnType(WINAPI *)(Arguments...)
 The c pointer type for a function call. More...
 
using BeforeCallback = typename CallbackType< void, Arguments... >::type
 The callback type for the before callback. More...
 
using AfterCallback = typename CallbackType< ReturnType, Arguments... >::type
 The callback type for the after callback. More...
 

Public Member Functions

 Function (const char *name)
 Constructor. More...
 
ReturnType operator() (Arguments &...arguments) const
 Executes a function call on the resolved function pointer and passes the arguments. More...
 
ReturnType call (Arguments &...arguments) const
 Executes a function call on the resolved function pointer and passes the arguments. More...
 
ReturnType directCall (Arguments...arguments) const
 Executes a function call on the resolved function pointer and passes the arguments. More...
 
void setBeforeCallback (BeforeCallback callback)
 Register a callback that is triggered before a function call to the OpenGL driver. More...
 
void clearBeforeCallback ()
 Clears any previously registered before callback. More...
 
void setAfterCallback (AfterCallback callback)
 Register a callback that is triggered after a function call to the OpenGL driver. More...
 
void clearAfterCallback ()
 Clears any previously registered after callback. More...
 
BeforeCallback beforeCallback () const
 The accessor for the beforeCallback. More...
 
AfterCallback afterCallback () const
 The accessor for the afterCallback. More...
 
- Public Member Functions inherited from glbinding::AbstractFunction
 AbstractFunction (const char *name)
 Constructor. More...
 
virtual ~AbstractFunction ()
 Destructor to guarantee correct memory deallocation of subclasses. More...
 
const char * name () const
 Name accessor. More...
 
void resolveAddress ()
 Lookup the function pointer and stores it in the current state. More...
 
bool isResolved () const
 Check for a valid function pointer in the current state. More...
 
ProcAddress address () const
 Function pointer accessor. More...
 
CallbackMask callbackMask () const
 Callback mask accessor. More...
 
void setCallbackMask (CallbackMask mask)
 Reconfigures the callback mask for the current state. More...
 
void addCallbackMask (CallbackMask mask)
 Reconfigures the callback mask for the current state in means of a bit-wise 'or' operation with the current callback mask. More...
 
void removeCallbackMask (CallbackMask mask)
 Reconfigures the callback mask for the current state in means of a bit-wise 'clear' operation of the current callback mask. More...
 
bool isEnabled (CallbackMask mask) const
 Check if all bits of the parameter are set in the currently configured callback mask of the current state. More...
 
bool isAnyEnabled (CallbackMask mask) const
 Check if any bit of the parameter is set in the currently configured callback mask of the current state. More...
 
void unresolved () const
 Triggers a call of the unresolved callback. More...
 
void before (const FunctionCall &call) const
 Triggers a call of the before callback, passing the parameters. More...
 
void after (const FunctionCall &call) const
 Triggers a call of the after callback, passing the parameters and return value. More...
 

Protected Attributes

BeforeCallback m_beforeCallback
 The currently registered before callback. More...
 
AfterCallback m_afterCallback
 The currently registered after callback. More...
 
- Protected Attributes inherited from glbinding::AbstractFunction
const char * m_name
 The OpenGL API function name, including the 'gl' prefix. More...
 
std::vector< Statem_states
 The list of all states. More...
 

Additional Inherited Members

- Protected Member Functions inherited from glbinding::AbstractFunction
bool hasState () const
 Checks for existance of the current configured state. More...
 
bool hasState (int pos) const
 Checks for existance of a state. More...
 
Statestate () const
 Current state accessor. More...
 
Statestate (int pos) const
 State accessor. More...
 
- Static Protected Member Functions inherited from glbinding::AbstractFunction
static void provideState (int pos)
 Extend the function states to include the state identified through pos. More...
 
static void neglectState (int pos)
 Reconfigures the states so that the state identified through pos is neglected. More...
 
static void setStatePos (int pos)
 Updates the currently used state. More...
 
- Static Protected Attributes inherited from glbinding::AbstractFunction
static int s_maxpos
 The global maximum of states per function. More...
 

Detailed Description

template<typename ReturnType, typename... Arguments>
class glbinding::Function< ReturnType, Arguments >

The Function represents an OpenGL API function with additional features, including:

  • callbacks,
  • direct call (omit all callbacks, logging, error checking, ...),
  • and function pointer resolving.
Parameters
ReturnTypeThe return type of the function
ArgumentsThe types of the arguments

Member Typedef Documentation

template<typename ReturnType, typename... Arguments>
using glbinding::Function< ReturnType, Arguments >::Signature = ReturnType(WINAPI *) (Arguments...)

The c pointer type for a function call.

template<typename ReturnType, typename... Arguments>
using glbinding::Function< ReturnType, Arguments >::BeforeCallback = typename CallbackType<void, Arguments...>::type

The callback type for the before callback.

template<typename ReturnType, typename... Arguments>
using glbinding::Function< ReturnType, Arguments >::AfterCallback = typename CallbackType<ReturnType, Arguments...>::type

The callback type for the after callback.

Constructor & Destructor Documentation

template<typename ReturnType , typename... Arguments>
glbinding::Function< ReturnType, Arguments >::Function ( const char *  name)

Constructor.

Parameters
[in]nameThe actual exported OpenGL API function name, including the 'gl' prefix.

References glbinding::Function< ReturnType, Arguments >::m_afterCallback, and glbinding::Function< ReturnType, Arguments >::m_beforeCallback.

Member Function Documentation

template<typename ReturnType , typename... Arguments>
ReturnType glbinding::Function< ReturnType, Arguments >::operator() ( Arguments &...  arguments) const

Executes a function call on the resolved function pointer and passes the arguments.

Parameters
[in]argumentsThe arguments for the function call
Returns
The return value. (may be void and thus, nothing)

This method respect currently activated callbacks and logging.

References glbinding::Function< ReturnType, Arguments >::call().

template<typename ReturnType , typename... Arguments>
ReturnType glbinding::Function< ReturnType, Arguments >::call ( Arguments &...  arguments) const

Executes a function call on the resolved function pointer and passes the arguments.

Parameters
[in]argumentsThe arguments for the function call
Returns
The return value. (may be void and thus, nothing)

This method respect currently activated callbacks and logging.

References glbinding::AbstractFunction::address(), glbinding::After, glbinding::Before, glbinding::AbstractFunction::isAnyEnabled(), glbinding::AbstractFunction::isEnabled(), glbinding::Logging, glbinding::Unresolved, and glbinding::AbstractFunction::unresolved().

Referenced by glbinding::Function< ReturnType, Arguments >::operator()().

template<typename ReturnType , typename... Arguments>
ReturnType glbinding::Function< ReturnType, Arguments >::directCall ( Arguments...  arguments) const

Executes a function call on the resolved function pointer and passes the arguments.

Parameters
[in]argumentsThe arguments for the function call
Returns
The return value. (may be void and thus, nothing)

This method omits all currently activated callbacks and logging.

template<typename ReturnType , typename... Arguments>
void glbinding::Function< ReturnType, Arguments >::setBeforeCallback ( BeforeCallback  callback)

Register a callback that is triggered before a function call to the OpenGL driver.

Parameters
[in]callbackThe callback to register

Keep in mind that in addition to a registered callback, the callback mask of this Function has to include the Before flag to enable the callback.

References glbinding::Function< ReturnType, Arguments >::m_beforeCallback.

template<typename ReturnType , typename... Arguments>
void glbinding::Function< ReturnType, Arguments >::clearBeforeCallback ( )

Clears any previously registered before callback.

References glbinding::Function< ReturnType, Arguments >::m_beforeCallback.

template<typename ReturnType , typename... Arguments>
void glbinding::Function< ReturnType, Arguments >::setAfterCallback ( AfterCallback  callback)

Register a callback that is triggered after a function call to the OpenGL driver.

Parameters
[in]callbackThe callback to register

Keep in mind that in addition to a registered callback, the callback mask of this Function has to include the After flag to enable the callback.

References glbinding::Function< ReturnType, Arguments >::m_afterCallback.

template<typename ReturnType , typename... Arguments>
void glbinding::Function< ReturnType, Arguments >::clearAfterCallback ( )

Clears any previously registered after callback.

References glbinding::Function< ReturnType, Arguments >::m_afterCallback.

template<typename ReturnType , typename... Arguments>
Function< ReturnType, Arguments... >::BeforeCallback glbinding::Function< ReturnType, Arguments >::beforeCallback ( ) const

The accessor for the beforeCallback.

Returns
The beforeCallback.

References glbinding::Function< ReturnType, Arguments >::m_beforeCallback.

template<typename ReturnType , typename... Arguments>
Function< ReturnType, Arguments... >::AfterCallback glbinding::Function< ReturnType, Arguments >::afterCallback ( ) const

The accessor for the afterCallback.

Returns
The afterCallback.

References glbinding::Function< ReturnType, Arguments >::m_afterCallback.

Member Data Documentation


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