rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
Public Types | Public Member Functions | List of all members
r_Sinterval Class Reference

The class represents an interval with lower and upper bound. More...

#include <sinterval.hh>

Public Types

using BoundType = r_Range
 
using OffsetType = size_t
 

Public Member Functions

 r_Sinterval ()=default
 default constructor creates an interval with open bounds More...
 
 r_Sinterval (const char *)
 constructor taking string representation (e.g. *:200 ) More...
 
 r_Sinterval (r_Range low, r_Range high)
 constructor for an interval with fixed bounds More...
 
 r_Sinterval (r_Range point)
 constructor for a slice (TODO) More...
 
 r_Sinterval (char, r_Range high)
 
 r_Sinterval (r_Range low, char)
 
 r_Sinterval (char, char)
 
bool operator== (const r_Sinterval &) const
 Two intervals are equal if they have the same lower and upper bound. More...
 
bool operator!= (const r_Sinterval &) const
 non equal operator - negation of equal operator More...
 
r_Range low () const noexcept
 
r_Range high () const noexcept
 
OffsetType get_extent () const
 get the size of one dimensional interval as range (high() - low() + 1) More...
 
bool is_fixed () const noexcept
 
bool is_low_fixed () const noexcept
 
bool is_low_unbounded () const noexcept
 
bool is_high_fixed () const noexcept
 
bool is_high_unbounded () const noexcept
 
bool is_slice () const noexcept
 
void set_low (r_Range low)
 
void set_low (char) noexcept
 
void set_high (r_Range high)
 
void set_high (char) noexcept
 
void set_interval (r_Range low, r_Range high)
 
void set_interval (char, r_Range high) noexcept
 
void set_interval (r_Range low, char) noexcept
 
void set_interval (char, char) noexcept
 
void set_slice () noexcept
 
const std::string & get_axis_name () const
 
void set_axis_name (const std::string &axis_name_arg)
 set an axis name for this interval; an empty string will clear any axis name. More...
 
bool has_axis_name () const
 
OffsetType get_offset_to (BoundType o) const noexcept
 get distance to lower bound of this interval from o; this interval is assumed to be fixed in the lower bound, and o >= this.low() More...
 
OffsetType get_offset_to (const r_Sinterval &o) const noexcept
 get distance to lower bound of this interval from lower bound of o; intervals must be fixed in lower bound, and o.low() >= this.low() More...
 
r_Sinterval translate_by (BoundType offset) const
 translate this interval by a given offset; assumes that this interval has fixed bounds More...
 
r_Sintervalunion_of (const r_Sinterval &, const r_Sinterval &)
 
r_Sintervalunion_with (const r_Sinterval &)
 
r_Sintervaloperator+= (const r_Sinterval &)
 
r_Sinterval create_union (const r_Sinterval &) const
 
r_Sinterval operator+ (const r_Sinterval &) const
 
bool inside_of (const r_Sinterval &o) const
 
r_Sintervaldifference_of (const r_Sinterval &, const r_Sinterval &)
 
r_Sintervaldifference_with (const r_Sinterval &)
 
r_Sintervaloperator-= (const r_Sinterval &)
 
r_Sinterval create_difference (const r_Sinterval &) const
 
r_Sinterval operator- (const r_Sinterval &) const
 
r_Sintervalintersection_of (const r_Sinterval &, const r_Sinterval &)
 
r_Sintervalintersection_with (const r_Sinterval &)
 
r_Sintervaloperator*= (const r_Sinterval &)
 
r_Sinterval create_intersection (const r_Sinterval &) const
 
r_Sinterval operator* (const r_Sinterval &) const
 
bool intersects_with (const r_Sinterval &) const
 determines if the self interval intersects with the delivered one More...
 
r_Sintervalclosure_of (const r_Sinterval &, const r_Sinterval &)
 
r_Sintervalclosure_with (const r_Sinterval &)
 
r_Sinterval create_closure (const r_Sinterval &) const
 
void print_status (std::ostream &s) const
 writes the state of the object to the specified stream More...
 
char * get_string_representation () const
 Returns a string representation of this sinterval as a pointer that should eventually be deallocated by the caller with free(). More...
 
std::string to_string () const
 Returns a string representation of this sinterval as a string object. More...
 
r_Bytes get_storage_size () const
 calculate the size of the storage space occupied More...
 

Detailed Description

The class represents an interval with lower and upper bound.

Operations on the interval are defined according to the ODMG-93 standard. The operations union, difference, and intersection are defined according to the following table:

| ... fixed bound ... open bound

