ape  0.5.0
Audio Programming Environment
baselib.h
Go to the documentation of this file.
1 #ifndef CPPAPE_RUNTIME_H
2 #define CPPAPE_RUNTIME_H
3 #ifndef __cplusplus
4 #error baselib.h can only be used with a C++ compiler
5 #endif
6 
7 #include <cstddef>
8 #include <new>
9 
10 namespace ape
11 {
12  void* memoryAlloc(std::size_t am, std::size_t align);
13  void memoryFree(void* loc);
14 }
15 
16 void *operator new(std::size_t am)
17 {
18  return ape::memoryAlloc(am, 64);
19 }
20 
21 void *operator new(std::size_t am, std::align_val_t align)
22 {
23  return ape::memoryAlloc(am, static_cast<std::size_t>(align));
24 }
25 
26 void operator delete(void * loc) noexcept
27 {
28  return ape::memoryFree(loc);
29 }
30 
31 void operator delete(void * loc, std::align_val_t align) noexcept
32 {
33  return ape::memoryFree(loc);
34 }
35 
36 #ifdef __cppape
38 #else
39 // (folder layout different in dev mode)
40 #include <SharedInterface.h>
41 #endif
42 
43 // #define CPPAPE_RELEASE
44 
45 #ifdef CPPAPE_RELEASE
46 #define CPPAPE_NOEXCEPT_IF_RELEASE noexcept
47 #else
48 #define CPPAPE_NOEXCEPT_IF_RELEASE
49 #endif
50 
55 [[noreturn]] void abort(const char* reason);
56 
57 namespace ape
58 {
62  class UIObject {};
63 
68 
72  struct StatusCode
73  {
74  static constexpr APE_Status
86  Wait [[deprecated]] = STATUS_WAIT,
90  Silent [[deprecated]] = STATUS_SILENT,
98  Disabled [[deprecated]] = STATUS_DISABLED,
107 
108  };
109 
110  namespace detail
111  {
112  struct PluginResource
113  {
114  ~PluginResource()
115  {
116  getInterface().destroyResource(&getInterface(), 0, 0);
117  }
118  };
119  }
120 }
121 
122 
123 #endif
ape::getInterface
APE_SharedInterface & getInterface()
Acquire the low-level C API.
STATUS_READY
Definition: APE.h:70
ape::memoryAlloc
void * memoryAlloc(std::size_t am, std::size_t align)
STATUS_OK
Definition: APE.h:66
ape::StatusCode::Error
static constexpr APE_Status Error
Error at operation, state inconsistent.
Definition: baselib.h:82
ape::StatusCode::Silent
static constexpr APE_Status Silent
Silent. Deprecated.
Definition: baselib.h:90
ape::UIObject
Base traits class for all classes that are displayed in the GUI.
Definition: baselib.h:62
STATUS_HANDLED
Definition: APE.h:72
abort
void abort(const char *reason)
Terminate the script (not the host application!) safely, with a reason. All resources will automatica...
STATUS_DISABLED
Definition: APE.h:71
ape::StatusCode::Ready
static constexpr APE_Status Ready
Ready.
Definition: baselib.h:94
ape::StatusCode::NotImplemented
static constexpr APE_Status NotImplemented
No support for operation.
Definition: baselib.h:106
ape::StatusCode::Handled
static constexpr APE_Status Handled
Operation handled.
Definition: baselib.h:102
ape::StatusCode::Wait
static constexpr APE_Status Wait
Not ready yet. Deprecated.
Definition: baselib.h:86
ape
Definition: audiofile.h:7
STATUS_SILENT
Definition: APE.h:69
ape::memoryFree
void memoryFree(void *loc)
ape::StatusCode::Ok
static constexpr APE_Status Ok
Operation succeeded.
Definition: baselib.h:78
APE_SharedInterface
Definition: SharedInterface.h:159
STATUS_ERROR
Definition: APE.h:67
ape::StatusCode::Disabled
static constexpr APE_Status Disabled
Disabled. Deprecated.
Definition: baselib.h:98
APE_Status
APE_Status
Definition: APE.h:64
STATUS_WAIT
Definition: APE.h:68
STATUS_NOT_IMPLEMENTED
Definition: APE.h:73
SharedInterface.h
ape::StatusCode
Low level error code used in certian comms APIs.
Definition: baselib.h:72