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

simple_writer: allow writeInfo() also in data section #4

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ add_subdirectory(ulog_cpp)

if(MAIN_PROJECT)
add_compile_options(
# always enable debug symbols (for stack trace)
-g

# Warnings
-Wall
-Wextra
Expand All @@ -30,7 +27,6 @@ if(MAIN_PROJECT)
# disabled warnings
-Wno-missing-field-initializers
-Wno-unused-parameter
-Wno-float-equal # TODO: this is required for cli11 2.3.2
)

# compiler specific flags
Expand Down
6 changes: 3 additions & 3 deletions ulog_cpp/messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ class Field {
* the attributes are dynamically computed in nested type resolution.
*/
struct TypeAttributes {
std::string name; ///< name of the type
BasicType type; ///< type as an enum
int size; ///< size in bytes. Recursively computed for nested types
std::string name; ///< name of the type
BasicType type{BasicType::NESTED}; ///< type as an enum
int size{0}; ///< size in bytes. Recursively computed for nested types
std::shared_ptr<MessageFormat> nested_message{nullptr}; /// < nested message format

TypeAttributes() = default;
Expand Down
5 changes: 1 addition & 4 deletions ulog_cpp/simple_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ class SimpleWriter {
~SimpleWriter();

/**
* Write a key-value info to the header. Typically used for versioning information.
* Write a key-value info. Typically used for versioning information and written to the header.
* @tparam T one of std::string, int32_t, float
* @param key (unique) name, e.g. sys_name
* @param value
*/
template <typename T>
void writeInfo(const std::string& key, const T& value)
{
if (_header_complete) {
throw UsageException("Header already complete");
}
_writer->messageInfo(ulog_cpp::MessageInfo(key, value));
}

Expand Down
Loading