F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SerialBuffer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SerialBuffer.hpp
3 // \author bocchino
4 // \brief hpp 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 #ifndef Fw_SerialBuffer_HPP
14 #define Fw_SerialBuffer_HPP
15 
16 #include <Fw/FPrimeBasicTypes.hpp>
18 
19 namespace Fw {
20 
24 class SerialBuffer final : public SerializeBufferBase {
25  public:
26  // ----------------------------------------------------------------------
27  // Construction
28  // ----------------------------------------------------------------------
29 
32  SerialBuffer(U8* const data,
33  const FwSizeType capacity
34  );
35 
36  public:
37  // ----------------------------------------------------------------------
38  // Pure virtual methods from SerializeBufferBase
39  // ----------------------------------------------------------------------
40 
41  DEPRECATED(FwSizeType getBuffCapacity() const, "Use getCapacity() instead");
42  FwSizeType getCapacity() const;
43 
44  U8* getBuffAddr();
45 
46  const U8* getBuffAddr() const;
47 
48  public:
49  // ----------------------------------------------------------------------
50  // Public instance methods
51  // ----------------------------------------------------------------------
52 
54  void fill();
55 
57  SerializeStatus pushBytes(const U8* const addr,
58  const FwSizeType n
59  );
60 
62  SerializeStatus popBytes(U8* const addr,
63  FwSizeType n
64  );
65 
66  private:
67  // ----------------------------------------------------------------------
68  // Data
69  // ----------------------------------------------------------------------
70 
72  U8* const m_data;
73 
75  const FwSizeType m_capacity;
76 };
77 
78 } // namespace Fw
79 
80 #endif
A variable-length serializable buffer.
PlatformSizeType FwSizeType
void fill()
Fill the buffer to capacity with preexisting data.
SerializeStatus
forward declaration for string
SerializeStatus popBytes(U8 *const addr, FwSizeType n)
Pop n bytes off the buffer.
SerializeStatus pushBytes(const U8 *const addr, const FwSizeType n)
Push n bytes onto the buffer.
FwSizeType getCapacity() const
Get buffer capacity.
SerialBuffer(U8 *const data, const FwSizeType capacity)
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
U8 * getBuffAddr()
Get buffer address for data filling (non-const version)
Implementation of malloc based allocator.
DEPRECATED(FwSizeType getBuffCapacity() const, "Use getCapacity() instead")