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 
10 #include <glbinding/ProcAddress.h>
11 #include <glbinding/FunctionCall.h>
12 #include <glbinding/CallbackMask.h>
13 
14 
15 namespace glbinding
16 {
17 
18 
23 class GLBINDING_API AbstractFunction
24 {
25  friend class Binding;
26 
27 public:
35  AbstractFunction(const char * name);
36 
41  virtual ~AbstractFunction();
42 
50  const char * name() const;
51 
56  void resolveAddress();
57 
65  bool isResolved() const;
66 
74  ProcAddress address() const;
75 
83  CallbackMask callbackMask() const;
84 
92  void setCallbackMask(CallbackMask mask);
93 
101  void addCallbackMask(CallbackMask mask);
102 
110  void removeCallbackMask(CallbackMask mask);
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 
160 protected:
166  struct State
167  {
172  State();
173 
175  bool initialized;
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 
251 protected:
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
std::vector< State > m_states
The list of all states.
Definition: AbstractFunction.h:254
ProcAddress address
The function pointer to the OpenGL function.
Definition: AbstractFunction.h:174
static int s_maxpos
The global maximum of states per function.
Definition: AbstractFunction.h:258
bool initialized
Whether this state is initialized or not.
Definition: AbstractFunction.h:175
The State struct represents the configuration of an OpenGL function for one thread....
Definition: AbstractFunction.h:166
void(*)() ProcAddress
The generic pointer to an OpenGL function.
Definition: ProcAddress.h:15
const char * m_name
The OpenGL API function name, including the 'gl' prefix.
Definition: AbstractFunction.h:252
GLBINDING_API void removeCallbackMask(CallbackMask mask)
Updates the callback mask of all registered OpenGL functions in the current state to exclude the pass...
A FunctionCall represents a function call of an OpenGL API function, including the parameter and retu...
Definition: FunctionCall.h:22
GLBINDING_API void setCallbackMask(CallbackMask mask)
Updates the callback mask of all registered OpenGL functions in the current state.
GLBINDING_API void addCallbackMask(CallbackMask mask)
Updates the callback mask of all registered OpenGL functions in the current state to include the pass...
CallbackMask
The CallbackMask is a bitfield to encode the states of callbacks and logging for the OpenGL API funct...
Definition: CallbackMask.h:15
CallbackMask callbackMask
The callback mask that is considered when dispatching function calls.
Definition: AbstractFunction.h:177
Contains all the classes of glbinding.
The AbstractFunction represents an OpenGL API function.
Definition: AbstractFunction.h:23
The main interface to handle additional features to OpenGL functions besides regular function calls.
Definition: Binding.h:27