glbinding  3.3.0.0
A C++ binding for the OpenGL API, generated using the gl.xml specification.
Loading...
Searching...
No Matches
glbinding::Function< ReturnType, Arguments > Class Template Reference

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

#include <glbinding/Function.h>

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

Public Types

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

Public Member Functions

 Function (const char *name)
 Constructor.
 
ReturnType operator() (Arguments &... arguments) const
 Executes a function call on the resolved function pointer and passes the arguments.
 
ReturnType call (Arguments &... arguments) const
 Executes a function call on the resolved function pointer and passes the arguments.
 
ReturnType directCall (Arguments... arguments) const
 Executes a function call on the resolved function pointer and passes the arguments.
 
void setBeforeCallback (BeforeCallback callback)
 Register a callback that is triggered before a function call to the OpenGL driver.
 
void clearBeforeCallback ()
 Clears any previously registered before callback.
 
void setAfterCallback (AfterCallback callback)
 Register a callback that is triggered after a function call to the OpenGL driver.
 
void clearAfterCallback ()
 Clears any previously registered after callback.
 
BeforeCallback beforeCallback () const
 The accessor for the beforeCallback.
 
AfterCallback afterCallback () const
 The accessor for the afterCallback.
 
virtual bool hasState () const override
 Checks for existence of the current configured state.
 
virtual bool hasState (int pos) const override
 Checks for existence of a state.
 
virtual AbstractStatestate () const override
 Get current state.
 
virtual AbstractStatestate (int pos) const override
 Get state.
 
virtual void resizeStates (int count) override
 Resize internal cache of states.
 
- Public Member Functions inherited from glbinding::AbstractFunction
 AbstractFunction (const char *name)
 Constructor.
 
virtual ~AbstractFunction ()
 Destructor to guarantee correct memory deallocation of subclasses.
 
const char * name () const
 Get function name.
 
void resolveAddress ()
 Lookup the function pointer and stores it in the current state.
 
bool isResolved () const
 Check for a valid function pointer in the current state.
 
ProcAddress address () const
 Get function pointer.
 
CallbackMask callbackMask () const
 Get callback mask.
 
void setCallbackMask (CallbackMask mask)
 Reconfigures the callback mask for the current state.
 
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.
 
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.
 
bool isEnabled (CallbackMask mask) const
 Check if all bits of the parameter are set in the currently configured callback mask of the current state.
 
bool isAnyEnabled (CallbackMask mask) const
 Check if any bit of the parameter is set in the currently configured callback mask of the current state.
 

Protected Attributes

std::vector< Statem_states
 List of States the function is registered in.
 
BeforeCallback m_beforeCallback
 The currently registered before callback.
 
AfterCallback m_afterCallback
 The currently registered after callback.
 
- Protected Attributes inherited from glbinding::AbstractFunction
const char * m_name
 The function name, including the 'gl' prefix.
 

Friends

struct FunctionHelper< ReturnType, Arguments... >
 

Additional Inherited Members

- Static Public Member Functions inherited from glbinding::AbstractFunction
static void unresolved (const AbstractFunction *function)
 Call unresolved callback.
 
static void before (const FunctionCall &call)
 Call before callback.
 
static void after (const FunctionCall &call)
 Call after callback.
 
static void log (FunctionCall &&call)
 Call log callback.
 
static int currentPos ()
 Get index of current state.
 
static int maxPos ()
 Get highest state index currently used.
 

Detailed Description

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

The Function represents an OpenGL API function with additional features.

These features include:

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

Member Typedef Documentation

◆ Signature

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

The c pointer type for a function call.

◆ BeforeCallback

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

The callback type for the before callback.

◆ AfterCallback

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

◆ Function()

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

Member Function Documentation

◆ operator()()

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

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)
Remarks
This method respects currently activated callbacks and logging

◆ call()

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

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)
Remarks
This method respects currently activated callbacks and logging

◆ directCall()

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

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)
Remarks
This method omits all currently activated callbacks and logging

◆ setBeforeCallback()

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

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

Parameters
[in]callbackThe callback to register
Remarks
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

◆ clearBeforeCallback()

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

Clears any previously registered before callback.

◆ setAfterCallback()

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

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

Parameters
[in]callbackThe callback to register
Remarks
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

◆ clearAfterCallback()

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

Clears any previously registered after callback.

◆ beforeCallback()

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

The accessor for the beforeCallback.

Returns
The beforeCallback

Referenced by glbinding::FunctionHelper< ReturnType, Arguments >::call(), and glbinding::Function< void, gl::GLenum, gl::GLfloat >::operator()().

◆ afterCallback()

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

The accessor for the afterCallback.

Returns
The afterCallback

Referenced by glbinding::FunctionHelper< ReturnType, Arguments >::call().

◆ hasState() [1/2]

template<typename ReturnType , typename... Arguments>
bool glbinding::Function< ReturnType, Arguments >::hasState ( ) const
overridevirtual

Checks for existence of the current configured state.

Returns
true if the current state still exists, else false
Remarks
This method is usually used to detect invalid state clean up

Implements glbinding::AbstractFunction.

References glbinding::AbstractFunction::currentPos().

◆ hasState() [2/2]

template<typename ReturnType , typename... Arguments>
bool glbinding::Function< ReturnType, Arguments >::hasState ( int pos) const
overridevirtual

Checks for existence of a state.

Parameters
[in]posThe index of the state to check
Returns
true if the state exists, else false

Implements glbinding::AbstractFunction.

References glbinding::AbstractFunction::maxPos().

◆ state() [1/2]

template<typename ReturnType , typename... Arguments>
AbstractState & glbinding::Function< ReturnType, Arguments >::state ( ) const
overridevirtual

Get current state.

Returns
The current state

Implements glbinding::AbstractFunction.

References glbinding::AbstractFunction::currentPos().

◆ state() [2/2]

template<typename ReturnType , typename... Arguments>
AbstractState & glbinding::Function< ReturnType, Arguments >::state ( int pos) const
overridevirtual

Get state.

Parameters
[in]posThe index of the state
Returns
The state

Implements glbinding::AbstractFunction.

References glbinding::AbstractFunction::maxPos().

◆ resizeStates()

template<typename ReturnType , typename... Arguments>
void glbinding::Function< ReturnType, Arguments >::resizeStates ( int count)
overridevirtual

Resize internal cache of states.

Parameters
[in]countNew cache size

Implements glbinding::AbstractFunction.

Friends And Related Symbol Documentation

◆ FunctionHelper< ReturnType, Arguments... >

template<typename ReturnType , typename... Arguments>
friend struct FunctionHelper< ReturnType, Arguments... >
friend

Member Data Documentation

◆ m_states

template<typename ReturnType , typename... Arguments>
std::vector<State> glbinding::Function< ReturnType, Arguments >::m_states
mutableprotected

List of States the function is registered in.

◆ m_beforeCallback

template<typename ReturnType , typename... Arguments>
BeforeCallback glbinding::Function< ReturnType, Arguments >::m_beforeCallback
protected

The currently registered before callback.

◆ m_afterCallback

template<typename ReturnType , typename... Arguments>
AfterCallback glbinding::Function< ReturnType, Arguments >::m_afterCallback
protected

The currently registered after callback.


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