Skip to content

Commit 81fecb8

Browse files
Uncrustify
Signed-off-by: Eugenio Collado <eugeniocollado@eprosima.com>
1 parent 6a37416 commit 81fecb8

53 files changed

Lines changed: 7808 additions & 8835 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ddsenabler/examples/action/CLIParser.hpp

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,48 @@ class CLIParser
4949
static void print_help(
5050
uint8_t return_code)
5151
{
52-
std::cout << "Usage: ddsenabler_example_action [options]" << std::endl;
53-
std::cout << "" << std::endl;
54-
std::cout << "--config <str> Path to the configuration file" << std::endl;
55-
std::cout << " (Default: '')" << std::endl;
56-
std::cout << "--action-name <str> Name of the action to be registered" << std::endl;
57-
std::cout << " (Default: 'Fibonacci/_action/')" << std::endl;
58-
std::cout << "-client Run as a client (mutually exclusive with -server)" << std::endl;
59-
std::cout << "-server Run as a server (mutually exclusive with -client)" << std::endl;
60-
std::cout << "--timeout <num> Time (seconds) to wait before stopping the" << std::endl;
61-
std::cout << " program if expectations are not met" << std::endl;
62-
std::cout << " (Default: 30)" << std::endl;
63-
std::cout << "--persistence-path <str> Path to the persistence directory" << std::endl;
64-
std::cout << " (Default: '')" << std::endl;
65-
std::cout << "\n-------------------------------------SERVER OPTIONS------------------------------------\n" << std::endl;
66-
std::cout << "--expected-requests <num> Number of requests expected to be received" << std::endl;
67-
std::cout << "\n-------------------------------------CLIENT OPTIONS------------------------------------\n" << std::endl;
68-
std::cout << "--request-initial-wait <num> Time (seconds) to wait before starting" << std::endl;
69-
std::cout << " requests publication since server matching" << std::endl;
70-
std::cout << " (Default: 0)" << std::endl;
71-
std::cout << "--cancel-requests <bool> Whether to cancel requests after sending them" << std::endl;
72-
std::cout << " (Default: false)" << std::endl;
52+
std::cout << "Usage: ddsenabler_example_action [options]" <<
53+
std::endl;
54+
std::cout << "" <<
55+
std::endl;
56+
std::cout << "--config <str> Path to the configuration file" <<
57+
std::endl;
58+
std::cout << " (Default: '')" <<
59+
std::endl;
60+
std::cout << "--action-name <str> Name of the action to be registered" <<
61+
std::endl;
62+
std::cout << " (Default: 'Fibonacci/_action/')" <<
63+
std::endl;
64+
std::cout << "-client Run as a client (mutually exclusive with -server)" <<
65+
std::endl;
66+
std::cout << "-server Run as a server (mutually exclusive with -client)" <<
67+
std::endl;
68+
std::cout << "--timeout <num> Time (seconds) to wait before stopping the" <<
69+
std::endl;
70+
std::cout << " program if expectations are not met" <<
71+
std::endl;
72+
std::cout << " (Default: 30)" <<
73+
std::endl;
74+
std::cout << "--persistence-path <str> Path to the persistence directory" <<
75+
std::endl;
76+
std::cout << " (Default: '')" <<
77+
std::endl;
78+
std::cout << "\n-------------------------------------SERVER OPTIONS------------------------------------\n" <<
79+
std::endl;
80+
std::cout << "--expected-requests <num> Number of requests expected to be received" <<
81+
std::endl;
82+
std::cout << "\n-------------------------------------CLIENT OPTIONS------------------------------------\n" <<
83+
std::endl;
84+
std::cout << "--request-initial-wait <num> Time (seconds) to wait before starting" <<
85+
std::endl;
86+
std::cout << " requests publication since server matching" <<
87+
std::endl;
88+
std::cout << " (Default: 0)" <<
89+
std::endl;
90+
std::cout << "--cancel-requests <bool> Whether to cancel requests after sending them" <<
91+
std::endl;
92+
std::cout << " (Default: false)" <<
93+
std::endl;
7394
std::exit(return_code);
7495
}
7596

