/usr/include/glbinding/AbstractFunction.h is in libglbinding-dev 2.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | #pragma once
#include <string>
#include <set>
#include <vector>
#include <glbinding/glbinding_api.h>
#include <glbinding/ProcAddress.h>
#include <glbinding/FunctionCall.h>
#include <glbinding/CallbackMask.h>
namespace glbinding
{
/**
* @brief
* The AbstractFunction represents an OpenGL API function.
*/
class GLBINDING_API AbstractFunction
{
friend class Binding; ///< For state configuration.
public:
/**
* @brief
* Constructor
*
* @param[in] name
* The actual exported OpenGL API function name, including the 'gl' prefix.
*/
AbstractFunction(const char * name);
/**
* @brief
* Destructor to guarantee correct memory deallocation of subclasses.
*/
virtual ~AbstractFunction();
/**
* @brief
* Name accessor
*
* @return
* The function name.
*/
const char * name() const;
/**
* @brief
* Lookup the function pointer and stores it in the current state.
*/
void resolveAddress();
/**
* @brief
* Check for a valid function pointer in the current state.
*
* @return
* true iff a valid function pointer is stored in the current state.
*/
bool isResolved() const;
/**
* @brief
* Function pointer accessor
*
* @return
* The function pointer.
*/
ProcAddress address() const;
/**
* @brief
* Callback mask accessor
*
* @return
* Returns the currently configured callback mask for the current state.
*/
CallbackMask callbackMask() const;
/**
* @brief
* Reconfigures the callback mask for the current state.
*
* @param[in] mask
* The new callback mask.
*/
void setCallbackMask(CallbackMask mask);
/**
* @brief
* Reconfigures the callback mask for the current state in means of a bit-wise 'or' operation with the current callback mask.
*
* @param[in] mask
* The callback mask to include.
*/
void addCallbackMask(CallbackMask mask);
/**
* @brief
* Reconfigures the callback mask for the current state in means of a bit-wise 'clear' operation of the current callback mask.
*
* @param[in] mask
* The callback mask to exclude.
*/
void removeCallbackMask(CallbackMask mask);
/**
* @brief
* Check if all bits of the parameter are set in the currently configured callback mask of the current state.
*
* @param[in] mask
* The mask to check against.
*
* @return
* true iff all bits are set.
*/
bool isEnabled(CallbackMask mask) const;
/**
* @brief
* Check if any bit of the parameter is set in the currently configured callback mask of the current state.
*
* @param[in] mask
* The mask to check against.
*
* @return
* true iff at least one bit is set.
*/
bool isAnyEnabled(CallbackMask mask) const;
/**
* @brief
* Triggers a call of the unresolved callback.
*/
void unresolved() const;
/**
* @brief
* Triggers a call of the before callback, passing the parameters.
*
* @param[in] call
* The parameters of the current function call.
*/
void before(const FunctionCall & call) const;
/**
* @brief
* Triggers a call of the after callback, passing the parameters and return value.
*
* @param[in] call
* The parameters and the return value of the current function call.
*/
void after(const FunctionCall & call) const;
protected:
/**
* @brief
* The State struct represents the configuration of an OpenGL function for one thread.
* This includes the driver function pointer (is allowed to differ between contexts) and the callback mask.
*/
struct State
{
/**
* @brief
* Constructor that initializes all values with 0 / invalid.
*/
State();
ProcAddress address; ///< The function pointer to the OpenGL function.
bool initialized; ///< Whether this state is initialized or not.
CallbackMask callbackMask; ///< The callback mask that is considered when dispatching function calls.
};
/**
* @brief
* Checks for existance of the current configured state.
*
* @return
* true iff the current state still exists.
*
* This method is usually used to detect invalid state clean up.
*/
bool hasState() const;
/**
* @brief
* Checks for existance of a state.
*
* @param[in] pos
* The index of the state to check.
*
* @return
* true iff the state exists.
*/
bool hasState(int pos) const;
/**
* @brief
* Current state accessor
*
* @return
* The current state
*/
State & state() const;
/**
* @brief
* State accessor
*
* @param[in] pos
* The index of the state
*
* @return
* The state
*/
State & state(int pos) const;
/**
* @brief
* Extend the function states to include the state identified through pos.
*
* @param pos
* The index of the state to provide.
*/
static void provideState(int pos);
/**
* @brief
* Reconfigures the states so that the state identified through pos is neglected.
*
* @param pos
* The index of the state to neglect.
*/
static void neglectState(int pos);
/**
* @brief
* Updates the currently used state.
*
* @param pos
* The index of the new state.
*/
static void setStatePos(int pos);
protected:
const char * m_name; ///< The OpenGL API function name, including the 'gl' prefix.
mutable std::vector<State> m_states; ///< The list of all states.
// to reduce per instance hasState checks and provide/neglect states for all instances,
// max pos is used to provide m_states size, which is identical for all instances.
static int s_maxpos; ///< The global maximum of states per function
};
} // namespace glbinding
|