Skip to content
Open
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
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module(
)

# Bazel global rules
bazel_dep(name = "bazel_skylib", version = "1.9.0")
bazel_dep(name = "rules_pkg", version = "1.1.0")
bazel_dep(name = "rules_python", version = "1.8.5")
bazel_dep(name = "rules_rust", version = "0.68.1-score")
Expand Down
16 changes: 16 additions & 0 deletions config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

config_setting(
name = "x86_64-linux",
define_values = {
Expand Down Expand Up @@ -52,3 +54,17 @@ config_setting(
name = "ub_sanitizer_enabled",
define_values = {"sanitize": "undefined"},
)

bool_flag(
name = "use_cout_log",
build_setting_default = False,
visibility = ["//visibility:public"],
)

config_setting(
name = "lm_use_cout_log",
flag_values = {
":use_cout_log": "True",
},
visibility = ["//visibility:public"],
)
1 change: 0 additions & 1 deletion src/control_client_lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ cc_library(
"//src/launch_manager_daemon/common:log",
"//src/launch_manager_daemon/common:osal",
"@score_baselibs//score/concurrency/future",
"@score_baselibs//score/mw/log",
],
)
8 changes: 8 additions & 0 deletions src/launch_manager_daemon/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,16 @@ cc_library(
cc_library(
name = "log",
hdrs = ["include/score/lcm/internal/log.hpp"],
defines = select({
"//config:lm_use_cout_log": [],
"//conditions:default": ["LC_LOG_SCORE_MW_LOG"],
}),
includes = ["include"],
visibility = ["//src:__subpackages__"],
deps = [] + select({
"//config:lm_use_cout_log": [],
"//conditions:default": ["@score_baselibs//score/mw/log"],
}),
)

cc_library(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
#define IDENTIFIER_HASH_H_

#include <cstddef>
#include <optional>
#include <ostream>
#include <sstream>
#include <string>
#include <string_view>
#include <unordered_map>

namespace score
{

namespace lcm
namespace score::lcm
{

/// @file identifier_hash.hpp
Expand Down Expand Up @@ -132,6 +129,27 @@ class IdentifierHash final
std::size_t hash_id_ = 0;
};

namespace detail
{

template <typename StreamT>
inline StreamT& streamIdentifierHash(StreamT& stream, const IdentifierHash& id_hash)
{
const auto& reg = IdentifierHash::get_registry();
const auto it = reg.find(id_hash.data());
if (it != reg.end())
{
stream << it->second;
}
else
{
stream << "<Unknown IdentifierHash: " << id_hash.data() << ">";
}
return stream;
}

} // namespace detail

/// @brief Overloaded stream insertion operator for IdentifierHash.
///
/// This operator allows IdentifierHash objects to be output to an ostream.
Expand All @@ -145,23 +163,27 @@ class IdentifierHash final
/// @param os The output stream.
/// @param id The IdentifierHash object to output.
/// @return A reference to the output stream.
inline std::ostream& operator<<(std::ostream& os, const IdentifierHash& id)
inline std::ostream& operator<<(std::ostream& os, const IdentifierHash& id) noexcept(false)
{
const auto& reg = IdentifierHash::get_registry();
const auto it = reg.find(id.data());
if (it != reg.end())
{
os << it->second;
}
else
{
os << "<Unknown IdentifierHash: " << id.data() << ">";
}
return os;
return detail::streamIdentifierHash(os, id);
}

} // namespace score::lcm

#ifdef LC_LOG_SCORE_MW_LOG
#include "score/mw/log/logger.h"

namespace score::lcm
{

inline score::mw::log::LogStream& operator<<(score::mw::log::LogStream& log_stream,
const IdentifierHash& id) noexcept(false)
{
return detail::streamIdentifierHash(log_stream, id);
}

} // namespace lcm
} // namespace score::lcm

} // namespace score
#endif // LC_LOG_SCORE_MW_LOG

#endif // IDENTIFIER_HASH_H_
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ enum class ProcessLimits : std::uint32_t {
maxLocalBuffSize = 32U ///< Maximum size for local buffer
};

// coverity[autosar_cpp14_a0_1_1_violation:INTENTIONAL] These are constants that are used globally.
constexpr std::uint32_t kCoreDumps = 1U; ///< Enable core dumps for managed processes (1 = enabled, 0 = disabled)

} // namespace lcm

} // namespace internal
Expand Down
Loading
Loading