Skip to content

Commit

Permalink
Remove redundant ostream manipulators sync update (#775)
Browse files Browse the repository at this point in the history
adding more ostream changes as 0ba13d3 

---------
  • Loading branch information
duartenfonseca authored Nov 28, 2024
1 parent 0e5bfbc commit e2a10a4
Show file tree
Hide file tree
Showing 93 changed files with 950 additions and 880 deletions.
6 changes: 3 additions & 3 deletions examples/request-sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class client_sample {

void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::cout << "Service ["
<< std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
<< std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance
<< "] is "
<< (_is_available ? "available." : "NOT available.")
<< std::endl;
Expand All @@ -125,7 +125,7 @@ class client_sample {

void on_message(const std::shared_ptr< vsomeip::message > &_response) {
std::cout << "Received a response from Service ["
<< std::setfill('0') << std::hex
<< std::hex << std::setfill('0')
<< std::setw(4) << _response->get_service()
<< "."
<< std::setw(4) << _response->get_instance()
Expand Down Expand Up @@ -156,7 +156,7 @@ class client_sample {
if (is_available_) {
app_->send(request_);
std::cout << "Client/Session ["
<< std::setfill('0') << std::hex
<< std::hex << std::setfill('0')
<< std::setw(4) << request_->get_client()
<< "/"
<< std::setw(4) << request_->get_session()
Expand Down
2 changes: 1 addition & 1 deletion examples/response-sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class service_sample {

void on_message(const std::shared_ptr<vsomeip::message> &_request) {
std::cout << "Received a message with Client/Session ["
<< std::setfill('0') << std::hex
<< std::hex << std::setfill('0')
<< std::setw(4) << _request->get_client() << "/"
<< std::setw(4) << _request->get_session() << "]"
<< std::endl;
Expand Down
8 changes: 4 additions & 4 deletions examples/subscribe-sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class client_sample {

void on_availability(vsomeip::service_t _service, vsomeip::instance_t _instance, bool _is_available) {
std::cout << "Service ["
<< std::setw(4) << std::setfill('0') << std::hex << _service << "." << _instance
<< std::hex << std::setfill('0') << std::setw(4) << _service << "." << _instance
<< "] is "
<< (_is_available ? "available." : "NOT available.")
<< std::endl;
Expand All @@ -89,7 +89,7 @@ class client_sample {
void on_message(const std::shared_ptr<vsomeip::message> &_response) {
std::stringstream its_message;
its_message << "Received a notification for Event ["
<< std::setfill('0') << std::hex
<< std::hex << std::setfill('0')
<< std::setw(4) << _response->get_service() << "."
<< std::setw(4) << _response->get_instance() << "."
<< std::setw(4) << _response->get_method() << "] to Client/Session ["
Expand All @@ -99,9 +99,9 @@ class client_sample {
std::shared_ptr<vsomeip::payload> its_payload =
_response->get_payload();
its_message << "(" << std::dec << its_payload->get_length() << ") "
<< std::hex << std::setw(2);
<< std::hex;
for (uint32_t i = 0; i < its_payload->get_length(); ++i)
its_message << std::setw(2) << (int) its_payload->get_data()[i] << " ";
its_message << std::setw(2) << static_cast<int>(its_payload->get_data()[i]) << " ";
std::cout << its_message.str() << std::endl;

if (_response->get_client() == 0) {
Expand Down
13 changes: 7 additions & 6 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ bool configuration_impl::remote_offer_info_add(service_t _service,
auto found_instance = found_service->second.find(its_service->instance_);
if (found_instance != found_service->second.end()) {
VSOMEIP_INFO << "Updating remote configuration for service ["
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< its_service->service_ << "." << its_service->instance_ << "]";
if (_reliable) {
found_instance->second->reliable_ = its_service->reliable_;
Expand Down Expand Up @@ -451,7 +451,7 @@ bool configuration_impl::remote_offer_info_remove(service_t _service,
auto found_instance = found_service->second.find(_instance);
if (found_instance != found_service->second.end()) {
VSOMEIP_INFO << "Removing remote configuration for service ["
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< _service << "." << _instance << "]";
if (_reliable) {
found_instance->second->reliable_ = ILLEGAL_PORT;
Expand Down Expand Up @@ -2776,7 +2776,7 @@ configuration_impl::load_partition(const boost::property_tree::ptree &_tree) {
for (const auto &m : p.second) {
partitions_[p.first][m] = its_partition_id;
its_log << "<"
<< std::setfill('0') << std::hex
<< std::hex << std::setfill('0')
<< std::setw(4) << p.first << "."
<< std::setw(4) << m
<< ">";
Expand Down Expand Up @@ -3018,8 +3018,9 @@ bool configuration_impl::get_client_port(

// Configured ports do exist, but they are all in use
VSOMEIP_ERROR << "Cannot find free client port for communication to service ["
<< std::hex << std::setw(4) << std::setfill('0') << _service << "."
<< std::hex << std::setw(4) << std::setfill('0') << _instance << "."
<< std::hex << std::setfill('0')
<< std::setw(4) << _service << "."
<< std::setw(4) << _instance << "."
<< std::dec << _remote_port << "."
<< std::boolalpha <<_reliable << "]";

Expand Down Expand Up @@ -4475,7 +4476,7 @@ void configuration_impl::load_someip_tp_for_service(
<< std::setw(4) << its_method << "]:"
<< " using (" << std::dec
<< its_entry->second.first << ", "
<< std::dec << its_entry->second.second << ")";
<< its_entry->second.second << ")";
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion implementation/e2e_protection/src/buffer/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ std::ostream &operator<<(std::ostream &_os, const e2e_buffer &_buffer) {
if (isupper(b)) {
_os << b;
} else {
_os << "[" << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)b << std::dec << "]";
_os << "[" << std::hex << std::setfill('0') << std::setw(2) << (uint32_t)b << std::dec << "]";
}
}
return _os;
Expand Down
37 changes: 20 additions & 17 deletions implementation/endpoints/src/client_endpoint_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ bool client_endpoint_impl<Protocol>::send(const uint8_t *_data, uint32_t _size)
std::stringstream msg;
msg << "cei::send: ";
for (uint32_t i = 0; i < _size; i++)
msg << std::hex << std::setw(2) << std::setfill('0') << (int)_data[i] << " ";
msg << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(_data[i]) << " ";
VSOMEIP_DEBUG << msg.str();
#endif

Expand Down Expand Up @@ -579,10 +579,11 @@ void client_endpoint_impl<Protocol>::send_cbk(
<< _error.value() << ") " << get_remote_information()
<< " " << std::dec << queue_.size()
<< " " << std::dec << queue_size_ << " ("
<< std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
<< std::hex << std::setw(4) << std::setfill('0') << its_method << "."
<< std::hex << std::setw(4) << std::setfill('0') << its_session << "]"
<< std::hex << std::setfill('0')
<< std::setw(4) << its_client << "): ["
<< std::setw(4) << its_service << "."
<< std::setw(4) << its_method << "."
<< std::setw(4) << its_session << "]"
<< " endpoint > " << this << " socket state > " << static_cast<int>(state_.load());
}
}
Expand Down Expand Up @@ -645,12 +646,13 @@ void client_endpoint_impl<Protocol>::send_cbk(
VSOMEIP_WARNING << "cei::send_cbk received error: " << _error.message()
<< " (" << std::dec << _error.value() << ") "
<< get_remote_information() << " "
<< " " << std::dec << queue_.size()
<< " " << std::dec << queue_size_ << " ("
<< std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
<< std::hex << std::setw(4) << std::setfill('0') << its_method << "."
<< std::hex << std::setw(4) << std::setfill('0') << its_session << "]"
<< " " << queue_.size()
<< " " << queue_size_ << " ("
<< std::hex << std::setfill('0')
<< std::setw(4) << its_client << "): ["
<< std::setw(4) << its_service << "."
<< std::setw(4) << its_method << "."
<< std::setw(4) << its_session << "]"
<< " endpoint > " << this << " socket state > " << static_cast<int>(state_.load());
print_status();
}
Expand Down Expand Up @@ -776,7 +778,7 @@ typename endpoint_impl<Protocol>::cms_ret_e client_endpoint_impl<Protocol>::chec
const service_t its_service = bithelper::read_uint16_be(&_data[VSOMEIP_SERVICE_POS_MIN]);
const method_t its_method = bithelper::read_uint16_be(&_data[VSOMEIP_METHOD_POS_MIN]);
instance_t its_instance = this->get_instance(its_service);

if (its_instance != ANY_INSTANCE) {
if (tp_segmentation_enabled(its_service, its_instance, its_method)) {
std::uint16_t its_max_segment_length;
Expand Down Expand Up @@ -824,12 +826,13 @@ bool client_endpoint_impl<Protocol>::check_queue_limit(const uint8_t *_data, std
VSOMEIP_ERROR << "cei::check_queue_limit: queue size limit (" << std::dec
<< endpoint_impl<Protocol>::queue_limit_
<< ") reached. Dropping message ("
<< std::hex << std::setw(4) << std::setfill('0') << its_client <<"): ["
<< std::hex << std::setw(4) << std::setfill('0') << its_service << "."
<< std::hex << std::setw(4) << std::setfill('0') << its_method << "."
<< std::hex << std::setw(4) << std::setfill('0') << its_session << "] "
<< std::hex << std::setfill('0')
<< std::setw(4) << its_client << "): ["
<< std::setw(4) << its_service << "."
<< std::setw(4) << its_method << "."
<< std::setw(4) << its_session << "] "
<< "queue_size: " << std::dec << queue_size_
<< " data size: " << std::dec << _size;
<< " data size: " << _size;
return false;
}
return true;
Expand Down
14 changes: 7 additions & 7 deletions implementation/endpoints/src/endpoint_manager_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ std::shared_ptr<endpoint> endpoint_manager_base::create_local_server(
its_local_server = its_tmp;
} else {
VSOMEIP_ERROR << "Local UDS server endpoint initialization failed. Client "
<< std::hex << std::setw(4) << std::setfill('0') << its_client
<< std::hex << std::setfill('0') << std::setw(4) << its_client
<< " Path: " << its_path.str() << " Reason: " << its_error.message();
}
} else {
VSOMEIP_ERROR << "Local UDS server endpoint creation failed. Client "
<< std::hex << std::setw(4) << std::setfill('0') << its_client
<< std::hex << std::setfill('0') << std::setw(4) << its_client
<< " Path: " << its_path.str() << " Reason: out_of_memory";
}
} catch (const std::exception& e) {
Expand Down Expand Up @@ -178,12 +178,12 @@ std::shared_ptr<endpoint> endpoint_manager_base::create_local_server(
rm_->add_guest(its_client, its_address, its_port);
} else {
VSOMEIP_ERROR << __func__ << ": Local TCP server endpoint initialization failed. "
<< "Client " << std::hex << std::setw(4) << std::setfill('0') << its_client
<< "Client " << std::hex << std::setfill('0') << std::setw(4) << its_client
<< " Reason: No local port available!";
}
} else {
VSOMEIP_ERROR << __func__ << ": Local TCP server endpoint creation failed. "
<< "Client " << std::hex << std::setw(4) << std::setfill('0') << its_client
<< "Client " << std::hex << std::setfill('0') << std::setw(4) << its_client
<< " Reason: No local port available!";
}
} catch (const std::exception& e) {
Expand Down Expand Up @@ -314,11 +314,11 @@ endpoint_manager_base::create_local_unlocked(client_t _client) {
io_, configuration_);

VSOMEIP_INFO << "Client ["
<< std::hex << std::setw(4) << std::setfill('0') << rm_->get_client()
<< std::hex << std::setfill('0') << std::setw(4) << rm_->get_client()
<< "] @ "
<< its_local_address.to_string() << ":" << std::dec << local_port_
<< " is connecting to ["
<< std::hex << std::setw(4) << std::setfill('0') << _client << "] @ "
<< std::hex << std::setfill('0') << std::setw(4) << _client << "] @ "
<< its_remote_address.to_string() << ":" << std::dec << its_remote_port
<< " endpoint > " << its_endpoint;

Expand All @@ -327,7 +327,7 @@ endpoint_manager_base::create_local_unlocked(client_t _client) {
} else {
VSOMEIP_ERROR << __func__
<< ": Cannot get guest address of client ["
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< _client << "]";
}
}
Expand Down
14 changes: 7 additions & 7 deletions implementation/endpoints/src/endpoint_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,10 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr<endpoint>& _root
if (configuration_->is_security_enabled() && get_client() != its_routing_host_id) {
VSOMEIP_ERROR << "endpoint_manager_impl::" << __func__ << ": "
<< "Client ["
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< get_client()
<< "] does not match the configured routing manager client identifier ["
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< its_routing_host_id
<< "]";

Expand Down Expand Up @@ -682,7 +682,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr<endpoint>& _root
its_root->init(its_endpoint, its_socket, its_error);
if (its_error) {
VSOMEIP_ERROR << "Routing endpoint creation failed. Client ID: "
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< VSOMEIP_ROUTING_CLIENT << ": " << its_error.message();

its_root->deinit();
Expand Down Expand Up @@ -714,7 +714,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr<endpoint>& _root
its_root->init(its_endpoint, its_error);
if (its_error) {
VSOMEIP_ERROR << "Local routing endpoint creation failed. Client ID: "
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< VSOMEIP_ROUTING_CLIENT << ": " << its_error.message();

its_root->deinit();
Expand Down Expand Up @@ -744,7 +744,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr<endpoint>& _root
its_root->init(its_endpoint, its_error);
if (its_error) {
VSOMEIP_ERROR << "Local routing endpoint creation failed. Client ID: "
<< std::hex << std::setw(4) << std::setfill('0')
<< std::hex << std::setfill('0') << std::setw(4)
<< VSOMEIP_ROUTING_CLIENT << ": " << its_error.message();
its_root->deinit();
return false;
Expand Down Expand Up @@ -778,7 +778,7 @@ bool endpoint_manager_impl::create_routing_root(std::shared_ptr<endpoint>& _root
if (its_error) {
VSOMEIP_ERROR << "endpoint_manager_impl::create_routing_root: "
<< "Remote routing root endpoint creation failed (" << its_retry << ") "
<< "Client: " << std::hex << std::setw(4) << std::setfill('0')
<< "Client: " << std::hex << std::setfill('0') << std::setw(4)
<< VSOMEIP_ROUTING_CLIENT << ": " << its_error.message();

its_root->deinit();
Expand Down Expand Up @@ -1274,7 +1274,7 @@ endpoint_manager_impl::log_client_states() const {

size_t its_max(std::min(size_t(5), its_client_queue_sizes.size()));
for (size_t i = 0; i < its_max; i++) {
its_log << std::hex << std::setw(4) << std::setfill('0')
its_log << std::hex << std::setfill('0') << std::setw(4)
<< std::get<0>(its_client_queue_sizes[i].first).to_string()
<< ":" << std::dec << std::get<1>(its_client_queue_sizes[i].first)
<< "(" << (std::get<2>(its_client_queue_sizes[i].first) ? "tcp" : "udp") << "):"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ bool local_tcp_client_endpoint_impl::send(const uint8_t *_data, uint32_t _size)
std::stringstream msg;
msg << "lce::send: ";
for (uint32_t i = 0; i < _size; i++)
msg << std::hex << std::setw(2) << std::setfill('0')
<< (int)_data[i] << " ";
msg << std::hex << std::setfill('0') << std::setw(2)
<< static_cast<int>(_data[i]) << " ";
VSOMEIP_INFO << msg.str();
#endif
train_->buffer_->insert(train_->buffer_->end(), _data, _data + _size);
Expand Down Expand Up @@ -312,8 +312,8 @@ void local_tcp_client_endpoint_impl::receive_cbk(
std::stringstream msg;
msg << "lce<" << this << ">::recv: ";
for (std::size_t i = 0; i < recv_buffer_.size(); i++)
msg << std::setw(2) << std::setfill('0') << std::hex
<< (int)recv_buffer_[i] << " ";
msg << std::hex << std::setfill('0') << std::setw(2)
<< static_cast<int>(recv_buffer_[i]) << " ";
VSOMEIP_INFO << msg.str();
#endif

Expand Down
Loading

0 comments on commit e2a10a4

Please sign in to comment.