/usr/include/glbinding/Function.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 | #pragma once
#include <functional>
#include <glbinding/AbstractFunction.h>
#ifndef WINAPI
#ifdef SYSTEM_WINDOWS
#define WINAPI __stdcall
#else
#define WINAPI
#endif
#endif
namespace glbinding
{
/**
* @brief
* A callback signature with return type and multiple arguments.
*
* @param ReturnType
* The type of the return value
* @param Arguments
* The types of the arguments
*/
template <typename ReturnType, typename... Arguments>
struct CallbackType
{
using type = std::function<void(ReturnType, Arguments...)>; ///< Propagate the actual callable callback type.
};
/**
* @brief
* A callback signature with multiple arguments but no return type.
*
* @param Arguments
* The types of the arguments
*/
template <typename... Arguments>
struct CallbackType<void, Arguments...>
{
using type = std::function<void(Arguments...)>; ///< Propagate the actual callable callback type.
};
/**
* @brief
* The Function represents an OpenGL API function with additional features, including:
* * callbacks,
* * direct call (omit all callbacks, logging, error checking, ...),
* * and function pointer resolving.
*
* @param ReturnType
* The return type of the function
* @param Arguments
* The types of the arguments
*/
template <typename ReturnType, typename... Arguments>
class Function : public AbstractFunction
{
public:
using Signature = ReturnType(WINAPI *) (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:
/**
* @brief
* Constructor
*
* @param[in] name
* The actual exported OpenGL API function name, including the 'gl' prefix.
*/
Function(const char * name);
/**
* @brief
* Executes a function call on the resolved function pointer and passes the arguments.
*
* @param[in] arguments
* The arguments for the function call
*
* @return
* The return value. (may be void and thus, nothing)
*
* This method respect currently activated callbacks and logging.
*/
ReturnType operator()(Arguments&... arguments) const;
/**
* @brief
* Executes a function call on the resolved function pointer and passes the arguments.
*
* @param[in] arguments
* The arguments for the function call
*
* @return
* The return value. (may be void and thus, nothing)
*
* This method respect currently activated callbacks and logging.
*/
ReturnType call(Arguments&... arguments) const;
/**
* @brief
* Executes a function call on the resolved function pointer and passes the arguments.
*
* @param[in] arguments
* The arguments for the function call
*
* @return
* The return value. (may be void and thus, nothing)
*
* This method omits all currently activated callbacks and logging.
*/
ReturnType directCall(Arguments... arguments) const;
/**
* @brief
* Register a callback that is triggered before a function call to the OpenGL driver.
*
* @param[in] callback
* The callback to register
*
* 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.
*/
void setBeforeCallback(BeforeCallback callback);
/**
* @brief
* Clears any previously registered before callback.
*/
void clearBeforeCallback();
/**
* @brief
* Register a callback that is triggered after a function call to the OpenGL driver.
*
* @param[in] callback
* The callback to register
*
* 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.
*/
void setAfterCallback(AfterCallback callback);
/**
* @brief
* Clears any previously registered after callback.
*/
void clearAfterCallback();
/**
* @brief
* The accessor for the beforeCallback.
*
* @return
* The beforeCallback.
*/
BeforeCallback beforeCallback() const;
/**
* @brief
* The accessor for the afterCallback.
*
* @return
* The afterCallback.
*/
AfterCallback afterCallback() const;
protected:
BeforeCallback m_beforeCallback; ///< The currently registered before callback.
AfterCallback m_afterCallback; ///< The currently registered after callback.
};
} // namespace glbinding
#include <glbinding/Function.inl>
|