distortos  v0.6.0
object-oriented C++ RTOS for microcontrollers
fromCApi.hpp
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_DISTORTOS_FROMCAPI_HPP_
13 #define INCLUDE_DISTORTOS_FROMCAPI_HPP_
14 
15 extern "C"
16 {
17 
19 struct distortos_Mutex;
20 struct distortos_Semaphore;
21 
22 } // extern "C"
23 
24 namespace distortos
25 {
26 
27 class ConditionVariable;
28 class Mutex;
29 class Semaphore;
30 
40 {
41  return reinterpret_cast<distortos::ConditionVariable&>(conditionVariable);
42 }
43 
52 inline static const distortos::ConditionVariable& fromCApi(const distortos_ConditionVariable& conditionVariable)
53 {
54  return reinterpret_cast<const distortos::ConditionVariable&>(conditionVariable);
55 }
56 
66 {
67  return reinterpret_cast<distortos::Mutex&>(mutex);
68 }
69 
78 inline static const distortos::Mutex& fromCApi(const distortos_Mutex& mutex)
79 {
80  return reinterpret_cast<const distortos::Mutex&>(mutex);
81 }
82 
92 {
93  return reinterpret_cast<distortos::Semaphore&>(semaphore);
94 }
95 
104 inline static const distortos::Semaphore& fromCApi(const distortos_Semaphore& semaphore)
105 {
106  return reinterpret_cast<const distortos::Semaphore&>(semaphore);
107 }
108 
109 } // namespace distortos
110 
111 #endif // INCLUDE_DISTORTOS_FROMCAPI_HPP_
ConditionVariable is an advanced synchronization primitive.
Definition: ConditionVariable.hpp:35
Semaphore is the basic synchronization primitive.
Definition: Semaphore.hpp:30
static distortos::ConditionVariable & fromCApi(distortos_ConditionVariable &conditionVariable)
Casts C-API distortos_ConditionVariable to distortos::ConditionVariable.
Definition: fromCApi.hpp:39
Top-level namespace of distortos project.
Mutex is the basic synchronization primitive.
Definition: Mutex.hpp:30
C-API equivalent of distortos::Semaphore.
Definition: Semaphore.h:42
C-API equivalent of distortos::ConditionVariable.
Definition: ConditionVariable.h:44
C-API equivalent of distortos::Mutex.
Definition: Mutex.h:43