glbinding  3.3.0.0
A C++ binding for the OpenGL API, generated using the gl.xml specification.
Loading...
Searching...
No Matches
Function.h
Go to the documentation of this file.
2#pragma once
3
4
5#include <vector>
6#include <functional>
7
8#include <glbinding/State.h>
10
11
12#ifndef WINAPI
13#ifdef SYSTEM_WINDOWS
14#define WINAPI __stdcall
15#else
16#define WINAPI
17#endif
18#endif
19
20
21namespace glbinding
22{
23
24
29template <typename ReturnType, typename... Arguments>
30struct FunctionHelper;
31
41template <typename ReturnType, typename... Arguments>
43{
44 using type = std::function<void(ReturnType, Arguments...)>;
45};
46
47
55template <typename... Arguments>
57{
58 using type = std::function<void(Arguments...)>;
59};
60
61
76template <typename ReturnType, typename... Arguments>
78{
79public:
80 friend struct FunctionHelper<ReturnType, Arguments...>;
81
83 using BeforeCallback = typename CallbackType<void, Arguments...>::type;
84 using AfterCallback = typename CallbackType<ReturnType, Arguments...>::type;
85
86public:
94 Function(const char * name);
95
109 inline ReturnType operator()(Arguments&... arguments) const;
110
124 inline ReturnType call(Arguments&... arguments) const;
125
139 inline ReturnType directCall(Arguments... arguments) const;
140
152
157 inline void clearBeforeCallback();
158
170
175 inline void clearAfterCallback();
176
184 inline BeforeCallback beforeCallback() const;
185
193 inline AfterCallback afterCallback() const;
194
195 virtual bool hasState() const override;
196 virtual bool hasState(int pos) const override;
197
198 virtual AbstractState & state() const override;
199 virtual AbstractState & state(int pos) const override;
200
201 virtual void resizeStates(int count) override;
202
203
204protected:
205 mutable std::vector<State> m_states;
206
209};
210
211
212} // namespace glbinding
213
214
215#include <glbinding/Function.inl>
#define WINAPI
Definition Function.h:16
The AbstractFunction represents an OpenGL API function by its name and entry point after dynamic addr...
Definition AbstractFunction.h:30
The State struct represents the configuration of a single OpenGL function for one thread....
Definition AbstractState.h:21
The Function represents an OpenGL API function with additional features.
Definition Function.h:78
typename CallbackType< ReturnType, Arguments... >::type AfterCallback
The callback type for the after callback.
Definition Function.h:84
AfterCallback m_afterCallback
The currently registered after callback.
Definition Function.h:208
std::vector< State > m_states
List of States the function is registered in.
Definition Function.h:205
BeforeCallback m_beforeCallback
The currently registered before callback.
Definition Function.h:207
typename CallbackType< void, Arguments... >::type BeforeCallback
The callback type for the before callback.
Definition Function.h:83
The Value class represents a printable wrapper around an OpenGL data type.
Definition Value.h:30
Contains all the classes of glbinding.
void setAfterCallback(FunctionCallback callback)
Updates the after callback that is called after the actual OpenGL function invocation.
void setBeforeCallback(FunctionCallback callback)
Updates the before callback that is called before the actual OpenGL function invocation.
FunctionCallback afterCallback()
After callback accessor.
FunctionCallback beforeCallback()
Before callback accessor.
std::function< void(Arguments...)> type
Propagate the actual callable callback type.
Definition Function.h:58
A callback signature with return type and multiple arguments.
Definition Function.h:43
std::function< void(ReturnType, Arguments...)> type
Propagate the actual callable callback type.
Definition Function.h:44
Helper struct for calling GL functions and registered callbacks.
Definition Function.inl:47