F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
SerialBuffer.cpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title SerialBuffer.cpp
3
// \author bocchino
4
// \brief cpp file for SerialBuffer type
5
//
6
// \copyright
7
// Copyright (C) 2016 California Institute of Technology.
8
// ALL RIGHTS RESERVED. United States Government Sponsorship
9
// acknowledged.
10
//
11
// ======================================================================
12
13
#include "
Fw/Types/Assert.hpp
"
14
#include "
Fw/Types/SerialBuffer.hpp
"
15
16
namespace
Fw
{
17
18
SerialBuffer ::SerialBuffer(
U8
*
const
data,
const
U32 capacity) : m_data(data), m_capacity(capacity) {}
19
20
NATIVE_UINT_TYPE
SerialBuffer ::getBuffCapacity()
const
{
21
return
m_capacity;
22
}
23
24
U8
* SerialBuffer ::getBuffAddr() {
25
return
m_data;
26
}
27
28
const
U8
* SerialBuffer ::getBuffAddr()
const
{
29
return
m_data;
30
}
31
32
void
SerialBuffer ::fill() {
33
const
SerializeStatus
status = this->setBuffLen(this->m_capacity);
34
FW_ASSERT
(status ==
FW_SERIALIZE_OK
);
35
}
36
37
SerializeStatus
SerialBuffer ::pushBytes(
const
U8
*
const
addr,
const
NATIVE_UINT_TYPE
n) {
38
// "true" means "just push the bytes"
39
return
this->serialize(
const_cast<
U8
*
>
(addr), n,
true
);
40
}
41
42
SerializeStatus
SerialBuffer ::popBytes(
U8
*
const
addr,
NATIVE_UINT_TYPE
n) {
43
// "true" means "just pop the bytes"
44
return
this->deserialize(addr, n,
true
);
45
}
46
47
}
// namespace Fw
Assert.hpp
FW_ASSERT
#define FW_ASSERT(...)
Definition
Assert.hpp:14
U8
uint8_t U8
8-bit unsigned integer
Definition
BasicTypes.h:30
NATIVE_UINT_TYPE
PlatformUIntType NATIVE_UINT_TYPE
Definition
BasicTypes.h:56
SerialBuffer.hpp
Fw
Definition
FppConstantsAc.hpp:121
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition
Serializable.hpp:14
Fw::FW_SERIALIZE_OK
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
Definition
Serializable.hpp:15
Fw
Types
SerialBuffer.cpp
Generated by
1.9.8