Skip to content

Commit 49b398a

Browse files
committed
Refs #23701. Remove feed operations from example.
Signed-off-by: Miguel Company <[email protected]>
1 parent 38f6b07 commit 49b398a

17 files changed

+168
-6415
lines changed

examples/cpp/rpc/CLIParser.hpp

Lines changed: 0 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ class CLIParser
5050
ADDITION,
5151
SUBSTRACTION,
5252
REPRESENTATION_LIMITS,
53-
FIBONACCI,
54-
SUM_ALL,
55-
ACCUMULATOR,
56-
FILTER,
5753
UNDEFINED
5854
};
5955

@@ -105,30 +101,6 @@ class CLIParser
105101
std::cout << " -r, --representation-limits Computes the representation" << std::endl;
106102
std::cout << " limits of a 32-bit integer" << std::endl;
107103
std::cout << " " << std::endl;
108-
std::cout << " -f <num>, --fibonacci <num> Returns a feed of results" << std::endl;
109-
std::cout << " with the <num> first elements" <<
110-
std::endl;
111-
std::cout << " of the Fibonacci sequence" << std::endl;
112-
std::cout << " " << std::endl;
113-
std::cout << " --sum-all Sum all the values provided" << std::endl;
114-
std::cout << " in the input feed" << std::endl;
115-
std::cout << " " << std::endl;
116-
std::cout << " --accumulator Return a feed of results" << std::endl;
117-
std::cout << " with the sum of all received" << std::endl;
118-
std::cout << " values from an input feed" << std::endl;
119-
std::cout << " " << std::endl;
120-
std::cout << " --filter <filter_kind> Return a feed of results" << std::endl;
121-
std::cout << " with the values that match" << std::endl;
122-
std::cout << " the input filter kind" << std::endl;
123-
std::cout << " [<filter_kind> = 0, 1, 2]" << std::endl;
124-
std::cout << " [0 = EVEN," << std::endl;
125-
std::cout << " 1 = ODD," << std::endl;
126-
std::cout << " 2 = PRIME]" << std::endl;
127-
std::cout << " " << std::endl;
128-
std::cout << " --feed <list> Provide a feed instead of " << std::endl;
129-
std::cout << " capturing from stdin in the " << std::endl;
130-
std::cout << " form of <num>,<num>,<num> " << std::endl;
131-
std::cout << " [default: empty]" << std::endl;
132104
std::cout << " --connection-attempts <num> Number of attempts to connect" <<
133105
std::endl;
134106
std::cout << " to a server before failing" << std::endl;
@@ -288,104 +260,6 @@ class CLIParser
288260
print_help(EXIT_FAILURE);
289261
}
290262
}
291-
else if (arg == "-f" || arg == "--fibonacci")
292-
{
293-
if (config.entity == CLIParser::EntityKind::CLIENT)
294-
{
295-
if (CLIParser::OperationKind::UNDEFINED != config.operation)
296-
{
297-
EPROSIMA_LOG_ERROR(CLI_PARSER, "Only one operation can be selected");
298-
print_help(EXIT_FAILURE);
299-
}
300-
301-
if (++i < argc)
302-
{
303-
config.n_results = consume_integer_argument<std::uint32_t>(argv[i], arg);
304-
}
305-
else
306-
{
307-
EPROSIMA_LOG_ERROR(CLI_PARSER, "missing fibonacci argument");
308-
print_help(EXIT_FAILURE);
309-
}
310-
311-
config.operation = CLIParser::OperationKind::FIBONACCI;
312-
}
313-
else
314-
{
315-
EPROSIMA_LOG_ERROR(CLI_PARSER, "fibonacci argument is only valid for client entity");
316-
print_help(EXIT_FAILURE);
317-
}
318-
}
319-
else if (arg == "--sum-all")
320-
{
321-
if (config.entity == CLIParser::EntityKind::CLIENT)
322-
{
323-
if (CLIParser::OperationKind::UNDEFINED != config.operation)
324-
{
325-
EPROSIMA_LOG_ERROR(CLI_PARSER, "Only one operation can be selected");
326-
print_help(EXIT_FAILURE);
327-
}
328-
329-
config.operation = CLIParser::OperationKind::SUM_ALL;
330-
}
331-
else
332-
{
333-
EPROSIMA_LOG_ERROR(CLI_PARSER, "sum-all argument is only valid for client entity");
334-
print_help(EXIT_FAILURE);
335-
}
336-
}
337-
else if (arg == "--accumulator")
338-
{
339-
if (config.entity == CLIParser::EntityKind::CLIENT)
340-
{
341-
if (CLIParser::OperationKind::UNDEFINED != config.operation)
342-
{
343-
EPROSIMA_LOG_ERROR(CLI_PARSER, "Only one operation can be selected");
344-
print_help(EXIT_FAILURE);
345-
}
346-
347-
config.operation = CLIParser::OperationKind::ACCUMULATOR;
348-
}
349-
else
350-
{
351-
EPROSIMA_LOG_ERROR(CLI_PARSER, "accumulator argument is only valid for client entity");
352-
print_help(EXIT_FAILURE);
353-
}
354-
}
355-
else if (arg == "--filter")
356-
{
357-
if (config.entity == CLIParser::EntityKind::CLIENT)
358-
{
359-
if (CLIParser::OperationKind::UNDEFINED != config.operation)
360-
{
361-
EPROSIMA_LOG_ERROR(CLI_PARSER, "Only one operation can be selected");
362-
print_help(EXIT_FAILURE);
363-
}
364-
365-
if (++i < argc)
366-
{
367-
config.filter_kind = consume_integer_argument<std::uint8_t>(argv[i], arg);
368-
369-
if (config.filter_kind > 2)
370-
{
371-
EPROSIMA_LOG_ERROR(CLI_PARSER, "filter kind must be 0, 1 or 2");
372-
print_help(EXIT_FAILURE);
373-
}
374-
}
375-
else
376-
{
377-
EPROSIMA_LOG_ERROR(CLI_PARSER, "missing filter argument");
378-
print_help(EXIT_FAILURE);
379-
}
380-
381-
config.operation = CLIParser::OperationKind::FILTER;
382-
}
383-
else
384-
{
385-
EPROSIMA_LOG_ERROR(CLI_PARSER, "filter argument is only valid for client entity");
386-
print_help(EXIT_FAILURE);
387-
}
388-
}
389263
else if (arg == "--connection-attempts")
390264
{
391265
if (config.entity == CLIParser::EntityKind::CLIENT)
@@ -470,27 +344,6 @@ class CLIParser
470344
print_help(EXIT_FAILURE);
471345
}
472346
}
473-
else if (arg == "--feed")
474-
{
475-
if (++i < argc)
476-
{
477-
if (config.entity == CLIParser::EntityKind::CLIENT)
478-
{
479-
// Error handling for reading in performed in InputFeedProcessor
480-
InputFeedProcessor::provided_input_feed.reset(new std::stringstream(argv[i]));
481-
}
482-
else
483-
{
484-
EPROSIMA_LOG_ERROR(CLI_PARSER, "--feed argument is only valid for client entity");
485-
print_help(EXIT_FAILURE);
486-
}
487-
}
488-
else
489-
{
490-
EPROSIMA_LOG_ERROR(CLI_PARSER, "parsing feed argument");
491-
print_help(EXIT_FAILURE);
492-
}
493-
}
494347
else
495348
{
496349
EPROSIMA_LOG_ERROR(CLI_PARSER, "unknown option " + arg);

0 commit comments

Comments
 (0)