Open3D (C++ API)  0.20.0
Loading...
Searching...
No Matches
ProgressBar.h
Go to the documentation of this file.
1// ----------------------------------------------------------------------------
2// - Open3D: www.open3d.org -
3// ----------------------------------------------------------------------------
4// Copyright (c) 2018-2026 www.open3d.org
5// SPDX-License-Identifier: MIT
6// ----------------------------------------------------------------------------
7
8#pragma once
9
10#include <atomic>
11#include <string>
12
13namespace open3d {
14namespace utility {
15
19public:
20 ProgressBar(std::size_t expected_count,
21 std::string progress_info,
22 bool active = false);
23 ProgressBar(const ProgressBar& other);
24 ProgressBar& operator=(const ProgressBar& other);
25 void Reset(std::size_t expected_count,
26 std::string progress_info,
27 bool active);
28 inline ProgressBar& operator++() { return *this += 1; };
29 virtual ProgressBar& operator+=(std::size_t n);
30 void SetCurrentCount(size_t n);
31 void UpdateBar();
32 std::size_t GetCurrentCount() const;
33 virtual ~ProgressBar() = default;
34
35protected:
36 static constexpr size_t resolution_ = 40;
37 std::size_t expected_count_;
38 std::atomic<std::size_t> current_count_{0};
39 std::string progress_info_;
40 std::atomic<std::size_t> progress_pixel_{0};
41 bool active_;
42 std::atomic<bool> finalized_{false};
43};
44
45} // namespace utility
46} // namespace open3d
Definition ProgressBar.h:18
ProgressBar & operator++()
Definition ProgressBar.h:28
void UpdateBar()
Definition ProgressBar.cpp:70
bool active_
Definition ProgressBar.h:41
void Reset(std::size_t expected_count, std::string progress_info, bool active)
Definition ProgressBar.cpp:47
std::size_t GetCurrentCount() const
Definition ProgressBar.cpp:102
std::atomic< bool > finalized_
Definition ProgressBar.h:42
std::size_t expected_count_
Definition ProgressBar.h:37
virtual ProgressBar & operator+=(std::size_t n)
Definition ProgressBar.cpp:59
static constexpr size_t resolution_
Definition ProgressBar.h:36
void SetCurrentCount(size_t n)
Definition ProgressBar.cpp:65
std::atomic< std::size_t > progress_pixel_
Definition ProgressBar.h:40
ProgressBar & operator=(const ProgressBar &other)
Definition ProgressBar.cpp:30
virtual ~ProgressBar()=default
std::string progress_info_
Definition ProgressBar.h:39
std::atomic< std::size_t > current_count_
Definition ProgressBar.h:38
Definition PinholeCameraIntrinsic.cpp:16