F´ Flight Software - C/C++ Documentation
NASA-v1.6.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
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
z
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
x
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
d
e
f
g
h
i
l
m
n
p
q
r
s
t
u
v
w
x
Typedefs
Enumerations
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
w
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
Functions
i
m
p
s
u
Variables
Typedefs
Enumerations
Enumerator
c
d
e
f
m
o
p
r
s
t
v
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
* Revised March 2022
14
* Author: bocchino
15
*/
16
17
#ifndef TYPES_CIRCULAR_BUFFER_HPP
18
#define TYPES_CIRCULAR_BUFFER_HPP
19
20
#include <FpConfig.hpp>
21
#include <Fw/Types/BasicTypes.hpp>
22
#include <Fw/Types/Serializable.hpp>
23
24
//#define CIRCULAR_DEBUG
25
26
namespace
Types
{
27
28
class
CircularBuffer
{
29
public
:
39
CircularBuffer
(
U8
*
const
buffer,
const
NATIVE_UINT_TYPE
size);
40
48
Fw::SerializeStatus
serialize
(
const
U8
*
const
buffer,
const
NATIVE_UINT_TYPE
size);
49
56
Fw::SerializeStatus
peek
(
char
& value,
NATIVE_UINT_TYPE
offset = 0)
const
;
63
Fw::SerializeStatus
peek
(
U8
& value,
NATIVE_UINT_TYPE
offset = 0)
const
;
70
Fw::SerializeStatus
peek
(U32& value,
NATIVE_UINT_TYPE
offset = 0)
const
;
71
79
Fw::SerializeStatus
peek
(
U8
* buffer,
NATIVE_UINT_TYPE
size,
NATIVE_UINT_TYPE
offset = 0)
const
;
80
87
Fw::SerializeStatus
rotate
(
NATIVE_UINT_TYPE
amount);
88
93
NATIVE_UINT_TYPE
get_allocated_size
()
const
;
94
100
NATIVE_UINT_TYPE
get_free_size
()
const
;
101
106
NATIVE_UINT_TYPE
get_capacity
()
const
;
107
108
#ifdef CIRCULAR_DEBUG
109
void
print();
110
#endif
111
PRIVATE:
118
NATIVE_UINT_TYPE
advance_idx(
NATIVE_UINT_TYPE
idx,
NATIVE_UINT_TYPE
amount = 1)
const
;
120
U8
*
const
m_store;
122
const
NATIVE_UINT_TYPE
m_store_size;
125
NATIVE_UINT_TYPE
m_head_idx;
127
NATIVE_UINT_TYPE
m_allocated_size;
128
};
129
}
//End Namespace Types
130
#endif
131
Types::CircularBuffer::serialize
Fw::SerializeStatus serialize(const U8 *const buffer, const NATIVE_UINT_TYPE size)
Definition:
CircularBuffer.cpp:48
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition:
Serializable.hpp:14
U8
uint8_t U8
8-bit unsigned integer
Definition:
BasicTypes.hpp:73
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition:
BasicTypes.hpp:28
Types::CircularBuffer::get_allocated_size
NATIVE_UINT_TYPE get_allocated_size() const
Definition:
CircularBuffer.cpp:34
Types::CircularBuffer::get_capacity
NATIVE_UINT_TYPE get_capacity() const
Definition:
CircularBuffer.cpp:124
Types::CircularBuffer::peek
Fw::SerializeStatus peek(char &value, NATIVE_UINT_TYPE offset=0) const
Definition:
CircularBuffer.cpp:66
Types::CircularBuffer::rotate
Fw::SerializeStatus rotate(NATIVE_UINT_TYPE amount)
Definition:
CircularBuffer.cpp:114
Types
Definition:
CircularBuffer.cpp:23
Types::CircularBuffer::CircularBuffer
CircularBuffer(U8 *const buffer, const NATIVE_UINT_TYPE size)
Definition:
CircularBuffer.cpp:25
Types::CircularBuffer
Definition:
CircularBuffer.hpp:28
Types::CircularBuffer::get_free_size
NATIVE_UINT_TYPE get_free_size() const
Definition:
CircularBuffer.cpp:38
Utils
Types
CircularBuffer.hpp
Generated by
1.8.17