F´ Flight Software - C/C++ Documentation
NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
g
h
i
m
r
s
t
v
w
Variables
Typedefs
Enumerations
Enumerator
a
b
c
f
h
i
l
m
n
o
p
s
t
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
c
t
u
w
Enumerations
b
c
d
e
f
g
h
i
m
o
p
q
s
t
w
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
w
Related Functions
a
b
c
f
g
h
l
p
r
s
t
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
Functions
f
i
m
s
u
Variables
_
c
f
i
l
p
t
Typedefs
Enumerations
Enumerator
a
c
d
f
i
m
p
r
s
t
w
Macros
a
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
CircularBuffer.hpp
Go to the documentation of this file.
1
/*
2
* CircularBuffer.hpp:
3
*
4
* Buffer used to efficiently store data in ring data structure. Uses an externally supplied
5
* data store as the backing for this buffer. Thus it is dependent on receiving sole ownership
6
* of the supplied buffer.
7
*
8
* Note: this given implementation loses one byte of the data store in order to ensure that a
9
* separate wrap-around tracking variable is not needed.
10
*
11
* Created on: Apr 4, 2019
12
* Author: lestarch
13
*/
14
#include <
FpConfig.hpp
>
15
#include <
Fw/Types/BasicTypes.hpp
>
16
#include <
Fw/Types/Serializable.hpp
>
17
18
#ifndef TYPES_CIRCULAR_BUFFER_HPP
19
#define TYPES_CIRCULAR_BUFFER_HPP
20
21
//#define CIRCULAR_DEBUG
22
23
// An assertion to guarantee the self-consistency of a head/tail pointer w.r.t. the store and size
24
#define ASSERT_CONSISTENT(store, size, X) \
25
FW_ASSERT(X >= store && X < (store + size), \
26
reinterpret_cast<POINTER_CAST>(X), \
27
reinterpret_cast<POINTER_CAST>(store))
28
29
namespace
Types
{
30
31
class
CircularBuffer
{
32
public
:
42
CircularBuffer
(
U8
*
const
buffer,
const
NATIVE_UINT_TYPE
size);
43
50
Fw::SerializeStatus
serialize
(
const
U8
*
const
buffer,
const
NATIVE_UINT_TYPE
size);
51
56
Fw::SerializeStatus
peek
(
char
& value,
NATIVE_UINT_TYPE
offset = 0);
61
Fw::SerializeStatus
peek
(
U8
& value,
NATIVE_UINT_TYPE
offset = 0);
66
Fw::SerializeStatus
peek
(U32& value,
NATIVE_UINT_TYPE
offset = 0);
67
72
Fw::SerializeStatus
peek
(
U8
* buffer,
NATIVE_UINT_TYPE
size,
NATIVE_UINT_TYPE
offset = 0);
73
79
Fw::SerializeStatus
rotate
(
NATIVE_UINT_TYPE
amount);
80
85
NATIVE_UINT_TYPE
get_remaining_size
(
bool
serialization =
false
);
86
87
#ifdef CIRCULAR_DEBUG
88
void
print();
89
#endif
90
private
:
97
U8
* increment(
U8
*
const
pointer,
NATIVE_UINT_TYPE
amount = 1);
99
U8
*
const
m_store;
101
const
NATIVE_UINT_TYPE
m_size;
103
U8
* m_head;
105
U8
* m_tail;
106
};
107
}
//End Namespace Types
108
#endif
109
Types::CircularBuffer::serialize
Fw::SerializeStatus serialize(const U8 *const buffer, const NATIVE_UINT_TYPE size)
Definition:
CircularBuffer.cpp:54
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition:
Serializable.hpp:14
Serializable.hpp
U8
uint8_t U8
8-bit unsigned integer
Definition:
BasicTypes.hpp:76
Types::CircularBuffer::get_remaining_size
NATIVE_UINT_TYPE get_remaining_size(bool serialization=false)
Definition:
CircularBuffer.cpp:33
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition:
BasicTypes.hpp:30
Types::CircularBuffer::rotate
Fw::SerializeStatus rotate(NATIVE_UINT_TYPE amount)
Definition:
CircularBuffer.cpp:136
Types::CircularBuffer::peek
Fw::SerializeStatus peek(char &value, NATIVE_UINT_TYPE offset=0)
Definition:
CircularBuffer.cpp:76
Types
Definition:
CircularBuffer.cpp:24
FpConfig.hpp
ISF configuration file.
Types::CircularBuffer::CircularBuffer
CircularBuffer(U8 *const buffer, const NATIVE_UINT_TYPE size)
Definition:
CircularBuffer.cpp:26
Types::CircularBuffer
Definition:
CircularBuffer.hpp:31
BasicTypes.hpp
Declares ISF basic types.
Utils
Types
CircularBuffer.hpp
Generated by
1.8.19