Skip to content

Commit

Permalink
Overhaul oiiotool internal idioms (AcademySoftwareFoundation#2586)
Browse files Browse the repository at this point in the history
oiiotool dates from pre-C++11, and has grown by accretion. As a
result, the individual actions are implemented using multiple
different idioms, and there is a lot of complex boilerplate.

A recent PR added subimage selection widely to all commands that use
the idiom of an implementation that inherits from the OiiotoolOp
class. The convinced me that we want to migrate as many actions as
possible to this idiom. I also realized that the current use of
OiiotoolOp could be greatly simplified by using lambdas in most
cases, which weren't available in the pre-C++11 ancient times when
oiiotool was first being developed.

This patch:

* Has the OiiotoolOp base class contain (and accept in its ctr) a
  std::function for the meat of the impl() and setup() methods.

* If init() and setup() are the only bits that need customization for
  a particular action, they can just be passed as lambdas rather than
  needing to subclass OiiotoolOp.

* This eliminates a huge amount of per-action boilerplate, many helper
  subclasses and macros.

* In front of every action implemetation (however it is done), I
  inserted a comment with the command line argument (e.g.,
  `--colormap`) which is an aid for me to quickly find the
  implementation in this huge file.

This patch DOES NOT change any non-OiiotoolOp action idioms to
OiiotoolOp.  That will come later, first I wanted to make these
improvements.

Signed-off-by: Larry Gritz <[email protected]>
  • Loading branch information
lgritz authored May 20, 2020
1 parent c835a1a commit f161d93
Show file tree
Hide file tree
Showing 2 changed files with 488 additions and 954 deletions.
Loading

0 comments on commit f161d93

Please sign in to comment.