-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an aspect template argument to
class CAPIFunction
.
This PR makes two changes to the template signature of `class CAPIFunction`. The central one is to add an aspect argument that can provide hooks into `CAPIFunction::function`. In this initial version there's a single aspect point (the aspect member function `call`) that is only an observer. The `call` of the default aspect does nothing. The second change in template signature is to infer the return value of the wrapper function and to suppress return statements if that type is `void`. This allows the elimination of subsidiary wrapper for `void` functions to give them a (constant) return value. Tests for the aspect implement `class LoggingAspect`, a primitive call-logger sufficient for testing, and provide an override header to activate it. The override header also generates a traits class for each C API implementation function that provides data for `LoggingAspect`. These elements are exercised by two new test runners that share a common set of tests; only the results differ depending on whether the hook is active or not. In order to automatically generate metadata for API functions, the PR introduces a set of macros to define the C API interface functions. These functions are already essentially boilerplate, but they cannot be defined with function templates because they must have "C" linkage. The macros provide a pair of macro hooks for generating code either before or after the function definition.
- Loading branch information
1 parent
5200bbb
commit 9d4b4cf
Showing
15 changed files
with
716 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.