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 15 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.

51 changes: 29 additions & 22 deletions Fw/Cmd/CmdString.hpp
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
// ======================================================================
// @file CmdString.hpp
// @author F Prime
// @brief A string sized for a command argument
// ======================================================================

#ifndef FW_CMD_STRING_TYPE_HPP
#define FW_CMD_STRING_TYPE_HPP

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

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

namespace Fw {

class CmdStringArg : public Fw::StringBase {
public:
class CmdStringArg : public ExternalString {
public:
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_STR,
SERIALIZED_SIZE = FW_CMD_STRING_MAX_SIZE + sizeof(FwSizeStoreType)
};

enum {
SERIALIZED_TYPE_ID = FW_TYPEID_CMD_STR,
SERIALIZED_SIZE = FW_CMD_STRING_MAX_SIZE + sizeof(FwBuffSizeType)
};
//!< zero-argument constructor
CmdStringArg() : ExternalString(this->m_buf, sizeof this->m_buf) {}

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();
//! const CmdStringArg& constructor
CmdStringArg(const CmdStringArg& src) : ExternalString(this->m_buf, sizeof this->m_buf, src) {}

const char* toChar() const;
NATIVE_UINT_TYPE getCapacity() const ; //!< return buffer size
//! const StringBase& constructor
CmdStringArg(const StringBase& src) : ExternalString(this->m_buf, sizeof this->m_buf, src) {}

Check warning

Code scanning / CppCheck

Single-parameter constructors should be marked explicit. Warning

Single-parameter constructors should be marked explicit.

private:
//!< const char* source constructor
CmdStringArg(const char* src) : ExternalString(this->m_buf, sizeof this->m_buf, src) {}

Check warning

Code scanning / CppCheck

Single-parameter constructors should be marked explicit. Warning

Single-parameter constructors should be marked explicit.

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

}
private:
char m_buf[FW_CMD_STRING_MAX_SIZE]; //!< storage for string data
};
} // 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.

55 changes: 29 additions & 26 deletions Fw/Log/LogString.hpp
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
// ======================================================================
// @file LogString.hpp
// @author F Prime
// @brief A string sized for an event log entry
// ======================================================================

#ifndef FW_LOG_STRING_TYPE_HPP
#define FW_LOG_STRING_TYPE_HPP

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

namespace Fw {
#include "Fw/Cfg/SerIds.hpp"
#include "Fw/Types/ExternalString.hpp"

class LogStringArg : public Fw::StringBase {
public:
namespace Fw {

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
};
class LogStringArg : public ExternalString {
public:
enum {
SERIALIZED_TYPE_ID = FW_TYPEID_LOG_STR,
SERIALIZED_SIZE = FW_LOG_STRING_MAX_SIZE + sizeof(FwSizeStoreType)
};

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();
//!< zero-argument constructor
LogStringArg() : ExternalString(this->m_buf, sizeof this->m_buf) {}

const char* toChar() const override;
NATIVE_UINT_TYPE getCapacity() const override;
//! const LogStringArg& constructor
LogStringArg(const LogStringArg& src) : ExternalString(this->m_buf, sizeof this->m_buf, 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
//! const StringBase& constructor
LogStringArg(const StringBase& src) : ExternalString(this->m_buf, sizeof this->m_buf, src) {}

Check warning

Code scanning / CppCheck

Single-parameter constructors should be marked explicit. Warning

Single-parameter constructors should be marked explicit.

private:
//!< const char* source constructor
LogStringArg(const char* src) : ExternalString(this->m_buf, sizeof this->m_buf, src) {}

Check warning

Code scanning / CppCheck

Single-parameter constructors should be marked explicit. Warning

Single-parameter constructors should be marked explicit.

char m_buf[FW_LOG_STRING_MAX_SIZE];
};
//! destructor
~LogStringArg() {}

}
private:
char m_buf[FW_LOG_STRING_MAX_SIZE]; //!< storage for string data
};
} // namespace Fw

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

This file was deleted.

Loading
Loading