class orientation union difference intersection
-----------------------------------------------------------
1 |-a-| |-b-| error a error
2 |-a-| [a1,b2] [a1,b1] [b1,a2]
|-b-|
3 |--a--| a error b
|-b-|
4 |-b-| [b1,a2] [b2,a2] [a1,b2]
|-a-|
5 |--b--| b error a
|-a-|
6 |-b-| |-a-| error a error
7 |-a-|-b-| [a1,b2] a [a2,a2]
8 |-b-|-a-| [b1,a2] a [b2,b2]
9 |--a--| a [a1,b1] b
|-b-|
10 |--a--| a [b2,a2] b
|-b-|
11 |-a-| a error a
|-b-|
12 |--b--| b error a
|-a-|
13 |--b--| b error a
|-a-|
-----------------------------------------------------
14 |--a--* a error b
|-b-|
15 |--a--* a [b2,a2] b
|-b-|
16 |-b-| |-a-* error a error
17 |-b-|-a-* [b1,a2] a [b2,b2]
18 |--a--* [b1,a2] [b2,a2] [a1,b2]
|-b-|
-----------------------------------------------------
19 *--a--| a error b
|-b-|
20 *--a--| a [a1,b1] b
|-b-|
21 *-a-| |-b-| error a error
22 *-a-|-b-| [a1,b2] a [a2,a2]
23 *--a--| [a1,b2] [a1,b1] [b1,a2]
|-b-|
-----------------------------------------------------
24 |--b--* b error a
|-a-|
25 |--b--* b error a
|-a-|
26 |-a-| |-b-* error a error
27 |-a-|-b-* [a1,b2] a [a2,a2]
28 |--b--* [a1,b2] [a1,b1] [b1,a2]
|-a-|
-----------------------------------------------------
29 *--b--| b error a
|-a-|
30 *--b--| b error a
|-a-|
31 *-b-| |-a-| error a error
32 *-b-|-a-| [b1,a2] a [b2,b2]
33 *--b--| [b1,a2] [b2,a2] [a1,b2]
|-a-|
-----------------------------------------------------
34 *-a-| |-b-* error a error
35 *-a-|-b-* [a1,b2] a [a2,a2]
36 *-a-| [a1,b2] [a1,b1] [b1,a2]
|-b-*
-----------------------------------------------------
37 *-b-| |-a-* error a error
38 *-b-|-a-* [b1,a2] a [b2,b2]
39 *-b-| [b1,a2] [a1,b1] [a1,b2]
|-a-*
-----------------------------------------------------
40 *-a-| b error a
-b-|
41 *-a-| a error a
-b-|
42 *-b-| a [b2,a2] b
-a-|
-----------------------------------------------------
43 |-a-* a [a1,b1] b
|-b-*
44 |-a-* a error a
|-b-*
45 |-b-* b error a
|-a-*
-----------------------------------------------------
46 *-a-* |-b-| a error b
47 *-b-* |-a-| b error a
48 *-a-* a [b2,a2] b
-b-|
49 *-a-* a [a1,b1] b
|-b-*
50 *-b-* b error a
-a-|
51 *-b-* b error a
|-a-*
52 *-a-* a error a
-b-*

Attention: The difference operation has to be reconsidered in future concerning a discrete interpretation of the intervals.

The closure operation defines an interval which is the smallest interval containing the two operands. The method intersects_with() returns 0 in the error cases of the intersection operation and 1 otherwise.

Member Typedef Documentation

◆ BoundType

◆ OffsetType

using r_Sinterval::OffsetType = size_t

Constructor & Destructor Documentation

◆ r_Sinterval() [1/7]

r_Sinterval::r_Sinterval ( )
default

default constructor creates an interval with open bounds

◆ r_Sinterval() [2/7]

r_Sinterval::r_Sinterval ( const char *  )
explicit

constructor taking string representation (e.g. *:200 )

◆ r_Sinterval() [3/7]

r_Sinterval::r_Sinterval ( r_Range  low,
r_Range  high 
)

constructor for an interval with fixed bounds

◆ r_Sinterval() [4/7]

r_Sinterval::r_Sinterval ( r_Range  point)
explicit

constructor for a slice (TODO)

◆ r_Sinterval() [5/7]

r_Sinterval::r_Sinterval ( char  ,
r_Range  high 
)

◆ r_Sinterval() [6/7]

r_Sinterval::r_Sinterval ( r_Range  low,
char   
)

◆ r_Sinterval() [7/7]

r_Sinterval::r_Sinterval ( char  ,
char   
)

Member Function Documentation

◆ closure_of()

r_Sinterval& r_Sinterval::closure_of ( const r_Sinterval ,
const r_Sinterval  
)

◆ closure_with()

r_Sinterval& r_Sinterval::closure_with ( const r_Sinterval )

◆ create_closure()

r_Sinterval r_Sinterval::create_closure ( const r_Sinterval ) const

◆ create_difference()

r_Sinterval r_Sinterval::create_difference ( const r_Sinterval ) const

◆ create_intersection()

r_Sinterval r_Sinterval::create_intersection ( const r_Sinterval ) const

◆ create_union()

r_Sinterval r_Sinterval::create_union ( const r_Sinterval ) const

◆ difference_of()

r_Sinterval& r_Sinterval::difference_of ( const r_Sinterval ,
const r_Sinterval  
)

◆ difference_with()

r_Sinterval& r_Sinterval::difference_with ( const r_Sinterval )

◆ get_axis_name()

const std::string& r_Sinterval::get_axis_name ( ) const
Returns
the axis name of this interval; the interval has no axis name if an empty string is returned.

