Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 43 additions & 47 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,40 +219,39 @@ __barkeep__ also has [python bindings](https://pypi.python.org/pypi/barkeep).
<img src="rec/iter-bar-light.svg" width="700">
</picture>

<blockquote class="warn">
<details>
<summary>
Detail: IterableBar starts the display not at the time of construction, ...
</summary>

... but at the time of the first call to `begin()`.
Thus, it is possible to set it up prior to loop execution.

Similarly, it ends the display not at the time of destruction, but at the
first increment of the iterator past the end. Thus, even if the object stays
alive after the loop, the display will be stopped.

Therefore, you could initialize it earlier than the loop execution, and destroy
it late afterwards:

```cpp
std::vector<float> v(300, 0);
std::iota(v.begin(), v.end(), 1); // 1, 2, 3, ..., 300
float sum = 0;
bk::IterableBar bar(v, {.message = "Summing", .interval = .02});
// <-- At this point, display is not yet shown.
// Thus, more work can be done here.
for (auto x : bar) { // <-- Display starts showing.
std::this_thread::sleep_for(1.s/x);
sum += x;
}
// <-- Display stops here even if `bar` object is still alive.
// Thus, more work can be done here.
std::cout << "Sum: " << sum << std::endl;
```

</details>
</blockquote>
> [!NOTE]
> <details>
> <summary>
> Detail: IterableBar starts the display not at the time of construction, ...
> </summary>
>
> ... but at the time of the first call to `begin()`.
> Thus, it is possible to set it up prior to loop execution.
>
> Similarly, it ends the display not at the time of destruction, but at the
> first increment of the iterator past the end. Thus, even if the object stays
> alive after the loop, the display will be stopped.
>
> Therefore, you could initialize it earlier than the loop execution, and destroy
> it late afterwards:
>
> ```cpp
> std::vector<float> v(300, 0);
> std::iota(v.begin(), v.end(), 1); // 1, 2, 3, ..., 300
> float sum = 0;
> bk::IterableBar bar(v, {.message = "Summing", .interval = .02});
> // <-- At this point, display is not yet shown.
> // Thus, more work can be done here.
> for (auto x : bar) { // <-- Display starts showing.
> std::this_thread::sleep_for(1.s/x);
> sum += x;
> }
> // <-- Display stops here even if `bar` object is still alive.
> // Thus, more work can be done here.
> std::cout << "Sum: " << sum << std::endl;
> ```
>
> </details>

<div style="visibility: hidden; height: 0;">

Expand Down Expand Up @@ -698,19 +697,16 @@ To build the test suites or the Python bindings, use Meson (below).
PYTHONPATH=build/python/ python3.11 python/tests/demo.py
```

<div class="tip">

By default, python bindings assume `std::atomic<double>` support.
This requires availability of supporting compilers, e.g. g++-13 instead of Clang 15.0.0. Such compilers can be specified during `configure` step:
```bash
CXX=g++-13 meson setup build
```
Alternatively, you can disable atomic float support by providing the appropriate compile flag if you don't have a supporting compiler:
```bash
CXXFLAGS="-DBARKEEP_ENABLE_ATOMIC_FLOAT=0" meson setup build
```

</div>
> [!TIP]
> By default, python bindings assume `std::atomic<double>` support.
> This requires availability of supporting compilers, e.g. g++-13 instead of Clang 15.0.0. Such compilers can be specified during `configure` step:
> ```bash
> CXX=g++-13 meson setup build
> ```
> Alternatively, you can disable atomic float support by providing the appropriate compile flag if you don't have a supporting compiler:
> ```bash
> CXXFLAGS="-DBARKEEP_ENABLE_ATOMIC_FLOAT=0" meson setup build
> ```

## Similar projects

Expand Down
40 changes: 20 additions & 20 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

* [Home](/)
* [Home](/ "barkeep")

__API__
* [Namespace](api/Namespaces/namespacebarkeep)
* [Classes](api/Classes/)
* [Namespace](api/Namespaces/namespacebarkeep "barkeep • Namespace")
* [Classes](api/Classes/ "barkeep • Classes")
<!-- api -->
* [AnimationDisplay](api/Classes/classbarkeep_1_1_animation_display.md)
* [AsyncDisplayer](api/Classes/classbarkeep_1_1_async_displayer.md)
* [BaseDisplay](api/Classes/classbarkeep_1_1_base_display.md)
* [CompositeDisplay](api/Classes/classbarkeep_1_1_composite_display.md)
* [CounterDisplay](api/Classes/classbarkeep_1_1_counter_display.md)
* [IterableBar](api/Classes/classbarkeep_1_1_iterable_bar.md)
* [IterableBar::Iterator](api/Classes/classbarkeep_1_1_iterable_bar_1_1_iterator.md)
* [ProgressBarDisplay](api/Classes/classbarkeep_1_1_progress_bar_display.md)
* [Speedometer](api/Classes/classbarkeep_1_1_speedometer.md)
* [StatusDisplay](api/Classes/classbarkeep_1_1_status_display.md)
* [AnimationConfig](api/Classes/structbarkeep_1_1_animation_config.md)
* [AtomicTraits](api/Classes/structbarkeep_1_1_atomic_traits.md)
* [AtomicTraits< std::atomic< T > >](api/Classes/structbarkeep_1_1_atomic_traits_3_01std_1_1atomic_3_01_t_01_4_01_4.md)
* [BarParts](api/Classes/structbarkeep_1_1_bar_parts.md)
* [CounterConfig](api/Classes/structbarkeep_1_1_counter_config.md)
* [IterableBarConfig](api/Classes/structbarkeep_1_1_iterable_bar_config.md)
* [ProgressBarConfig](api/Classes/structbarkeep_1_1_progress_bar_config.md)
* [AnimationDisplay](api/Classes/classbarkeep_1_1_animation_display.md "barkeep • AnimationDisplay")
* [AsyncDisplayer](api/Classes/classbarkeep_1_1_async_displayer.md "barkeep • AsyncDisplayer")
* [BaseDisplay](api/Classes/classbarkeep_1_1_base_display.md "barkeep • BaseDisplay")
* [CompositeDisplay](api/Classes/classbarkeep_1_1_composite_display.md "barkeep • CompositeDisplay")
* [CounterDisplay](api/Classes/classbarkeep_1_1_counter_display.md "barkeep • CounterDisplay")
* [IterableBar](api/Classes/classbarkeep_1_1_iterable_bar.md "barkeep • IterableBar")
* [IterableBar::Iterator](api/Classes/classbarkeep_1_1_iterable_bar_1_1_iterator.md "barkeep • IterableBar::Iterator")
* [ProgressBarDisplay](api/Classes/classbarkeep_1_1_progress_bar_display.md "barkeep • ProgressBarDisplay")
* [Speedometer](api/Classes/classbarkeep_1_1_speedometer.md "barkeep • Speedometer")
* [StatusDisplay](api/Classes/classbarkeep_1_1_status_display.md "barkeep • StatusDisplay")
* [AnimationConfig](api/Classes/structbarkeep_1_1_animation_config.md "barkeep • AnimationConfig")
* [AtomicTraits](api/Classes/structbarkeep_1_1_atomic_traits.md "barkeep • AtomicTraits")
* [AtomicTraits< std::atomic< T > >](api/Classes/structbarkeep_1_1_atomic_traits_3_01std_1_1atomic_3_01_t_01_4_01_4.md "barkeep • AtomicTraits< std::atomic< T > >")
* [BarParts](api/Classes/structbarkeep_1_1_bar_parts.md "barkeep • BarParts")
* [CounterConfig](api/Classes/structbarkeep_1_1_counter_config.md "barkeep • CounterConfig")
* [IterableBarConfig](api/Classes/structbarkeep_1_1_iterable_bar_config.md "barkeep • IterableBarConfig")
* [ProgressBarConfig](api/Classes/structbarkeep_1_1_progress_bar_config.md "barkeep • ProgressBarConfig")
<!-- /api -->
17 changes: 17 additions & 0 deletions docs/img/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 35 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css"
/>
<link href="https://fonts.cdnfonts.com/css/sf-mono" rel="stylesheet" />
<link rel="icon" href="img/favicon.svg" type="image/svg+xml" />
</head>
<body>
<div id="app"></div>
Expand Down Expand Up @@ -50,6 +51,9 @@
tabComments: true, // default
tabHeadings: true, // default
},
'flexible-alerts': {
style: 'callout',
},
vueComponents: {
icon: {
props: ["prefix"],
Expand Down Expand Up @@ -78,6 +82,7 @@
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/emoji.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/docsify-copy-code/dist/docsify-copy-code.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-tabs@1"></script>
<script src="//unpkg.com/docsify-plugin-flexible-alerts"></script>

<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-clike.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/prismjs@1/components/prism-c.min.js"></script>
Expand Down Expand Up @@ -153,8 +158,36 @@
.dual-code .language-cpp {
font-size: 12px !important;
}
div.tip p {
margin: 0 0 0 0;
/* docsify-plugin-flexible-alerts default border color
is not accounting for dark mode */
.alert.callout {
border-color: var(--mono-tint2);
}
/* unify NOTE and TIP under the theme color */
.alert.callout.note,
.alert.callout.tip {
border-left-color: var(--theme-color) !important;
}
.alert.callout.note .title,
.alert.callout.tip .title {
color: var(--theme-color);
}
.alert.callout.note .icon-note,
.alert.callout.tip .icon-tip {
background-image: none;
background-color: var(--theme-color);
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-size: contain;
mask-size: contain;
}
.alert.callout.note .icon-note {
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath d='M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9 2 12t.788-3.9 2.137-3.175T8.1 2.788 12 2t3.9.788 3.175 2.137T21.213 8.1 22 12t-.788 3.9-2.137 3.175-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20m0-8'/%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath d='M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9 2 12t.788-3.9 2.137-3.175T8.1 2.788 12 2t3.9.788 3.175 2.137T21.213 8.1 22 12t-.788 3.9-2.137 3.175-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20m0-8'/%3E%3C/svg%3E");
}
.alert.callout.tip .icon-tip {
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M9 18h6m-5 3h4m-5-6c.001-2-.499-2.5-1.5-3.5S6.025 9.487 6 8c-.047-3.05 2-5 6-5 4.001 0 6.049 1.95 6 5-.023 1.487-.5 2.5-1.5 3.5-.999 1-1.499 1.5-1.5 3.5'/%3E%3C/svg%3E");
mask-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M9 18h6m-5 3h4m-5-6c.001-2-.499-2.5-1.5-3.5S6.025 9.487 6 8c-.047-3.05 2-5 6-5 4.001 0 6.049 1.95 6 5-.023 1.487-.5 2.5-1.5 3.5-.999 1-1.499 1.5-1.5 3.5'/%3E%3C/svg%3E");
}
div.badges img,
div.badges picture {
Expand Down
2 changes: 1 addition & 1 deletion docs/make_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def fix_match(m: re.Match[str]) -> str:
m = re.match(r"# barkeep::(.+)", content)
class_name = m.group(1)
path = fname.removeprefix("docs/")
class_list_str += f" * [{class_name}]({path})\n"
class_list_str += f' * [{class_name}]({path} "barkeep • {class_name}")\n'

sidebar = "docs/_sidebar.md"
content = open(sidebar).read()
Expand Down
Loading