|
vg
tools for working with variation graphs
|
#include <explainer.hpp>
Public Member Functions | |
| Explainer (bool enabled) | |
| Construct an Explainer that will save to one or more files. More... | |
| virtual | ~Explainer () |
| Close out the files being explained to. More... | |
| operator bool () const | |
Static Public Member Functions | |
| static void | set_context (const std::string &context) |
| static void | clear_context () |
| Clear the current per-thread context. More... | |
Static Public Attributes | |
| static bool | save_explanations = false |
Protected Member Functions | |
| bool | explaining () const |
| Function to check if we should be explaining. More... | |
Static Protected Member Functions | |
| static size_t | get_new_explanation_number () |
| static std::string | make_filename (const std::string &base_name, const std::string &extension) |
Protected Attributes | |
| size_t | explanation_number |
| What number explanation are we? Distinguishes different objects. More... | |
| bool | enabled |
| Determines if this explainer should generate explanations. More... | |
Static Protected Attributes | |
| static std::atomic< size_t > | next_explanation_number {0} |
| Counter used to give different explanations their own unique filenames. More... | |
| static thread_local size_t | next_context_explanation_number {0} |
| static thread_local std::string | current_context = "" |
| Current thing (possibly a read name) being explained (for organizing into directories) More... | |
Base explainer class. Handles making sure each explanation has a different unique number. Also provides support for organizing explanations into per-read directories.
| vg::Explainer::Explainer | ( | bool | enabled | ) |
Construct an Explainer that will save to one or more files.
|
virtual |
Close out the files being explained to.
|
static |
Clear the current per-thread context.
|
inlineprotected |
Function to check if we should be explaining.
|
staticprotected |
Helper to get a new explanation number, either from the global counter, or within a thread-local context.
|
staticprotected |
Helper to create a filename accounting for any assigned per-thread context.
If current_context is set, ensures there is a directory for that context, and puts the file there.
Returns the full path to use for opening the file.
|
inline |
Conversion to bool so you can use an explainer as a condition on code to write to it.
|
static |
Set a per-thread context for organizing explanations. Within a context, explanations are numbed from 0 (so contexts may not be re-used, or collisions will occur). The context may not be empty.
|
staticprotected |
Current thing (possibly a read name) being explained (for organizing into directories)
|
protected |
Determines if this explainer should generate explanations.
|
protected |
What number explanation are we? Distinguishes different objects.
|
staticprotected |
Counter used to give different explanations their own unique filenames within a per-thread context.
|
staticprotected |
Counter used to give different explanations their own unique filenames.
|
static |
Determine if explanations should be generated.
Should be set once at the start of the program; should not be toggled while explanations are being saved or other system state (like contexts) are being used.
1.8.17