@@ -196,7 +217,8 @@ class CLIParser
196217
}
197218
catch (const std::exception& e)
198219
{
199-
std::cerr << "Invalid --expected-requests argument " << argv[i] << ": " << e.what() << std::endl;
220+
std::cerr << "Invalid --expected-requests argument " << argv[i] << ": " << e.what() <<
221+
std::endl;
200222
print_help(EXIT_FAILURE);
201223
}
202224
}
@@ -216,7 +238,8 @@ class CLIParser
216238
}
217239
catch (const std::exception& e)
218240
{
219-
std::cerr << "Invalid --request-initial-wait argument " << argv[i] << ": " << e.what() << std::endl;
241+
std::cerr << "Invalid --request-initial-wait argument " << argv[i] << ": " << e.what() <<
242+
std::endl;
220243
print_help(EXIT_FAILURE);
221244
}
222245
}
@@ -231,8 +254,8 @@ class CLIParser
231254
if (++i < argc)
232255
{
233256
config.cancel_requests = (std::string(argv[i]) == "true") ||
234-
(std::string(argv[i]) == "True") ||
235-
(std::string(argv[i]) == "1");
257+
(std::string(argv[i]) == "True") ||
258+
(std::string(argv[i]) == "1");
236259
}
237260
else
238261
{

ddsenabler/examples/action/main.cpp

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ static void test_type_notification_callback(
8080
std::lock_guard<std::mutex> lock(app_mutex_);
8181
std::cout << "Type callback received: " << type_name << std::endl;
8282
if (!config.persistence_path.empty() &&
83-
!utils::save_type_to_file((std::filesystem::path(config.persistence_path) / TYPES_SUBDIR).string(), type_name,
83+
!utils::save_type_to_file((std::filesystem::path(config.persistence_path) / TYPES_SUBDIR).string(),
84+
type_name,
8485
serialized_type_internal, serialized_type_internal_size))
8586
{
8687
std::cerr << "Failed to save type: " << type_name << std::endl;
@@ -143,7 +144,7 @@ static void test_action_notification_callback(
143144
std::cout << "Action callback received: " << action_name << std::endl;
144145

145146
std::string action_file = (std::filesystem::path(
146-
config.persistence_path) /
147+
config.persistence_path) /
147148
ACTION_SUBDIR
148149
).string();
149150
if (!config.persistence_path.empty())
@@ -191,28 +192,28 @@ static bool test_action_query_callback(
191192
if (!config.persistence_path.empty())
192193
{
193194
std::string action_file = (std::filesystem::path(
194-
config.persistence_path) /
195+
config.persistence_path) /
195196
ACTION_SUBDIR
196197
).string();
197198
if (!utils::load_action_from_file(
198-
action_file,
199-
action_name,
200-
action_info.goal.request.type_name,
201-
action_info.goal.reply.type_name,
202-
action_info.cancel.request.type_name,
203-
action_info.cancel.reply.type_name,
204-
action_info.result.request.type_name,
205-
action_info.result.reply.type_name,
206-
action_info.feedback.type_name,
207-
action_info.status.type_name,
208-
action_info.goal.request.serialized_qos,
209-
action_info.goal.reply.serialized_qos,
210-
action_info.cancel.request.serialized_qos,
211-
action_info.cancel.reply.serialized_qos,
212-
action_info.result.request.serialized_qos,
213-
action_info.result.reply.serialized_qos,
214-
action_info.feedback.serialized_qos,
215-
action_info.status.serialized_qos))
199+
action_file,
200+
action_name,
201+
action_info.goal.request.type_name,
202+
action_info.goal.reply.type_name,
203+
action_info.cancel.request.type_name,
204+
action_info.cancel.reply.type_name,
205+
action_info.result.request.type_name,
206+
action_info.result.reply.type_name,
207+
action_info.feedback.type_name,
208+
action_info.status.type_name,
209+
action_info.goal.request.serialized_qos,
210+
action_info.goal.reply.serialized_qos,
211+
action_info.cancel.request.serialized_qos,
212+
action_info.cancel.reply.serialized_qos,
213+
action_info.result.request.serialized_qos,
214+
action_info.result.reply.serialized_qos,
215+
action_info.feedback.serialized_qos,
216+
action_info.status.serialized_qos))
216217
{
217218
std::cerr << "Failed to load action: " << action_name << std::endl;
218219
return false;
@@ -354,7 +355,6 @@ bool wait_for_action_result(
354355
return true;
355356
}
356357

357-
358358
bool client_routine(
359359
std::shared_ptr<eprosima::ddsenabler::DDSEnabler> enabler,
360360
const std::string& action_name,
@@ -440,9 +440,9 @@ bool server_specific_logic(
440440
std::string feedback_tmp = feedback_json;
441441
feedback_tmp += "]}";
442442
if (!enabler->send_action_feedback(
443-
action_name.c_str(),
444-
feedback_tmp.c_str(),
445-
request_id))
443+
action_name.c_str(),
444+
feedback_tmp.c_str(),
445+
request_id))
446446
{
447447
std::cerr << "Failed to send action feedback" << std::endl;
448448
return false;
@@ -457,10 +457,10 @@ bool server_specific_logic(
457457
json += "]}";
458458

459459
if (!enabler->send_action_result(
460-
action_name.c_str(),
461-
request_id,
462-
eprosima::ddsenabler::participants::STATUS_CODE::STATUS_SUCCEEDED,
463-
json.c_str()))
460+
action_name.c_str(),
461+
request_id,
462+
eprosima::ddsenabler::participants::STATUS_CODE::STATUS_SUCCEEDED,
463+
json.c_str()))
464464
{
465465
std::cerr << "Failed to send action result" << std::endl;
466466
return false;
@@ -499,11 +499,11 @@ bool server_routine(
499499
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // Simulate processing time
500500

501501
// Send Feedback & Result
502-
if(!server_specific_logic(
503-
enabler,
504-
action_name,
505-
fibonacci_number,
506-
request_id))
502+
if (!server_specific_logic(
503+
enabler,
504+
action_name,
505+
fibonacci_number,
506+
request_id))
507507
{
508508
std::cerr << "Failed to process action: " << action_name << " with request ID: " << request_id << std::endl;
509509
return false;
@@ -595,8 +595,11 @@ int main(
595595
}
596596
else
597597
{
598-
auto goal_path = config.persistence_path.empty() ? std::string() : (std::filesystem::path(config.persistence_path) / REQUESTS_SUBDIR).string();
599-
ret = client_routine(enabler, config.action_name, goal_path, config.timeout, config.request_initial_wait, config.cancel_requests);
598+
auto goal_path =
599+
config.persistence_path.empty() ? std::string() : (std::filesystem::path(config.persistence_path) /
600+
REQUESTS_SUBDIR).string();
601+
ret = client_routine(enabler, config.action_name, goal_path, config.timeout, config.request_initial_wait,
602+
config.cancel_requests);
600603
}
601604

602605
return ret ? EXIT_SUCCESS : EXIT_FAILURE;

ddsenabler/examples/publish/main.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ static void test_type_notification_callback(
8888
std::cout << "Type callback received: " << type_name << ", Total types: " <<
8989
received_types_ << std::endl << serialized_type << std::endl << std::endl;
9090
if (!config.persistence_path.empty() &&
91-
!utils::save_type_to_file((std::filesystem::path(config.persistence_path) / TYPES_SUBDIR).string(), type_name,
91+
!utils::save_type_to_file((std::filesystem::path(config.persistence_path) / TYPES_SUBDIR).string(),
92+
type_name,
9293
serialized_type_internal, serialized_type_internal_size))
9394
{
9495
std::cerr << "Failed to save type: " << type_name << std::endl;
@@ -131,7 +132,8 @@ static void test_topic_notification_callback(
131132
{
132133
std::lock_guard<std::mutex> lock(app_mutex_);
133134
notify = ++received_topics_ >= config.expected_topics;
134-
std::cout << "Topic callback received: " << topic_name << " of type " << topic_info.type_name << ", Total topics: " <<
135+
std::cout << "Topic callback received: " << topic_name << " of type " << topic_info.type_name <<
136+
", Total topics: " <<
135137
received_topics_ << std::endl << topic_info.serialized_qos << std::endl << std::endl;
136138
if (!config.persistence_path.empty() &&
137139
!utils::save_topic_to_file((std::filesystem::path(config.persistence_path) / TOPICS_SUBDIR).string(),
@@ -159,7 +161,8 @@ static bool test_topic_query_callback(
159161
}
160162

161163
// Load the topic from file
162-
if (!utils::load_topic_from_file((std::filesystem::path(config.persistence_path) / TOPICS_SUBDIR).string(), topic_name,
164+
if (!utils::load_topic_from_file((std::filesystem::path(config.persistence_path) / TOPICS_SUBDIR).string(),
165+
topic_name,
163166
topic_info.type_name,
164167
topic_info.serialized_qos))
165168
{

0 commit comments

Comments
 (0)