Soldered 125kHz RFID board Arduino library
1.0.0
Library for Soldered 125kHz RFID board.
Toggle main menu visibility
Loading...
Searching...
No Matches
ghostl.h
Go to the documentation of this file.
1
/*
2
ghostl.h - Implementation of a bare-bones, mostly no-op, C++ STL shell
3
that allows building some Arduino ESP8266/ESP32
4
libraries on Aruduino AVR.
5
Copyright (c) 2019 Dirk O. Kaar. All rights reserved.
6
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
11
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
16
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
#ifndef __ghostl_h
23
#define __ghostl_h
24
25
#if defined(ARDUINO_ARCH_SAMD)
26
#include <atomic>
27
#endif
28
29
using
size_t
=
decltype
(
sizeof
(char));
30
31
namespace
std
32
{
33
#if !defined(ARDUINO_ARCH_SAMD)
34
typedef
enum
memory_order
{
35
memory_order_relaxed
,
36
memory_order_acquire
,
37
memory_order_release
,
38
memory_order_seq_cst
39
}
memory_order
;
40
template
<
typename
T >
class
atomic
{
41
private
:
42
T
value
;
43
public
:
44
atomic
() {}
45
atomic
(T desired) {
value
= desired; }
46
void
store
(T desired,
std::memory_order
=
std::memory_order_seq_cst
)
volatile
noexcept
{
value
= desired; }
47
T
load
(
std::memory_order
=
std::memory_order_seq_cst
)
const
volatile
noexcept
{
return
value
; }
48
};
49
inline
void
atomic_thread_fence
(
std::memory_order
order)
noexcept
{}
50
template
<
typename
T > T&&
move
(T& t)
noexcept
{
return
static_cast<
T&&
>
(t); }
51
#endif
52
53
template
<
typename
T,
size_t
long
N >
struct
array
54
{
55
T
_M_elems
[N];
56
decltype
(
sizeof
(0))
size
()
const
{
return
N; }
57
T&
operator[]
(
decltype
(
sizeof
(0)) i) {
return
_M_elems
[i]; }
58
const
T&
operator[]
(
decltype
(
sizeof
(0)) i)
const
{
return
_M_elems
[i]; }
59
};
60
61
template
<
typename
T >
class
unique_ptr
62
{
63
public
:
64
using
pointer
= T*;
65
unique_ptr
() noexcept :
ptr
(
nullptr
) {}
66
unique_ptr
(
pointer
p) :
ptr
(p) {}
67
pointer
operator->
() const noexcept {
return
ptr
; }
68
T&
operator[]
(
decltype
(
sizeof
(0)) i)
const
{
return
ptr
[i]; }
69
void
reset
(
pointer
p =
pointer
()) noexcept
70
{
71
delete
ptr
;
72
ptr
= p;
73
}
74
T&
operator*
()
const
{
return
*
ptr
; }
75
private
:
76
pointer
ptr
;
77
};
78
79
template
<
typename
T >
using
function
= T*;
80
using
nullptr_t
=
decltype
(
nullptr
);
81
82
template
<
typename
T>
83
struct
identity
{
84
typedef
T
type
;
85
};
86
87
template
<
typename
T>
88
inline
T&&
forward
(
typename
identity<T>::type
& t)
noexcept
89
{
90
return
static_cast<
typename
identity<T>::type
&&
>
(t);
91
}
92
}
93
94
#endif
// __ghostl_h
std::atomic::load
T load(std::memory_order=std::memory_order_seq_cst) const volatile noexcept
Definition
ghostl.h:47
std::atomic::store
void store(T desired, std::memory_order=std::memory_order_seq_cst) volatile noexcept
Definition
ghostl.h:46
std::atomic::atomic
atomic(T desired)
Definition
ghostl.h:45
std::atomic::atomic
atomic()
Definition
ghostl.h:44
std::atomic::value
T value
Definition
ghostl.h:42
std::unique_ptr::operator*
T & operator*() const
Definition
ghostl.h:74
std::unique_ptr::operator[]
T & operator[](decltype(sizeof(0)) i) const
Definition
ghostl.h:68
std::unique_ptr::unique_ptr
unique_ptr(pointer p)
Definition
ghostl.h:66
std::unique_ptr::operator->
pointer operator->() const noexcept
Definition
ghostl.h:67
std::unique_ptr::reset
void reset(pointer p=pointer()) noexcept
Definition
ghostl.h:69
std::unique_ptr::ptr
pointer ptr
Definition
ghostl.h:76
std::unique_ptr::pointer
T * pointer
Definition
ghostl.h:64
std::unique_ptr::unique_ptr
unique_ptr() noexcept
Definition
ghostl.h:65
size_t
decltype(sizeof(char)) size_t
Definition
ghostl.h:29
std
Definition
ghostl.h:32
std::atomic_thread_fence
void atomic_thread_fence(std::memory_order order) noexcept
Definition
ghostl.h:49
std::move
T && move(T &t) noexcept
Definition
ghostl.h:50
std::nullptr_t
decltype(nullptr) nullptr_t
Definition
ghostl.h:80
std::memory_order
memory_order
Definition
ghostl.h:34
std::memory_order_relaxed
@ memory_order_relaxed
Definition
ghostl.h:35
std::memory_order_release
@ memory_order_release
Definition
ghostl.h:37
std::memory_order_acquire
@ memory_order_acquire
Definition
ghostl.h:36
std::memory_order_seq_cst
@ memory_order_seq_cst
Definition
ghostl.h:38
std::forward
T && forward(typename identity< T >::type &t) noexcept
Definition
ghostl.h:88
std::function
T * function
Definition
ghostl.h:79
std::array
Definition
ghostl.h:54
std::array::size
decltype(sizeof(0)) size() const
Definition
ghostl.h:56
std::array::operator[]
T & operator[](decltype(sizeof(0)) i)
Definition
ghostl.h:57
std::array::operator[]
const T & operator[](decltype(sizeof(0)) i) const
Definition
ghostl.h:58
std::array::_M_elems
T _M_elems[N]
Definition
ghostl.h:55
std::identity
Definition
ghostl.h:83
std::identity::type
T type
Definition
ghostl.h:84
src
libs
ESPSoftwareSerial
circular_queue
ghostl.h
Generated on
for Soldered 125kHz RFID board Arduino library by
1.18.0. Dark theme by
Tilen Majerle
. All rights reserved. Copyright:
Soldered