ImFusion SDK 4.3
Generic Utilities

Generic utility classes and helper functions of the ImFusionCore library. More...

+ Collaboration diagram for Generic Utilities:

Detailed Description

Generic utility classes and helper functions of the ImFusionCore library.

Namespaces

namespace  ImFusion::Literals
 Custom literals for classes of the ImFusion SDK.
 

Classes

class  ByteBufferView
 Const view onto a sized buffer of raw binary data. More...
 
class  ByteBufferMutableView
 Specialization of a ByteBufferView that additionally provides non-const access to the underlying data. More...
 
class  ByteBuffer
 Specialization of the ByteBufferView class that has ownership of the underlying data. More...
 
class  ByteBufferStream
 Specialization of std::istream to easily extract data from a ByteBufferView. More...
 
class  ByteSize
 Helper class to facilitate handling byte sizes. More...
 
class  Flags< Enum >
 Utility class to store a type-safe combination of enum-based bit fields. More...
 
class  Timer
 Stopwatch class to measure execution time. More...
 
class  LoggingTimer
 Scope guard-like stopwatch class to automatically log measured execution time on destruction of the guard object. More...
 
class  MultiTimer
 This class can be used to help the developer to profile the run time of different parts of the same process. More...
 
class  NotCopyable
 Inherit from this class if your class should be neither copy-constructible nor assignable. More...
 
struct  Overloaded< Ts >
 Syntactic sugar for easier implementation of visitors of a std::variant or our Utils::Variant. More...
 
class  ScopeGuard< ReleaseFunc >
 Templated proxy class to implement generic scope guards. More...
 
struct  Variant< Types >
 Specialization of std::variant offering additional convenience member functions for functionality that the standard library only provides in the form of free functions. More...
 
struct  Version
 Utility class to work with version information following the SemVer format. More...
 

Functions

template<typename T>
detail::RangeProxy< T > range (T begin, T end)
 An iterable wrapper for the half-open interval of integer numbers [begin, end).
 
template<typename T>
detail::RangeProxy< T > range (T end)
 An iterable wrapper for the half-open interval of integer numbers [0, end).
 
template<typename T>
detail::StepRangeProxy< T > range (T begin, T end, T step_size)
 An iterable wrapper for the uniformly numbers in the half-open interval [begin, end).
 
template<typename T>
detail::ReverseWrapper< T > reverse (T &&iterable)
 Iterator wrapper to reverse the iteration order.
 
template<class ReleaseFunc>
ScopeGuard< std::remove_reference_t< ReleaseFunc > > makeScopeGuard (ReleaseFunc &&f)
 Generator function to instantiate a ScopeGuard without writing out the templates.
 
template<class AcquisitionFunc, class ReleaseFunc>
ScopeGuard< std::remove_reference_t< ReleaseFunc > > makeScopeGuard (AcquisitionFunc &&acquisitionFunc, ReleaseFunc &&releaseFunc)
 Generator function to first execute acquisitionFunc and then instantiate a ScopeGuard with releaseFunc.
 

Function Documentation

◆ range() [1/3]

template<typename T>
detail::RangeProxy< T > range ( T begin,
T end )

#include <ImFusion/Core/Utils/Range.h>

An iterable wrapper for the half-open interval of integer numbers [begin, end).

Parameters
beginThe first element in the range.
endOne past the last element in the range.
for (int i : Utils::range(-2, 21))
...
detail::RangeProxy< T > range(T begin, T end)
An iterable wrapper for the half-open interval of integer numbers [begin, end).
Definition Range.h:28

is equivalent to

for (int i=-2; i<21 ++i)
...

◆ range() [2/3]

template<typename T>
detail::RangeProxy< T > range ( T end)

#include <ImFusion/Core/Utils/Range.h>

An iterable wrapper for the half-open interval of integer numbers [0, end).

param end One past the last element in the range.

is equivalent to

◆ range() [3/3]

template<typename T>
detail::StepRangeProxy< T > range ( T begin,
T end,
T step_size )

#include <ImFusion/Core/Utils/Range.h>

An iterable wrapper for the uniformly numbers in the half-open interval [begin, end).

Parameters
beginThe first element in the range.
endThe upper bound of the range.
step_sizeIncrement for each iteration step
for (double i : Utils::range(0.0, 10.0, 2.0))
...

is equivalent to

for (double i = 0.0; i < 10.0; i += 2.0)
...

◆ makeScopeGuard() [1/2]

template<class ReleaseFunc>
ScopeGuard< std::remove_reference_t< ReleaseFunc > > makeScopeGuard ( ReleaseFunc && f)
nodiscard

#include <ImFusion/Core/Utils/ScopeGuard.h>

Generator function to instantiate a ScopeGuard without writing out the templates.

Note
Make sure to capture the returned object.

◆ makeScopeGuard() [2/2]

template<class AcquisitionFunc, class ReleaseFunc>
ScopeGuard< std::remove_reference_t< ReleaseFunc > > makeScopeGuard ( AcquisitionFunc && acquisitionFunc,
ReleaseFunc && releaseFunc )
nodiscard

#include <ImFusion/Core/Utils/ScopeGuard.h>

Generator function to first execute acquisitionFunc and then instantiate a ScopeGuard with releaseFunc.

Some people prefer this overload since it has the code for acquisition and release at the same place right next to each other.

Note
Make sure to capture the returned object.
Search Tab / S to search, Esc to close