FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
fcb::KeyValue Class Reference

A decoded index key. More...

#include <fcb/key.hpp>

Public Member Functions

 KeyValue ()=default
 
KeyKind kind () const
 
const std::string & original_string () const
 The original, untruncated string this key was built from.
 

Static Public Member Functions

static KeyValue from_i8 (std::int8_t v)
 
static KeyValue from_u8 (std::uint8_t v)
 
static KeyValue from_i16 (std::int16_t v)
 
static KeyValue from_u16 (std::uint16_t v)
 
static KeyValue from_i32 (std::int32_t v)
 
static KeyValue from_u32 (std::uint32_t v)
 
static KeyValue from_i64 (std::int64_t v)
 
static KeyValue from_u64 (std::uint64_t v)
 
static KeyValue from_f32 (float v)
 
static KeyValue from_f64 (double v)
 
static KeyValue from_bool (bool v)
 
static KeyValue from_datetime (std::int64_t seconds, std::uint32_t nanos)
 
static KeyValue from_string (KeyKind kind, const std::string &v)
 

Friends

std::vector< std::uint8_t > encode_key (const KeyValue &)
 
KeyValue decode_key (KeyKind, bytes_view)
 
int compare_keys (const KeyValue &, const KeyValue &)
 Three-way comparison.
 

Detailed Description

A decoded index key.

Ordering is NOT bytewise for floats: the on-disk bytes are the plain IEEE-754 bit pattern, and ordered_float semantics are applied after decoding (see compare_keys).

Definition at line 40 of file key.hpp.

Constructor & Destructor Documentation

◆ KeyValue()

fcb::KeyValue::KeyValue ( )
default

Member Function Documentation

◆ from_bool()

KeyValue fcb::KeyValue::from_bool ( bool  v)
static

Definition at line 122 of file key.cpp.

References fcb::Bool.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_datetime()

KeyValue fcb::KeyValue::from_datetime ( std::int64_t  seconds,
std::uint32_t  nanos 
)
static

Definition at line 129 of file key.cpp.

References fcb::DateTime, nanos, and seconds.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_f32()

KeyValue fcb::KeyValue::from_f32 ( float  v)
static

Definition at line 108 of file key.cpp.

References fcb::Float32.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_f64()

KeyValue fcb::KeyValue::from_f64 ( double  v)
static

Definition at line 115 of file key.cpp.

References fcb::Float64.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_i16()

KeyValue fcb::KeyValue::from_i16 ( std::int16_t  v)
static

Definition at line 100 of file key.cpp.

Referenced by fcb::key_max(), and fcb::key_min().

◆ from_i32()

KeyValue fcb::KeyValue::from_i32 ( std::int32_t  v)
static

Definition at line 102 of file key.cpp.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_i64()

KeyValue fcb::KeyValue::from_i64 ( std::int64_t  v)
static

Definition at line 104 of file key.cpp.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_i8()

KeyValue fcb::KeyValue::from_i8 ( std::int8_t  v)
static

Definition at line 98 of file key.cpp.

Referenced by fcb::key_max(), and fcb::key_min().

◆ from_string()

KeyValue fcb::KeyValue::from_string ( KeyKind  kind,
const std::string &  v 
)
static

Definition at line 137 of file key.cpp.

References kind(), and fcb::UnsupportedColumnType.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_u16()

KeyValue fcb::KeyValue::from_u16 ( std::uint16_t  v)
static

Definition at line 101 of file key.cpp.

Referenced by fcb::key_max(), and fcb::key_min().

◆ from_u32()

KeyValue fcb::KeyValue::from_u32 ( std::uint32_t  v)
static

Definition at line 103 of file key.cpp.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_u64()

KeyValue fcb::KeyValue::from_u64 ( std::uint64_t  v)
static

Definition at line 105 of file key.cpp.

Referenced by fcb::attribute_to_index_entries(), fcb::key_max(), and fcb::key_min().

◆ from_u8()

KeyValue fcb::KeyValue::from_u8 ( std::uint8_t  v)
static

Definition at line 99 of file key.cpp.

Referenced by fcb::key_max(), and fcb::key_min().

◆ kind()

KeyKind fcb::KeyValue::kind ( ) const
inline

Definition at line 58 of file key.hpp.

Referenced by from_string().

◆ original_string()

const std::string & fcb::KeyValue::original_string ( ) const
inline

The original, untruncated string this key was built from.

Needed for post-filtering, since the encoded key keeps only the first N bytes.

Definition at line 62 of file key.hpp.

Friends And Related Symbol Documentation

◆ compare_keys

int compare_keys ( const KeyValue a,
const KeyValue b 
)
friend

Three-way comparison.

Throws if the kinds differ, rather than inventing an ordering between unrelated types.

Definition at line 272 of file key.cpp.

◆ decode_key

KeyValue decode_key ( KeyKind  kind,
bytes_view  b 
)
friend

Definition at line 219 of file key.cpp.

◆ encode_key

std::vector< std::uint8_t > encode_key ( const KeyValue v)
friend

Definition at line 147 of file key.cpp.


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