F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
ObjectName.hpp
Go to the documentation of this file.
1// ======================================================================
2// @file ObjectName.hpp
3// @author F Prime
4// @brief A string sized to store an object name
5// ======================================================================
6
7#ifndef FW_OBJECT_NAME_HPP
8#define FW_OBJECT_NAME_HPP
9
10#include <FpConfig.hpp>
11
12#include "Fw/Cfg/SerIds.hpp"
14
15namespace Fw {
16
17class ObjectName final : public StringBase {
18 public:
19 enum {
21 STRING_SIZE = FW_OBJ_NAME_BUFFER_SIZE,
23 };
24
25 ObjectName() : StringBase() { *this = ""; }
26
27 explicit ObjectName(const ObjectName& src) : StringBase() { *this = src; }
28
29 explicit ObjectName(const StringBase& src) : StringBase() { *this = src; }
30
31 explicit ObjectName(const char* src) : StringBase() { *this = src; }
32
34
36 (void)StringBase::operator=(src);
37 return *this;
38 }
39
41 (void)StringBase::operator=(src);
42 return *this;
43 }
44
45 ObjectName& operator=(const char* src) {
46 (void)StringBase::operator=(src);
47 return *this;
48 }
49
50 const char* toChar() const { return this->m_buf; }
51
52 StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }
53
54 private:
55 char m_buf[BUFFER_SIZE(STRING_SIZE)];
56};
57} // namespace Fw
58
59#endif
C++-compatible configuration header for fprime configuration.
Definitions for ISF type serial IDs.
Declares F Prime string base class.
ObjectName & operator=(const ObjectName &src)
const char * toChar() const
StringBase::SizeType getCapacity() const
return size of buffer
ObjectName(const StringBase &src)
ObjectName & operator=(const StringBase &src)
ObjectName(const ObjectName &src)
ObjectName(const char *src)
ObjectName & operator=(const char *src)
NATIVE_UINT_TYPE SizeType
static constexpr SizeType STATIC_SERIALIZED_SIZE(SizeType maxLength)
static constexpr SizeType BUFFER_SIZE(SizeType maxLength)
Get the size of a null-terminated string buffer.
@ FW_TYPEID_OBJECT_NAME
ObjectName string Buffer type id.
Definition SerIds.hpp:60