◆ get_extent()

OffsetType r_Sinterval::get_extent ( ) const

get the size of one dimensional interval as range (high() - low() + 1)

◆ get_offset_to() [1/2]

OffsetType r_Sinterval::get_offset_to ( BoundType  o) const
noexcept

get distance to lower bound of this interval from o; this interval is assumed to be fixed in the lower bound, and o >= this.low()

◆ get_offset_to() [2/2]

OffsetType r_Sinterval::get_offset_to ( const r_Sinterval o) const
noexcept

get distance to lower bound of this interval from lower bound of o; intervals must be fixed in lower bound, and o.low() >= this.low()

◆ get_storage_size()

r_Bytes r_Sinterval::get_storage_size ( ) const

calculate the size of the storage space occupied

◆ get_string_representation()

char* r_Sinterval::get_string_representation ( ) const

Returns a string representation of this sinterval as a pointer that should eventually be deallocated by the caller with free().

◆ has_axis_name()

bool r_Sinterval::has_axis_name ( ) const
Returns
true if the interval has an axis name set, false otherwise

◆ high()

r_Range r_Sinterval::high ( ) const
noexcept

◆ inside_of()

bool r_Sinterval::inside_of ( const r_Sinterval o) const
Returns
true if this interval is inside of

◆ intersection_of()

r_Sinterval& r_Sinterval::intersection_of ( const r_Sinterval ,
const r_Sinterval  
)

◆ intersection_with()

r_Sinterval& r_Sinterval::intersection_with ( const r_Sinterval )

◆ intersects_with()

bool r_Sinterval::intersects_with ( const r_Sinterval ) const

determines if the self interval intersects with the delivered one

◆ is_fixed()

bool r_Sinterval::is_fixed ( ) const
noexcept
Returns
true if lower and upper bounds are fixed

◆ is_high_fixed()

bool r_Sinterval::is_high_fixed ( ) const
noexcept

◆ is_high_unbounded()

bool r_Sinterval::is_high_unbounded ( ) const
noexcept

◆ is_low_fixed()

bool r_Sinterval::is_low_fixed ( ) const
noexcept

◆ is_low_unbounded()

bool r_Sinterval::is_low_unbounded ( ) const
noexcept

◆ is_slice()

bool r_Sinterval::is_slice ( ) const
noexcept
Returns
TRUE if the interval represents a single point, FALSE otherwise.

◆ low()

r_Range r_Sinterval::low ( ) const
noexcept

◆ operator!=()

bool r_Sinterval::operator!= ( const r_Sinterval ) const

non equal operator - negation of equal operator

◆ operator*()

r_Sinterval r_Sinterval::operator* ( const r_Sinterval ) const

◆ operator*=()

r_Sinterval& r_Sinterval::operator*= ( const r_Sinterval )

◆ operator+()

r_Sinterval r_Sinterval::operator+ ( const r_Sinterval ) const

◆ operator+=()

r_Sinterval& r_Sinterval::operator+= ( const r_Sinterval )

◆ operator-()

r_Sinterval r_Sinterval::operator- ( const r_Sinterval ) const

◆ operator-=()

r_Sinterval& r_Sinterval::operator-= ( const r_Sinterval )

◆ operator==()

bool r_Sinterval::operator== ( const r_Sinterval ) const

Two intervals are equal if they have the same lower and upper bound.

◆ print_status()

void r_Sinterval::print_status ( std::ostream &  s) const

writes the state of the object to the specified stream

◆ set_axis_name()

void r_Sinterval::set_axis_name ( const std::string &  axis_name_arg)

set an axis name for this interval; an empty string will clear any axis name.

◆ set_high() [1/2]

void r_Sinterval::set_high ( char  )
noexcept

◆ set_high() [2/2]

void r_Sinterval::set_high ( r_Range  high)

◆ set_interval() [1/4]

void r_Sinterval::set_interval ( char  ,
char   
)
noexcept

◆ set_interval() [2/4]

void r_Sinterval::set_interval ( char  ,
r_Range  high 
)
noexcept

◆ set_interval() [3/4]

void r_Sinterval::set_interval ( r_Range  low,
char   
)
noexcept

◆ set_interval() [4/4]

void r_Sinterval::set_interval ( r_Range  low,
r_Range  high 
)

◆ set_low() [1/2]

void r_Sinterval::set_low ( char  )
noexcept

◆ set_low() [2/2]

void r_Sinterval::set_low ( r_Range  low)

◆ set_slice()

void r_Sinterval::set_slice ( )
noexcept

◆ to_string()

std::string r_Sinterval::to_string ( ) const

Returns a string representation of this sinterval as a string object.

◆ translate_by()

r_Sinterval r_Sinterval::translate_by ( BoundType  offset) const

translate this interval by a given offset; assumes that this interval has fixed bounds

◆ union_of()

r_Sinterval& r_Sinterval::union_of ( const r_Sinterval ,
const r_Sinterval  
)

◆ union_with()

r_Sinterval& r_Sinterval::union_with ( const r_Sinterval )

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