Skip to content

Commit

Permalink
refactor program options (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
flipflip8952 authored Nov 1, 2024
1 parent 0528a5b commit f3393a4
Show file tree
Hide file tree
Showing 17 changed files with 517 additions and 441 deletions.
19 changes: 11 additions & 8 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ TAB_SIZE = 4
# with the commands \{ and \} for these it is advised to use the version @{ and
# @} or use a double escape (\\{ and \\})

ALIASES =
ALIASES = \
fp_msgspec_begin{1}="@anchor msgspec_\1" \
fp_msgspec_end="" \
fp_codegen_begin{1}="" \
fp_codegen_end{1}=""

# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
Expand Down Expand Up @@ -940,9 +944,8 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.

INPUT = fpsdk_doc \
fpsdk_common \
fpsdk_ros1 \
fpsdk_ros2 \
fpsdk_common/doc fpsdk_ros1/doc fpsdk_ros2/doc \
fpsdk_common/include fpsdk_ros1/include fpsdk_ros2/include \
fpsdk_apps

# This tag can be used to specify the character encoding of the source files
Expand Down Expand Up @@ -1029,9 +1032,9 @@ EXCLUDE_SYMBOLS =
# command).

EXAMPLE_PATH = fpsdk_doc \
fpsdk_common/doc \
fpsdk_ros1/doc \
fpsdk_apps/doc
fpsdk_common fpsdk_common/doc \
fpsdk_ros1 fpsdk_ros1/doc \
fpsdk_apps fpsdk_apps/doc

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Expand Down Expand Up @@ -2397,7 +2400,7 @@ EXPAND_AS_DEFINED =
# The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

SKIP_FUNCTION_MACROS = YES
SKIP_FUNCTION_MACROS = NO

#---------------------------------------------------------------------------
# Configuration options related to external references
Expand Down
25 changes: 12 additions & 13 deletions fpsdk_apps/fpltool/fpltool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@
#include <cstdio>

/* EXTERNAL */
#include <unistd.h>

/* Fixposition SDK */
#include <fpsdk_common/app.hpp>
#include <fpsdk_common/logging.hpp>

/* PACKAGE */
#include "fpltool_args.hpp"
#include "fpltool_dump.hpp"
#include "fpltool_meta.hpp"
#include "fpltool_opts.hpp"
#include "fpltool_record.hpp"
#include "fpltool_rosbag.hpp"
#include "fpltool_trim.hpp"
Expand All @@ -41,29 +40,29 @@ int main(int argc, char** argv)
bool ok = true;

// Parse command line arguments
FpltoolArgs args;
if (!args.LoadFromArgv(argc, argv)) {
FplToolOptions opts;
if (!opts.LoadFromArgv(argc, argv)) {
ok = false;
}

// Run command
if (ok) {
switch (args.command_) { /* clang-format off */
case FpltoolArgs::Command::DUMP: ok = DoDump(args); break;
case FpltoolArgs::Command::META: ok = DoMeta(args); break;
case FpltoolArgs::Command::ROSBAG: ok = DoRosbag(args); break;
case FpltoolArgs::Command::TRIM: ok = DoTrim(args); break;
case FpltoolArgs::Command::RECORD: ok = DoRecord(args); break;
case FpltoolArgs::Command::UNSPECIFIED: ok = false; break;
switch (opts.command_) { /* clang-format off */
case FplToolOptions::Command::DUMP: ok = DoDump(opts); break;
case FplToolOptions::Command::META: ok = DoMeta(opts); break;
case FplToolOptions::Command::ROSBAG: ok = DoRosbag(opts); break;
case FplToolOptions::Command::TRIM: ok = DoTrim(opts); break;
case FplToolOptions::Command::RECORD: ok = DoRecord(opts); break;
case FplToolOptions::Command::UNSPECIFIED: ok = false; break;
} // clang-format on
}

// Are we happy?
if (ok) {
INFO("Done: %s", args.command_str_.c_str());
INFO("Done: %s", opts.command_str_.c_str());
return EXIT_SUCCESS;
} else {
ERROR("Failed: %s", args.command_str_.c_str());
ERROR("Failed: %s", opts.command_str_.c_str());
return EXIT_FAILURE;
}
}
Expand Down
211 changes: 0 additions & 211 deletions fpsdk_apps/fpltool/fpltool_args.cpp

This file was deleted.

Loading

0 comments on commit f3393a4

Please sign in to comment.