F´ Flight Software - C/C++ Documentation  NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
HashBufferCommon.cpp
Go to the documentation of this file.
2 #include <cstring>
3 
4 namespace Utils {
5 
7  }
8 
11  FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
12  }
13 
15  }
16 
17  HashBuffer::HashBuffer(const HashBuffer& other) : Fw::SerializeBufferBase() {
18  Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength());
19  FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
20  }
21 
23  if(this == &other) {
24  return *this;
25  }
26 
27  Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_bufferData,other.getBuffLength());
28  FW_ASSERT(Fw::FW_SERIALIZE_OK == stat,static_cast<NATIVE_INT_TYPE>(stat));
29  return *this;
30  }
31 
32  bool HashBuffer::operator==(const HashBuffer& other) const {
33  if( (this->getBuffLength() == other.getBuffLength()) &&
34  (memcmp(this->getBuffAddr(), other.getBuffAddr(), this->getBuffLength()) != 0) ){
35  return false;
36  }
37  return true;
38  }
39 
40  bool HashBuffer::operator!=(const HashBuffer& other) const {
41  return !(*this == other);
42  }
43 
44  const U8* HashBuffer::getBuffAddr() const {
45  return this->m_bufferData;
46  }
47 
49  return this->m_bufferData;
50  }
51 
53  return sizeof(this->m_bufferData);
54  }
55 }
Utils::HashBuffer::getBuffCapacity
NATIVE_UINT_TYPE getBuffCapacity() const
Definition: HashBufferCommon.cpp:52
Utils::HashBuffer::~HashBuffer
virtual ~HashBuffer()
Definition: HashBufferCommon.cpp:14
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition: Serializable.hpp:14
U8
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.hpp:76
Utils
Definition: CRCChecker.cpp:20
Utils::HashBuffer
A container class for holding a hash buffer.
Definition: HashBuffer.hpp:26
Fw::FW_SERIALIZE_OK
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
Definition: Serializable.hpp:15
Utils::HashBuffer::operator=
HashBuffer & operator=(const HashBuffer &other)
Definition: HashBufferCommon.cpp:22
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:30
Utils::HashBuffer::operator!=
bool operator!=(const HashBuffer &other) const
Definition: HashBufferCommon.cpp:40
Utils::HashBuffer::operator==
bool operator==(const HashBuffer &other) const
Definition: HashBufferCommon.cpp:32
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:8
Fw::SerializeBufferBase::getBuffLength
NATIVE_UINT_TYPE getBuffLength() const
returns current buffer size
Definition: Serializable.cpp:591
Fw::SerializeBufferBase::setBuff
SerializeStatus setBuff(const U8 *src, NATIVE_UINT_TYPE length)
sets buffer contents and size
Definition: Serializable.cpp:595
Utils::HashBuffer::getBuffAddr
U8 * getBuffAddr()
Definition: HashBufferCommon.cpp:44
Utils::HashBuffer::HashBuffer
HashBuffer()
Definition: HashBufferCommon.cpp:6
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
HashBuffer.hpp
Fw
Definition: Buffer.cpp:21