Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fw::ExternalString and revise string implementations #2679

Merged
merged 40 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
171781b
Reformat cpp and hpp files in Fw/Types
bocchino Apr 12, 2024
aafbd6e
Revise string types
bocchino Apr 12, 2024
94b3d32
Merge branch 'format-fw-types' into external-string
bocchino Apr 12, 2024
00fb983
Revise string types
bocchino Apr 12, 2024
4c2ad7c
Revise string types
bocchino Apr 12, 2024
e536e88
Remove EightyCharString
bocchino Apr 12, 2024
9eaec83
Revise CmdString
bocchino Apr 12, 2024
91e78f9
Revise LogString
bocchino Apr 12, 2024
24a9242
Revise PrmString
bocchino Apr 12, 2024
e078a59
Revise TextLogString
bocchino Apr 12, 2024
33d7c75
Revise Test/String
bocchino Apr 12, 2024
d3c59db
Revise TlmString
bocchino Apr 12, 2024
d5c4cb2
Revise InternalInterfaceString
bocchino Apr 12, 2024
480e9d3
Revise Os/QueueString
bocchino Apr 12, 2024
5b9a4de
Revise Os/TaskString
bocchino Apr 12, 2024
10dce0c
Add missing type qualifier
bocchino Apr 13, 2024
5fd6b34
Fix warning in String.hpp
bocchino Apr 13, 2024
058e402
Revise string types
bocchino Apr 13, 2024
a6d2b43
Remove stray character
bocchino Apr 13, 2024
ce0616a
Revise StringBase
bocchino Apr 13, 2024
028ac4b
Revise string types
bocchino Apr 13, 2024
4e7ab41
Revise String type
bocchino Apr 13, 2024
ac44ee8
Revise FileNameString
bocchino Apr 13, 2024
3e589a9
Revise string types
bocchino Apr 13, 2024
a215ab7
Add missing file
bocchino Apr 13, 2024
74a2c37
Revise InternalInterfaceString
bocchino Apr 13, 2024
883e8a9
Revise comment
bocchino Apr 13, 2024
9af1b1d
Revise TlmString
bocchino Apr 13, 2024
3628e98
Revise string types
bocchino Apr 13, 2024
6ab639a
Revise log strings
bocchino Apr 13, 2024
9fea2d7
Revise PrmString
bocchino Apr 13, 2024
1d74568
Revise Os string classes
bocchino Apr 13, 2024
ad5a348
Revise string types
bocchino Apr 13, 2024
84c7b54
Revise string types
bocchino Apr 13, 2024
77e1a3b
Revise os strings
bocchino Apr 13, 2024
fe5f6b9
Add test for ExternalString to TypesTest
bocchino Apr 13, 2024
a616fc2
Revise ExternalString
bocchino Apr 13, 2024
4db1eb0
Revise ExternalString
bocchino Apr 13, 2024
9c575eb
Merge remote-tracking branch 'upstream/devel' into external-string
bocchino Apr 15, 2024
db35f81
Merge remote-tracking branch 'upstream/devel' into external-string
bocchino Apr 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Fw/Cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/CmdArgBuffer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CmdPacket.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Cmd.fpp"
"${CMAKE_CURRENT_LIST_DIR}/CmdString.cpp"
)
register_fprime_module()
55 changes: 0 additions & 55 deletions Fw/Cmd/CmdString.cpp

This file was deleted.

70 changes: 46 additions & 24 deletions Fw/Cmd/CmdString.hpp
Original file line number Diff line number Diff line change
@@ -1,37 +1,59 @@
#ifndef FW_CMD_STRING_TYPE_HPP
#define FW_CMD_STRING_TYPE_HPP
// ======================================================================
// @file CmdString.hpp
// @author F Prime
// @brief A string sized for a command argument
// ======================================================================

#ifndef FW_CMD_STRING_HPP
#define FW_CMD_STRING_HPP

#include <FpConfig.hpp>
#include <Fw/Types/StringType.hpp>
#include <Fw/Cfg/SerIds.hpp>

#include "Fw/Cfg/SerIds.hpp"
#include "Fw/Types/StringBase.hpp"

