glbinding  2.1.1.000000000000
A C++ binding for the OpenGL API, generated using the gl.xml specification.
AbstractFunction.h
Go to the documentation of this file.
1
2#pragma once
3
4#include <string>
5#include <set>
6#include <vector>
7
8#include <glbinding/glbinding_api.h>
9
13
14
15namespace glbinding
16{
17
18
23class GLBINDING_API AbstractFunction
24{
25 friend class Binding;
26
27public:
35 AbstractFunction(const char * name);
36
42
50 const char * name() const;
51
57
65 bool isResolved() const;
66
75
84
93
102
111
122 bool isEnabled(CallbackMask mask) const;
123
134 bool isAnyEnabled(CallbackMask mask) const;
135
140 void unresolved() const;
141
149 void before(const FunctionCall & call) const;
150
158 void after(const FunctionCall & call) const;
159
160protected:
166 struct State
167 {
173
176
178 };
179
189 bool hasState() const;
190
201 bool hasState(int pos) const;
202
210 State & state() const;
211
222 State & state(int pos) const;
223
231 static void provideState(int pos);
232
240 static void neglectState(int pos);
241
249 static void setStatePos(int pos);
250
251protected:
252 const char * m_name;
253
254 mutable std::vector<State> m_states;
255
256 // to reduce per instance hasState checks and provide/neglect states for all instances,
257 // max pos is used to provide m_states size, which is identical for all instances.
258 static int s_maxpos;
259};
260
261
262} // namespace glbinding
The AbstractFunction represents an OpenGL API function.
Definition: AbstractFunction.h:24
void unresolved() const
Triggers a call of the unresolved callback.
bool isResolved() const
Check for a valid function pointer in the current state.
void removeCallbackMask(CallbackMask mask)
Reconfigures the callback mask for the current state in means of a bit-wise 'clear' operation of the ...
void resolveAddress()
Lookup the function pointer and stores it in the current state.
const char * m_name
The OpenGL API function name, including the 'gl' prefix.
Definition: AbstractFunction.h:252
bool isAnyEnabled(CallbackMask mask) const
Check if any bit of the parameter is set in the currently configured callback mask of the current sta...
static void setStatePos(int pos)
Updates the currently used state.
static void provideState(int pos)
Extend the function states to include the state identified through pos.
ProcAddress address() const
Function pointer accessor.
State & state(int pos) const
State accessor.
CallbackMask callbackMask() const
Callback mask accessor.
State & state() const
Current state accessor.
void addCallbackMask(CallbackMask mask)
Reconfigures the callback mask for the current state in means of a bit-wise 'or' operation with the c...
bool hasState(int pos) const
Checks for existance of a state.
static int s_maxpos
The global maximum of states per function.
Definition: AbstractFunction.h:258
void before(const FunctionCall &call) const
Triggers a call of the before callback, passing the parameters.
const char * name() const
Name accessor.
AbstractFunction(const char *name)
Constructor.
bool isEnabled(CallbackMask mask) const
Check if all bits of the parameter are set in the currently configured callback mask of the current s...
bool hasState() const
Checks for existance of the current configured state.
std::vector< State > m_states
The list of all states.
Definition: AbstractFunction.h:254
static void neglectState(int pos)
Reconfigures the states so that the state identified through pos is neglected.
void setCallbackMask(CallbackMask mask)
Reconfigures the callback mask for the current state.
void after(const FunctionCall &call) const
Triggers a call of the after callback, passing the parameters and return value.
virtual ~AbstractFunction()
Destructor to guarantee correct memory deallocation of subclasses.
The main interface to handle additional features to OpenGL functions besides regular function calls.
Definition: Binding.h:28
Contains all the classes of glbinding.
void(*)() ProcAddress
The generic pointer to an OpenGL function.
Definition: ProcAddress.h:15
CallbackMask
The CallbackMask is a bitfield to encode the states of callbacks and logging for the OpenGL API funct...
Definition: CallbackMask.h:16
The State struct represents the configuration of an OpenGL function for one thread....
Definition: AbstractFunction.h:167
State()
Constructor that initializes all values with 0 / invalid.
CallbackMask callbackMask
The callback mask that is considered when dispatching function calls.
Definition: AbstractFunction.h:177
bool initialized
Whether this state is initialized or not.
Definition: AbstractFunction.h:175
ProcAddress address
The function pointer to the OpenGL function.
Definition: AbstractFunction.h:174
A FunctionCall represents a function call of an OpenGL API function, including the parameter and retu...
Definition: FunctionCall.h:23