F´ Flight Software - C/C++ Documentation  devel
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 <FpConfig.hpp>
18 
19 namespace Fw {
20 
25  public:
26  // ----------------------------------------------------------------------
27  // Construction
28  // ----------------------------------------------------------------------
29 
32  SerialBuffer(U8* const data,
33  const U32 capacity
34  );
35 
36  public:
37  // ----------------------------------------------------------------------
38  // Pure virtual methods from SerializeBufferBase
39  // ----------------------------------------------------------------------
40 
42 
43  U8* getBuffAddr();
44 
45  const U8* getBuffAddr() const;
46 
47  public:
48  // ----------------------------------------------------------------------
49  // Public instance methods
50  // ----------------------------------------------------------------------
51 
53  void fill();
54 
56  SerializeStatus pushBytes(const U8* const addr,
57  const NATIVE_UINT_TYPE n
58  );
59 
61  SerializeStatus popBytes(U8* const addr,
63  );
64 
65  private:
66  // ----------------------------------------------------------------------
67  // Data
68  // ----------------------------------------------------------------------
69 
71  U8* const m_data;
72 
74  const U32 m_capacity;
75 };
76 
77 } // namespace Fw
78 
79 #endif
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
C++-compatible configuration header for fprime configuration.
A variable-length serializable buffer.
NATIVE_UINT_TYPE getBuffCapacity() const
returns capacity, not current size, of buffer
SerializeStatus popBytes(U8 *const addr, NATIVE_UINT_TYPE n)
Pop n bytes off the buffer.
SerializeStatus pushBytes(const U8 *const addr, const NATIVE_UINT_TYPE n)
Push n bytes onto the buffer.
void fill()
Fill the buffer to capacity with preexisting data.
SerialBuffer(U8 *const data, const U32 capacity)
U8 * getBuffAddr()
gets buffer address for data filling
SerializeStatus
forward declaration for string