namespace Fw {

class CmdStringArg : public Fw::StringBase {
public:
class CmdStringArg final : public StringBase {
public:
LeStarch marked this conversation as resolved.
Show resolved Hide resolved
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_STR,
STRING_SIZE = FW_CMD_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
};

enum {
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_STR,
SERIALIZED_SIZE = FW_CMD_STRING_MAX_SIZE + sizeof(FwBuffSizeType)
};
CmdStringArg() : StringBase() { *this = ""; }

CmdStringArg(const char* src);
CmdStringArg(const StringBase& src);
CmdStringArg(const CmdStringArg& src);
CmdStringArg();
CmdStringArg& operator=(const CmdStringArg& other);
CmdStringArg& operator=(const StringBase& other);
CmdStringArg& operator=(const char* other);
~CmdStringArg();
CmdStringArg(const CmdStringArg& src) : StringBase() { *this = src; }

const char* toChar() const;
NATIVE_UINT_TYPE getCapacity() const ; //!< return buffer size
CmdStringArg(const StringBase& src) : StringBase() { *this = src; }

private:
CmdStringArg(const char* src) : StringBase() { *this = src; }

char m_buf[FW_CMD_STRING_MAX_SIZE];
};
~CmdStringArg() {}

CmdStringArg& operator=(const CmdStringArg& src) {
(void)StringBase::operator=(src);
return *this;
}

CmdStringArg& operator=(const StringBase& src) {
(void)StringBase::operator=(src);
return *this;
}

CmdStringArg& operator=(const char* src) {
(void)StringBase::operator=(src);
return *this;
}

const char* toChar() const { return this->m_buf; }

StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

}
private:
char m_buf[CmdStringArg::STRING_SIZE];
};
LeStarch marked this conversation as resolved.
Show resolved Hide resolved
} // namespace Fw

#endif
2 changes: 0 additions & 2 deletions Fw/Log/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/LogBuffer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LogPacket.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Log.fpp"
"${CMAKE_CURRENT_LIST_DIR}/LogString.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TextLogString.cpp"

)
register_fprime_module()
Expand Down
101 changes: 0 additions & 101 deletions Fw/Log/LogString.cpp

This file was deleted.

72 changes: 45 additions & 27 deletions Fw/Log/LogString.hpp
Original file line number Diff line number Diff line change
@@ -1,41 +1,59 @@
#ifndef FW_LOG_STRING_TYPE_HPP
#define FW_LOG_STRING_TYPE_HPP
// ======================================================================
// @file LogString.hpp
// @author F Prime
// @brief A string sized for an event log entry
// ======================================================================

#ifndef FW_LOG_STRING_HPP
#define FW_LOG_STRING_HPP

#include <FpConfig.hpp>
#include <Fw/Types/StringType.hpp>
#include <Fw/Cfg/SerIds.hpp>

#include "Fw/Cfg/SerIds.hpp"
#include "Fw/Types/StringBase.hpp"

namespace Fw {

class LogStringArg : public Fw::StringBase {
public:
class LogStringArg final : public StringBase {
public:
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_LOG_STR,
STRING_SIZE = FW_LOG_STRING_MAX_SIZE,
SERIALIZED_SIZE = STRING_SIZE + sizeof(FwSizeStoreType)
};

enum {
SERIALIZED_TYPE_ID = FW_TYPEID_LOG_STR,
SERIALIZED_SIZE = FW_LOG_STRING_MAX_SIZE + sizeof(FwBuffSizeType) // size of buffer + storage of two size words
};
LogStringArg() : StringBase() { *this = ""; }

LogStringArg();
LogStringArg(const LogStringArg& src); //!< LogStringArg string constructor
LogStringArg(const StringBase& src); //!< other string constructor
LogStringArg(const char* src); //!< char* source constructor
LogStringArg& operator=(const LogStringArg& other); //!< assignment operator
LogStringArg& operator=(const StringBase& other); //!< other string assignment operator
LogStringArg& operator=(const char* other); //!< char* assignment operator
~LogStringArg();
LogStringArg(const LogStringArg& src) : StringBase() { *this = src; }

const char* toChar() const override;
NATIVE_UINT_TYPE getCapacity() const override;
LogStringArg(const StringBase& src) : StringBase() { *this = src; }

SerializeStatus serialize(SerializeBufferBase& buffer) const override; //!< serialization function
SerializeStatus serialize(SerializeBufferBase& buffer, NATIVE_UINT_TYPE maxLen) const override; //!< serialization function
SerializeStatus deserialize(SerializeBufferBase& buffer) override; //!< deserialization function
LogStringArg(const char* src) : StringBase() { *this = src; }

private:
~LogStringArg() {}

char m_buf[FW_LOG_STRING_MAX_SIZE];
};
LogStringArg& operator=(const LogStringArg& src) {
(void)StringBase::operator=(src);
return *this;
}

LogStringArg& operator=(const StringBase& src) {
(void)StringBase::operator=(src);
return *this;
}

LogStringArg& operator=(const char* src) {
(void)StringBase::operator=(src);
return *this;
}

const char* toChar() const { return this->m_buf; }

StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }

}
private:
char m_buf[LogStringArg::STRING_SIZE];
};
} // namespace Fw

#endif
54 changes: 0 additions & 54 deletions Fw/Log/TextLogString.cpp

This file was deleted.

Loading
Loading