bactria  0.0.1
The bactria library is a header-only C++14 library for profiling and tracing.
Internal documentation. Not intended or useful for the user.
Collaboration diagram for Internal documentation. Not intended or useful for the user.:

Typedefs

using bactria::system::plugin_handle_t = void *
 The POSIX-specific handle type. More...
 
using bactria::plugin_handle_t = system::plugin_handle_t
 The platform-specific plugin handle type. More...
 

Functions

auto bactria::is_active () -> bool
 Checks whether the bactria library has been deactivated by the user. More...
 
auto bactria::system::open_plugin (const char *path)
 The POSIX-specific plugin loader. More...
 
template<typename Sig >
auto bactria::system::load_func (plugin_handle_t handle, Sig &ptr, const char *name)
 The POSIX-specific function loader. More...
 
auto bactria::system::close_plugin (plugin_handle_t handle) noexcept
 The POSIX-specific plugin unloader. More...
 
auto bactria::unload_plugin (plugin_handle_t handle) noexcept
 Unloads the plugin. More...
 

Detailed Description

Typedef Documentation

◆ plugin_handle_t [1/2]

The platform-specific plugin handle type.

A system-specific typedef for a plugin handle. This typedef is an abstraction for the various native handles, e.g. the handles returned by POSIX' dlopen() and Windows' LoadLibrary().

◆ plugin_handle_t [2/2]

using bactria::system::plugin_handle_t = typedef void*

The POSIX-specific handle type.

Plugin handle type for POSIX systems.

Function Documentation

◆ close_plugin()

auto bactria::system::close_plugin ( plugin_handle_t  handle)
inlinenoexcept

The POSIX-specific plugin unloader.

This function closes a plugin loaded by open_plugin().

Parameters
handleThe POSIX-specific plugin handle to close.
See also
open_plugin(), load_func()

◆ is_active()

auto bactria::is_active ( ) -> bool
inline

Checks whether the bactria library has been deactivated by the user.

Checks whether bactria was deactivated by using the environment variable BACTRIA_DEACTIVATE. This function should never be called by the user.

Returns
true The library is active (BACTRIA_DEACTIVATE is not set).
false The library is inactive (BACTRIA_DEACTIVATE is set).

◆ load_func()

template<typename Sig >
auto bactria::system::load_func ( plugin_handle_t  handle,
Sig &  ptr,
const char *  name 
)
inline

The POSIX-specific function loader.

Loads a function from the plugin specified by the user through environment variables.

Template Parameters
SigThe signature of the function to load from the plugin.
Parameters
handleThe POSIX-specific plugin handle.
ptrThe function pointer to bind the plugin function to.
nameThe name of the function to load from the plugin.
Exceptions
std::runtime_errorIf loading of the function failed.
See also
open_plugin(), close_plugin()

◆ open_plugin()

auto bactria::system::open_plugin ( const char *  path)
inline

The POSIX-specific plugin loader.

Opens the plugin specified by the user through the corresponding environment variable.

Parameters
[in]pathThe file path to the plugin library.
Returns
A POSIX plugin handle.
Exceptions
std::runtime_errorIf loading of the plugin failed.
See also
close_plugin(), load_func()

◆ unload_plugin()

auto bactria::unload_plugin ( plugin_handle_t  handle)
inlinenoexcept

Unloads the plugin.

Forwards an open library handle to the native functions for closing shared libraries.

Parameters
handleThe handle to the plugin in question.