F´ Flight Software - C/C++ Documentation
NASA-v2.0.1
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
f
h
i
n
o
p
s
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
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
b
d
e
f
g
h
i
l
m
n
p
q
s
t
u
v
w
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
l
m
n
o
p
q
r
s
t
w
Related Functions
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
Functions
f
i
m
s
u
Variables
Typedefs
Enumerations
Enumerator
c
d
f
m
p
r
s
t
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
51
Fw::SerializeStatus
serialize
(
const
U8
*
const
buffer,
const
NATIVE_UINT_TYPE
size);
52
59
Fw::SerializeStatus
peek
(
char
& value,
NATIVE_UINT_TYPE
offset = 0);
66
Fw::SerializeStatus
peek
(
U8
& value,
NATIVE_UINT_TYPE
offset = 0);
73
Fw::SerializeStatus
peek
(U32& value,
NATIVE_UINT_TYPE
offset = 0);
74
82
Fw::SerializeStatus
peek
(
U8
* buffer,
NATIVE_UINT_TYPE
size,
NATIVE_UINT_TYPE
offset = 0);
83
90
Fw::SerializeStatus
rotate
(
NATIVE_UINT_TYPE
amount);
91
97
NATIVE_UINT_TYPE
get_remaining_size
(
bool
serialization =
false
);
98
103
NATIVE_UINT_TYPE
get_capacity
();
104
105
#ifdef CIRCULAR_DEBUG
106
void
print();
107
#endif
108
private
:
115
U8
* increment(
U8
*
const
pointer,
NATIVE_UINT_TYPE
amount = 1);
117
U8
*
const
m_store;
119
const
NATIVE_UINT_TYPE
m_size;
121
U8
* m_head;
123
U8
* m_tail;
124
};
125
}
//End Namespace Types
126
#endif
127
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::get_capacity
NATIVE_UINT_TYPE get_capacity()
Definition:
CircularBuffer.cpp:150
Types::CircularBuffer
Definition:
CircularBuffer.hpp:31
BasicTypes.hpp
Declares ISF basic types.
Utils
Types
CircularBuffer.hpp
Generated by
1.8.17