OGLplus  (0.59.0) a C++ wrapper for rendering APIs

c_api.hpp
Go to the documentation of this file.
1 #ifndef OALPLUS_ALUT_API_C_API_HPP
9 #define OALPLUS_ALUT_API_C_API_HPP
10 
11 #include "api_traits.hpp"
12 #include "config.hpp"
13 #include <eagine/nothing.hpp>
14 #include <eagine/preprocessor.hpp>
15 
16 #ifndef OALPLUS_ALUT_STATIC_FUNC
17 #if OALPLUS_HAS_AL
18 #define OALPLUS_ALUT_STATIC_FUNC(NAME) &EAGINE_JOIN(::alut, NAME)
19 #else
20 #define OALPLUS_ALUT_STATIC_FUNC(NAME) nullptr
21 #endif
22 #endif
23 
24 namespace eagine::oalp {
25 //------------------------------------------------------------------------------
30 template <typename ApiTraits>
32 public:
33  using this_api = basic_alut_c_api;
34 
36  using api_traits = ApiTraits;
37 
38  static constexpr bool has_api = alut_types::has_api;
39 
41  using enum_type = typename alut_types::enum_type;
42 
44  using char_type = typename alut_types::char_type;
45 
47  using bool_type = typename alut_types::bool_type;
48 
50  using int_type = typename alut_types::int_type;
51 
53  using uint_type = typename alut_types::uint_type;
54 
56  using name_type = typename alut_types::name_type;
57 
59  using size_type = typename alut_types::size_type;
60 
63 
66 
69 
70 #ifdef __GNUC__
71  EAGINE_DIAG_PUSH()
72  EAGINE_DIAG_OFF(address)
73 #endif
74 
76  template <
77  typename Signature,
78  c_api_function_ptr<api_traits, nothing_t, Signature> Function>
80  api_traits,
81  nothing_t,
82  Signature,
83  Function,
84  has_api,
85  bool(Function)>;
86 #ifdef __GNUC__
87  EAGINE_DIAG_POP()
88 #endif
89 
92  alut_api_function<enum_type(), OALPLUS_ALUT_STATIC_FUNC(GetError)> GetError;
93 
97  const char_type*(enum_type),
98  OALPLUS_ALUT_STATIC_FUNC(GetErrorString)>
100 
103  alut_api_function<bool_type(int*, char**), OALPLUS_ALUT_STATIC_FUNC(Init)>
105 
108  alut_api_function<bool_type(int*, char**), OALPLUS_ALUT_STATIC_FUNC(Init)>
110 
114  name_type(const char*),
115  OALPLUS_ALUT_STATIC_FUNC(CreateBufferFromFile)>
117 
122  OALPLUS_ALUT_STATIC_FUNC(CreateBufferFromFileImage)>
124 
128  name_type(),
129  OALPLUS_ALUT_STATIC_FUNC(CreateBufferHelloWorld)>
131 
136  OALPLUS_ALUT_STATIC_FUNC(CreateBufferWaveform)>
138 
141  alut_api_function<bool_type(), OALPLUS_ALUT_STATIC_FUNC(Exit)> Exit;
142 
143  basic_alut_c_api(api_traits& traits);
144 };
145 //------------------------------------------------------------------------------
149 //------------------------------------------------------------------------------
150 } // namespace eagine::oalp
151 
152 #endif // OALPLUS_ALUT_API_C_API_HPP
alut_api_function< name_type(enum_type, float_type, float_type, float_type), nullptr > CreateBufferWaveform
Definition: c_api.hpp:137
alut_api_function< name_type(const_void_ptr_type, size_type), nullptr > CreateBufferFromFileImage
Definition: c_api.hpp:123
al_types::uint_type uint_type
Unsigned integer type.
Definition: config.hpp:46
alut_api_function< const char_type *(enum_type), nullptr > GetErrorString
Definition: c_api.hpp:99
std::conditional_t< IsAvailable, std::conditional_t< IsStatic, static_c_api_function< ApiTraits, Tag, Signature, function >, dynamic_c_api_function< ApiTraits, Tag, Signature > >, unimplemented_c_api_function< ApiTraits, Tag, Signature > > opt_c_api_function
Template alias used for switching between static and dynamic function.
Definition: c_api_wrap.hpp:1096
al_types::int_type int_type
Integer type.
Definition: config.hpp:43
alut_api_function< bool_type(int *, char **), nullptr > InitWithoutContext
Definition: c_api.hpp:109
alut_api_function< bool_type(int *, char **), nullptr > Init
Definition: c_api.hpp:104
alut_api_function< enum_type(), nullptr > GetError
Definition: c_api.hpp:92
typename alut_types::enum_type enum_type
Alias for enumeration type.
Definition: c_api.hpp:41
Class representing "none" / "nothing" values.
Definition: nothing.hpp:17
al_types::bool_type bool_type
Boolean type.
Definition: config.hpp:34
typename alut_types::size_type size_type
Alias for integer type used to store sizes and counts.
Definition: c_api.hpp:59
alut_api_function< bool_type(), nullptr > Exit
Definition: c_api.hpp:141
al_types::void_ptr_type void_ptr_type
Untyped pointer type.
Definition: config.hpp:58
typename alut_types::float_type float_type
Alias for floating-point type.
Definition: c_api.hpp:62
typename alut_types::bool_type bool_type
Alias for boolean type.
Definition: c_api.hpp:47
typename alut_types::void_ptr_type void_ptr_type
Untyped non-const pointer type.
Definition: c_api.hpp:65
basic_address< false > address
Type alias for non-const memory address values.
Definition: address.hpp:203
alut_api_function< name_type(const char *), nullptr > CreateBufferFromFile
Definition: c_api.hpp:116
al_types::enum_type enum_type
Enum type.
Definition: config.hpp:40
al_types::name_type name_type
AL object handle type.
Definition: config.hpp:49
ApiTraits api_traits
Alias for the API traits policy type passed as template argument.
Definition: c_api.hpp:36
Class wrapping the C-functions from the ALUT API.
Definition: c_api.hpp:31
alut_api_function< name_type(), nullptr > CreateBufferHelloWorld
Definition: c_api.hpp:130
al_types::size_type size_type
Integer type used to store sizes and counts.
Definition: config.hpp:52
typename alut_types::uint_type uint_type
Alias for unsigned integer type.
Definition: c_api.hpp:53
typename alut_types::char_type char_type
Alias for string character type.
Definition: c_api.hpp:44
al_types::char_type char_type
String character type.
Definition: config.hpp:37
AL-related code is placed in this namespace.
Definition: oalplus.hpp:11
typename alut_types::name_type name_type
Alias for object handle type.
Definition: c_api.hpp:56
typename alut_types::int_type int_type
Alias for signed integer type.
Definition: c_api.hpp:50
al_types::const_void_ptr_type const_void_ptr_type
Untyped const pointer type.
Definition: config.hpp:61
al_types::float_type float_type
Floating-point type.
Definition: config.hpp:55
typename alut_types::const_void_ptr_type const_void_ptr_type
Untyped const pointer type.
Definition: c_api.hpp:68
eagine::opt_c_api_function< api_traits, nothing_t, Signature, Function, has_api, bool(Function)> alut_api_function
Alias for ALUT C-API function wrapper template.
Definition: c_api.hpp:85

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).