25#ifndef JAU_BASIC_TYPES_HPP_
26#define JAU_BASIC_TYPES_HPP_
121 bool milli_sleep(uint64_t td_ms, const
bool ignore_irq=true) noexcept;
135 bool sleep(const fraction_timespec& relative_time, const
bool ignore_irq=true) noexcept;
156 bool sleep_until(const fraction_timespec& absolute_time, const
bool monotonic=true, const
bool ignore_irq=true) noexcept;
178 bool sleep_for(const fraction_timespec& relative_time, const
bool monotonic=true, const
bool ignore_irq=true) noexcept;
200 bool sleep_for(const
fraction_i64& relative_time, const
bool monotonic=true, const
bool ignore_irq=true) noexcept;
218 std::cv_status
wait_until(
std::condition_variable& cv,
std::unique_lock<
std::mutex>& lock, const fraction_timespec& absolute_time,
219 const
bool monotonic=true) noexcept;
257 std::cv_status
wait_for(
std::condition_variable& cv,
std::unique_lock<
std::mutex>& lock, const fraction_timespec& relative_time,
258 const
bool monotonic=true) noexcept;
297 const
bool monotonic=true) noexcept;
305 #define E_FILE_LINE __FILE__,__LINE__
310 std::string backtrace_;
314 ExceptionBase(std::string type, std::string
const& m,
const char* file,
int line)
noexcept;
325 const std::string&
backtrace() const noexcept {
return backtrace_; }
328 operator const std::string& ()
const noexcept {
return message(); };
330 virtual const char*
what() const noexcept {
331 return what_.c_str();
342 : bad_alloc(),
ExceptionBase(
"OutOfMemoryError", m, file, line) {}
344 const char*
what() const noexcept
override {
351 RuntimeException(std::string type, std::string
const& m,
const char* file,
int line) noexcept
352 : exception(),
ExceptionBase(std::move(type), m, file, line) {}
365 const
char*
what() const noexcept
override {
412 :
RuntimeException(
"IndexOutOfBoundsException",
"Index "+index_s+
", data length "+length_s, file, line) {}
414 IndexOutOfBoundsException(
const std::size_t index,
const std::size_t count,
const std::size_t length,
const char* file,
int line) noexcept
420 IOError(std::string
const& m,
const char* file,
int line) noexcept
440 mask |= 1_u32 << (nr & 31);
447 mask |= ~(1_u32 << (nr & 31));
454 return mask & (1_u32 << (nr & 31));
461 mask |= 1_u64 << (nr & 63);
468 mask |= ~(1_u64 << (nr & 63));
475 return mask & (1_u64 << (nr & 63));
const std::string & backtrace() const noexcept
ExceptionBase(std::string type, std::string const &m, const char *file, int line) noexcept
std::ostream & operator<<(std::ostream &out) noexcept
virtual ~ExceptionBase() noexcept=default
virtual const char * what() const noexcept
const std::string & message() const noexcept
IOError(std::string const &m, const char *file, int line) noexcept
IllegalArgumentException(std::string const &m, const char *file, int line) noexcept
IllegalStateException(std::string const &m, const char *file, int line) noexcept
IndexOutOfBoundsException(const std::size_t index, const std::size_t length, const char *file, int line) noexcept
IndexOutOfBoundsException(const std::string &index_s, const std::string &length_s, const char *file, int line) noexcept
IndexOutOfBoundsException(const std::size_t index, const std::size_t count, const std::size_t length, const char *file, int line) noexcept
InternalError(std::string const &m, const char *file, int line) noexcept
NotImplementedError(std::string const &m, const char *file, int line) noexcept
NullPointerException(std::string const &m, const char *file, int line) noexcept
OutOfMemoryError(std::string const &m, const char *file, int line)
const char * what() const noexcept override
RuntimeException(std::string const &m, const char *file, int line) noexcept
const char * what() const noexcept override
RuntimeException(std::string type, std::string const &m, const char *file, int line) noexcept
~RuntimeException() noexcept override=default
UnsupportedOperationException(std::string const &m, const char *file, int line) noexcept
std::string to_string(const alphabet &v) noexcept
fraction_timespec getWallClockTime() noexcept
Returns current wall-clock real-time since Unix Epoch 00:00:00 UTC on 1970-01-01.
fraction_timespec getMonotonicTime() noexcept
Returns current monotonic time since Unix Epoch 00:00:00 UTC on 1970-01-01.
fraction< int64_t > fraction_i64
fraction using int64_t as integral type
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
void set_bit_uint32(const uint8_t nr, uint32_t &mask)
uint128dp_t merge_uint128(uint16_t const uuid16, uint128dp_t const &base_uuid, nsize_t const uuid16_le_octet_index)
Merge the given 'uuid16' into a 'base_uuid' copy at the given little endian 'uuid16_le_octet_index' p...
void set_bit_uint64(const uint8_t nr, uint64_t &mask)
void clear_bit_uint32(const uint8_t nr, uint32_t &mask)
uint64_t test_bit_uint64(const uint8_t nr, const uint64_t mask)
uint32_t test_bit_uint32(const uint8_t nr, const uint32_t mask)
void clear_bit_uint64(const uint8_t nr, uint64_t &mask)
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
std::cv_status wait_for(std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_timespec &relative_time, const bool monotonic=true) noexcept
wait_for causes the current thread to block until the condition variable is notified,...
uint64_t getWallClockSeconds() noexcept
Returns current wall-clock system time of day in seconds since Unix Epoch 00:00:00 UTC on 1 January 1...
std::cv_status wait_until(std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_timespec &absolute_time, const bool monotonic=true) noexcept
wait_until causes the current thread to block until the condition variable is notified,...
bool sleep_until(const fraction_timespec &absolute_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_until causes the current thread to block until the specific time is reached.
bool sleep(const fraction_timespec &relative_time, const bool ignore_irq=true) noexcept
sleep using high precision monotonic timer, useful for one-shot delays (only).
bool milli_sleep(uint64_t td_ms, const bool ignore_irq=true) noexcept
millisecond sleep using high precision monotonic timer, useful for one-shot delays (only).
uint64_t getCurrentMilliseconds() noexcept
Returns current monotonic time in milliseconds.
bool sleep_for(const fraction_timespec &relative_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_for causes the current thread to block until a specific amount of time has passed.
A 128-bit packed uint8_t data array.