vkdb
A time series database engine in C++.
Loading...
Searching...
No Matches
vkdb::DataRange< TData > Class Template Reference

A range of data. More...

#include <data_range.h>

Public Types

using data_type = TData
 

Public Member Functions

 DataRange () noexcept
 Construct a new DataRange object.
 
 DataRange (const data_type &start, const data_type &end) noexcept
 Construct a new DataRange object from the given start and end.
 
 DataRange (std::string &&str)
 Construct a new DataRange object from the given string.
 
 DataRange (DataRange &&) noexcept=default
 Move-construct a DataRange object.
 
DataRangeoperator= (DataRange &&) noexcept=default
 Move-assign a DataRange object.
 
 DataRange (const DataRange &) noexcept=default
 Copy-construct a DataRange object.
 
DataRangeoperator= (const DataRange &) noexcept=default
 Copy-assign a DataRange object.
 
 ~DataRange () noexcept=default
 Destroy the DataRange object.
 
auto operator<=> (const DataRange &other) const noexcept
 
void updateRange (const data_type &data) noexcept
 Update the range with the given data.
 
bool inRange (const data_type &data) const noexcept
 Check if the data is in the range.
 
bool overlapsWith (const data_type &start, const data_type &end) const noexcept
 Check if the range overlaps with the given range.
 
data_type lower () const
 Get the lower bound of the range.
 
data_type upper () const
 Get the upper bound of the range.
 
void clear () noexcept
 Clear the range.
 
std::string str () const noexcept
 Convert the range to a string.
 

Detailed Description

template<RegularNoCVRefQuals TData>
requires std::totally_ordered<TData>
class vkdb::DataRange< TData >

A range of data.

Template Parameters
TDataThe data type.

Definition at line 16 of file data_range.h.

Member Typedef Documentation

◆ data_type

template<RegularNoCVRefQuals TData>
using vkdb::DataRange< TData >::data_type = TData

Definition at line 18 of file data_range.h.

Constructor & Destructor Documentation

◆ DataRange() [1/3]

template<RegularNoCVRefQuals TData>
vkdb::DataRange< TData >::DataRange ( )
inlinenoexcept

Construct a new DataRange object.

Definition at line 24 of file data_range.h.

◆ DataRange() [2/3]

template<RegularNoCVRefQuals TData>
vkdb::DataRange< TData >::DataRange ( const data_type & start,
const data_type & end )
inlinenoexcept

Construct a new DataRange object from the given start and end.

Parameters
startThe start of the range.
endThe end of the range.

Definition at line 33 of file data_range.h.

◆ DataRange() [3/3]

template<RegularNoCVRefQuals TData>
vkdb::DataRange< TData >::DataRange ( std::string && str)
inline

Construct a new DataRange object from the given string.

Parameters
strThe string representation of the range.
Exceptions
std::invalid_argumentIf the range string is invalid.

Definition at line 43 of file data_range.h.

Member Function Documentation

◆ clear()

template<RegularNoCVRefQuals TData>
void vkdb::DataRange< TData >::clear ( )
inlinenoexcept

Clear the range.

Definition at line 183 of file data_range.h.

◆ inRange()

template<RegularNoCVRefQuals TData>
bool vkdb::DataRange< TData >::inRange ( const data_type & data) const
inlinenodiscardnoexcept

Check if the data is in the range.

Parameters
dataThe data.
Returns
true if the data is in the range.
false if the data is not in the range.

Definition at line 132 of file data_range.h.

◆ lower()

template<RegularNoCVRefQuals TData>
data_type vkdb::DataRange< TData >::lower ( ) const
inlinenodiscard

Get the lower bound of the range.

Returns
data_type The lower bound of the range.
Exceptions
std::logic_errorIf the range is not set.

Definition at line 158 of file data_range.h.

◆ operator<=>()

template<RegularNoCVRefQuals TData>
auto vkdb::DataRange< TData >::operator<=> ( const DataRange< TData > & other) const
inlinenodiscardnoexcept

Definition at line 96 of file data_range.h.

◆ overlapsWith()

template<RegularNoCVRefQuals TData>
bool vkdb::DataRange< TData >::overlapsWith ( const data_type & start,
const data_type & end ) const
inlinenodiscardnoexcept

Check if the range overlaps with the given range.

Parameters
startThe start of the range.
endThe end of the range.
Returns
true if the ranges overlap.
false if the ranges do not overlap.

Definition at line 144 of file data_range.h.

◆ str()

template<RegularNoCVRefQuals TData>
std::string vkdb::DataRange< TData >::str ( ) const
inlinenodiscardnoexcept

Convert the range to a string.

Returns
std::string The string representation of the range.

Definition at line 192 of file data_range.h.

◆ updateRange()

template<RegularNoCVRefQuals TData>
void vkdb::DataRange< TData >::updateRange ( const data_type & data)
inlinenoexcept

Update the range with the given data.

If the range is not set, the range is set to the data, otherwise the range is updated to include the data.

Parameters
dataThe data.

Definition at line 113 of file data_range.h.

◆ upper()

template<RegularNoCVRefQuals TData>
data_type vkdb::DataRange< TData >::upper ( ) const
inlinenodiscard

Get the upper bound of the range.

Returns
data_type The upper bound of the range.
Exceptions
std::logic_errorIf the range is not set.

Definition at line 172 of file data_range.h.


The documentation for this class was generated from the following file: