Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5fa2a4f
Added indicators library to the project
Baryonics Jun 30, 2026
6eef63b
first implementation of ProgressAdaptor class
Baryonics Jun 30, 2026
5e1837e
Further implementation of progress indicator with cmake integration
Baryonics Jun 30, 2026
b498e97
Added functions to access file size, as well as the size of last read…
Baryonics Jun 30, 2026
578f598
Testing the progress indicator!
Baryonics Jun 30, 2026
e7b4878
Added some important todos I want to implement soon
Baryonics Jun 30, 2026
9e04ed8
Removed template arguments for IncrementFunT and replaced it with std…
Baryonics Jul 1, 2026
c388547
Using concept range
Baryonics Jul 1, 2026
978b6a7
Removed TODO
Baryonics Jul 1, 2026
1783815
Added () overload to iterate up to a certain number of elements. Need…
Baryonics Jul 1, 2026
1c99adc
Added concept, marked as complete when finished
Baryonics Jul 1, 2026
4465713
ProgressView now has a view to the base range, instead of the range i…
Baryonics Jul 1, 2026
11176df
Added new error type "incomplete" to determine between an complete vs…
Baryonics Jul 1, 2026
d5850a8
Added integration test for test coverage. Unit tests?
Baryonics Jul 1, 2026
c42d1eb
Removed finished_ because it's never reached anyways.
Baryonics Jul 1, 2026
8c02fb2
Forgot to add the range concept to closure
Baryonics Jul 1, 2026
03ef1bb
renamed s to sentinel, since it doesn't fit the style
Baryonics Jul 1, 2026
657714b
Added Config struct and error handling
Baryonics Jul 22, 2026
1852210
Using forward variadic template constructor instead of config struct.…
Baryonics Jul 22, 2026
2dab3c8
Adjusted integration tests for ProgressAdaptor in reader::Binary
Baryonics Jul 22, 2026
0f0559a
Testing direct closure.
Baryonics Jul 22, 2026
0910888
RangeAdaptor pointer is dangling if expression `auto view = range | P…
Baryonics Jul 22, 2026
e0accca
ProgressView and ProgressAdaptor share state and bar via shared_ptr t…
Baryonics Jul 22, 2026
b7ec488
Experimental testing environment. Move to unit tests
Baryonics Jul 22, 2026
5fd8a1f
ProgressClosure now also has shared_pointer instead of pointer
Baryonics Jul 22, 2026
db12c1e
New API
Baryonics Aug 16, 2026
7581abd
fixes
Baryonics Aug 16, 2026
6a489a4
added standard config for progressbar
Baryonics Aug 16, 2026
cf355c5
Implemented new Iterator
Baryonics Aug 16, 2026
48d5330
temporary integration test adjustments
Baryonics Aug 16, 2026
013d8cb
Removed public member adaptor and replaced with a getter
Baryonics Aug 16, 2026
cdb2472
Fixing address sanitizer errors
Baryonics Aug 16, 2026
7b0576f
Testing
Baryonics Aug 16, 2026
bc1d12f
Testing
Baryonics Aug 16, 2026
49f63ba
testing. pleasing the sanitizers
Baryonics Aug 16, 2026
48bb54b
all hail the memory sanatizer
Baryonics Aug 16, 2026
8915af7
Unfortunately we can only use ASCII?
Baryonics Aug 16, 2026
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
3 changes: 2 additions & 1 deletion cmake/load_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ find_package(magic_enum REQUIRED CONFIG)
find_package(CLI11 REQUIRED CONFIG)
find_package(Eigen3 REQUIRED CONFIG)
find_package(GSL REQUIRED)
find_package(indicators REQUIRED)

if(ENABLE_TEST)
find_package(GTest CONFIG REQUIRED)
find_package(GTest CONFIG REQUIRED)
endif()
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def requirements(self):
self.requires("magic_enum/0.9.7") # type: ignore
self.requires("cli11/2.6.0") # type: ignore
self.requires("eigen/5.0.1") # type: ignore
self.requires("indicators/2.3") # type: ignore

# Conditions on cmake variables set from cmake/project_options
if os.environ["CMAKE_ENABLE_TEST"] == "ON":
Expand Down
1 change: 1 addition & 0 deletions source/centipede/reader/binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ namespace centipede::reader
{
return std::unexpected{ size.error() };
}
last_entry_bytes_ = (read_size + 1U) * sizeof(uint32_t);
++n_entries_;
size_ = size.value();
return size.value();
Expand Down
27 changes: 21 additions & 6 deletions source/centipede/reader/binary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <cstddef>
#include <cstdint>
#include <expected>
#include <filesystem>
#include <fstream>
#include <iterator>
#include <span>
Expand Down Expand Up @@ -169,6 +170,15 @@ namespace centipede::reader
*/
[[nodiscard]] constexpr auto get_n_entries() const -> std::size_t { return n_entries_; }

// TODO: Add documentation
[[nodiscard]] auto get_file_size() const -> std::size_t
{
return static_cast<std::size_t>(std::filesystem::file_size(config_.in_filename));
}

// TODO: Add documentation
[[nodiscard]] auto get_last_entry_bytes() const -> std::size_t { return last_entry_bytes_; }

/**
* @brief Checks if last read operation reached end of file.
* @return Returns true if end of file is reached.
Expand All @@ -181,7 +191,7 @@ namespace centipede::reader
* The status is updated during iteration and after manual read operations.
*
* @return
* - ErrorCode::invalid while iteration/reading is in progress.
* - ErrorCode::incomplete while iteration/reading is in progress.
* - ErrorCode::success if iteration finished successfully.
* - Any other ErrorCode if a read or parsing error occurred.
*/
Expand Down Expand Up @@ -235,7 +245,7 @@ namespace centipede::reader
explicit Iterator(Binary* reader_ptr)
: reader_{ reader_ptr }
{
reader_->status_ = ErrorCode::invalid;
reader_->status_ = ErrorCode::incomplete;
++(*this);
}

Expand Down Expand Up @@ -276,7 +286,7 @@ namespace centipede::reader
}

current_ = reader_->get_current_entry();
reader_->status_ = ErrorCode::invalid;
reader_->status_ = ErrorCode::incomplete;
return *this;
}
/**
Expand All @@ -296,7 +306,10 @@ namespace centipede::reader
*
* @return Returns true while iteration is not finished.
*/
auto operator!=(const Sentinel&) const -> bool { return reader_->status_ == ErrorCode::invalid; }
auto operator!=(const Sentinel&) const -> bool { return reader_->status_ == ErrorCode::incomplete; }

// TODO: add documentation
bool operator==(Sentinel) const { return reader_->status_ != ErrorCode::incomplete; }

private:
Binary* reader_{}; //!< Associated Binary reader instance.
Expand Down Expand Up @@ -324,8 +337,10 @@ namespace centipede::reader
std::ifstream input_file_; //!< Input file handler
std::size_t size_{}; //!< Number of Entrypoints in the current entry
std::size_t n_entries_{}; //!< Total number of entries read by this instance
bool end_of_file_{ false }; //!< Indicates if end of file is reached. Gets updated on read.
ErrorCode status_{ ErrorCode::invalid };
std::size_t last_entry_bytes_{}; // TODO: Add documentation

bool end_of_file_{ false }; //!< Indicates if end of file is reached. Gets updated on read.
ErrorCode status_{ ErrorCode::incomplete };

void reset();
auto read_entry_to_buffer(uint32_t read_size) -> EnumError<>;
Expand Down
4 changes: 3 additions & 1 deletion source/centipede/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ target_sources(
PUBLIC
FILE_SET publicHeaders
TYPE HEADERS
FILES common_traits.hpp error_types.hpp return_types.hpp
FILES common_traits.hpp error_types.hpp return_types.hpp progress_indicator.hpp
)

target_link_libraries(core PUBLIC indicators::indicators)
1 change: 1 addition & 0 deletions source/centipede/util/common_definitions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ namespace centipede::common
{
constexpr auto DEFAULT_BUFFER_SIZE =
std::size_t{ 10000 }; //!< Default maximum buffer size for binary readers/writers.
constexpr auto DEFAULT_INDICATOR_BAR_WIDTH = std::size_t{ 50 };
} // namespace centipede::common
12 changes: 12 additions & 0 deletions source/centipede/util/error_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace centipede
// TODO: duplication of comments
invalid, //!< Error due to no evaluation!
success, //!< No error. All good!
incomplete, //!< Operation incomplete!
handler_incomp_n_locals, //!< Incompatible number of local variables from the current entrypoint.
writer_neg_or_zero_sigma, //!< Zero or negative sigma occurs. See @ref writer::Binary.
writer_buffer_overflow, //!< Buffer size is too small for a new entry occurs. See @ref writer::Binary.
Expand All @@ -33,6 +34,9 @@ namespace centipede
reader_uninitialized, //!< Reader is not initialized.
reader_buffer_overflow, //!< Buffer size is too small for a new entry occurs. See @ref reader::Binary.
reader_invalid_filename, //!< Filename is invalid or empty
progress_zero_size, //!< Given size is zero
progress_inc_exceeds_size, //!< Increment exceeds given size
progress_inc_returns_zero //!< Increment returns zero
};

} // namespace centipede
Expand Down Expand Up @@ -97,8 +101,16 @@ struct std::formatter<centipede::ErrorCode>
return std::format_to(ctx.out(), "Reader: Cannot read the file. Buffer size will be exceeded!");
case reader_invalid_filename:
return std::format_to(ctx.out(), "Reader: Filename is either empty or invalid!");
case progress_zero_size:
return std::format_to(ctx.out(), "Progress: Given size is 0!");
case progress_inc_exceeds_size:
return std::format_to(ctx.out(), "Progress: Increment exceeds given size!");
case progress_inc_returns_zero:
return std::format_to(ctx.out(), "Progress: Increment returns 0!");
case invalid:
return std::format_to(ctx.out(), "Error due to no evaluation!");
case incomplete:
return std::format_to(ctx.out(), "Operation incomplete!");
default:
break;
}
Expand Down
Loading
Loading