F´ Flight Software - C/C++ Documentation  devel
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 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:51
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:26
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
SerializeStatus setBuff(const U8 *src, NATIVE_UINT_TYPE length)
sets buffer contents and size
NATIVE_UINT_TYPE getBuffLength() const
returns current buffer size
A container class for holding a hash buffer.
Definition: HashBuffer.hpp:26
HashBuffer & operator=(const HashBuffer &other)
NATIVE_UINT_TYPE getBuffCapacity() const
bool operator==(const HashBuffer &other) const
bool operator!=(const HashBuffer &other) const
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.