F´ Flight Software - C/C++ Documentation  NASA-v1.6.0
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/Types/BasicTypes.hpp"
18 
19 namespace Fw {
20 
24  class SerialBuffer :
25  public SerializeBufferBase
26  {
27 
28  public:
29 
30  // ----------------------------------------------------------------------
31  // Construction
32  // ----------------------------------------------------------------------
33 
37  U8 *const data,
38  const U32 capacity
39  );
40 
41  public:
42 
43  // ----------------------------------------------------------------------
44  // Pure virtual methods from SerializeBufferBase
45  // ----------------------------------------------------------------------
46 
48 
49  U8* getBuffAddr();
50 
51  const U8* getBuffAddr() const;
52 
53  public:
54 
55  // ----------------------------------------------------------------------
56  // Public instance methods
57  // ----------------------------------------------------------------------
58 
60  void fill();
61 
64  const U8 *const addr,
65  const NATIVE_UINT_TYPE n
66  );
67 
70  U8 *const addr,
72  );
73 
74  private:
75 
76  // ----------------------------------------------------------------------
77  // Data
78  // ----------------------------------------------------------------------
79 
81  U8 *const data;
82 
84  const U32 capacity;
85 
86  };
87 
88 }
89 
90 #endif
Fw::SerialBuffer
A variable-length serializable buffer.
Definition: SerialBuffer.hpp:24
Fw::SerializeBufferBase
Definition: Serializable.hpp:43
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
Fw::SerialBuffer::getBuffCapacity
NATIVE_UINT_TYPE getBuffCapacity() const
returns capacity, not current size, of buffer
Definition: SerialBuffer.cpp:30
Fw::SerialBuffer::SerialBuffer
SerialBuffer(U8 *const data, const U32 capacity)
Definition: SerialBuffer.cpp:19
Fw::SerialBuffer::getBuffAddr
U8 * getBuffAddr()
gets buffer address for data filling
Definition: SerialBuffer.cpp:36
Fw::SerialBuffer::fill
void fill()
Fill the buffer to capacity with preexisting data.
Definition: SerialBuffer.cpp:48
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:30
Fw::SerialBuffer::popBytes
SerializeStatus popBytes(U8 *const addr, NATIVE_UINT_TYPE n)
Pop n bytes off the buffer.
Definition: SerialBuffer.cpp:62
Fw::SerialBuffer::pushBytes
SerializeStatus pushBytes(const U8 *const addr, const NATIVE_UINT_TYPE n)
Push n bytes onto the buffer.
Definition: SerialBuffer.cpp:55
BasicTypes.hpp
Declares ISF basic types.
Fw
Definition: Buffer.cpp:21