 |
SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
|
Go to the documentation of this file.
7 #ifndef swcdb_db_cells_SpecsKey_h
8 #define swcdb_db_cells_SpecsKey_h
15 namespace SWC {
namespace DB {
namespace Specs {
28 : std::string(std::move(fraction)),
comp(a_comp),
34 : std::string(buf, len),
comp(a_comp),
compiled(nullptr) {
44 : std::string(std::move(other)),
comp(other.comp),
46 other.compiled =
nullptr;
57 std::string::operator=(std::move(other));
60 other.compiled =
nullptr;
67 std::string::operator=(other);
75 std::string::operator=(std::move(other));
84 delete static_cast<re2::RE2*
>(
compiled);
96 reinterpret_cast<const uint8_t*
>(
data()),
97 reinterpret_cast<const uint8_t*
>(other.data()),
117 void decode(
const uint8_t** bufp,
size_t* remainp) {
121 append(
reinterpret_cast<const char*
>(*bufp), len);
127 void print(std::ostream& out,
bool pretty=
true)
const;
129 template<Types::KeySeq T_seq>
140 typedef std::shared_ptr<Key>
Ptr;
143 explicit Key() noexcept { }
146 explicit Key(
const uint8_t** bufp,
size_t* remainp) {
152 :
Vec(std::move(other)) {
160 explicit Key(
const Key& other);
188 (
begin()+idx)->comp = comp;
200 return add(fraction.c_str(), fraction.length(), comp);
205 return add(fraction.data(), fraction.length(), comp);
210 return add(fraction, strlen(fraction), comp);
215 return add(
reinterpret_cast<const char*
>(fraction), len, comp);
230 return insert(idx, fraction.c_str(), fraction.length(), comp);
236 return insert(idx, fraction.data(), fraction.length(), comp);
242 return insert(idx,
reinterpret_cast<const char*
>(fraction), len, comp);
247 return insert(idx, fraction, strlen(fraction), comp);
252 auto& f = (*this)[idx];
258 std::string_view
get(
const uint32_t idx)
const {
265 void remove(uint32_t idx,
bool recursive=
false);
272 len += it->encoded_length();
284 void decode(
const uint8_t** bufp,
size_t* remainp) {
287 for(
auto it =
begin(); it !=
cend(); ++it)
288 it->decode(bufp, remainp);
295 case Types::KeySeq::LEXIC:
296 case Types::KeySeq::FC_LEXIC:
298 case Types::KeySeq::VOLUME:
310 template<Types::KeySeq T_seq>
317 std::stringstream ss;
324 void print(std::ostream& out)
const;
326 void display(std::ostream& out,
bool pretty=
true)
const;
332 template<Types::KeySeq T_seq>
347 reinterpret_cast<const char*
>(ptr), len
351 return KeySeq::is_matching<T_seq>(
352 comp,
reinterpret_cast<const uint8_t*
>(c_str()),
size(), ptr, len);
361 for(
auto& f : *
this) {
370 return is_matching<Types::KeySeq::LEXIC>(key);
375 return is_matching<Types::KeySeq::VOLUME>(key);
378 template<Types::KeySeq T_seq>
384 const uint8_t* ptr = key.
data;
389 if(!it->is_matching<T_seq>(ptr, len))
394 switch((
cend() - 1)->comp) {
410 #ifdef SWC_IMPL_SOURCE
414 #endif // swcdb_db_cells_SpecsKey_h
bool is_matching_lexic(const Cell::Key &key) const
SWC_CAN_INLINE Fraction & add(const std::string &fraction, Condition::Comp comp)
SWC_CAN_INLINE Fraction & insert(uint32_t idx, const std::string &fraction, Condition::Comp comp)
SWC_CAN_INLINE void resize(size_type sz, ArgsT &&... args)
bool mem_eq(const uint8_t *b1, const uint8_t *b2, size_t count) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
SWC_CAN_INLINE void encode(uint8_t **bufp) const
SWC_CAN_INLINE uint32_t encoded_length() const noexcept
SWC_CAN_INLINE uint32_t encoded_length() const noexcept
SWC_CAN_INLINE Vector & operator=(Vector &&other) noexcept
bool is_matching(const uint8_t *ptr, uint32_t len) const
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi32(uint32_t val) noexcept
SWC_CAN_INLINE Fraction(Fraction &&other) noexcept
SWC_CAN_INLINE void release() noexcept
SWC_CAN_INLINE Fraction & insert(uint32_t idx, const uint8_t *fraction, uint32_t len, Condition::Comp comp)
std::shared_ptr< Key > Ptr
SWC_CAN_INLINE Fraction & operator=(const Fraction &other)
SWC_CAN_INLINE Fraction & insert(uint32_t idx, const std::string_view &fraction, Condition::Comp comp)
void copy(const Key &other)
SWC_CAN_INLINE Fraction(std::string &&fraction, Condition::Comp a_comp) noexcept
constexpr SWC_CAN_INLINE void encode_i8(uint8_t **bufp, uint8_t val) noexcept
void remove(uint32_t idx, bool recursive=false)
SWC_CAN_INLINE ~Fraction() noexcept
SWC_CAN_INLINE void set(int32_t idx, Condition::Comp comp)
void print(std::ostream &out, bool pretty=true) const
SWC_CAN_INLINE void decode(const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE Fraction & operator=(Fraction &&other) noexcept
constexpr SWC_CAN_INLINE bool empty() const noexcept
bool is_matching_volume(const Cell::Key &key) const
void print(std::ostream &out) const
SWC_CAN_INLINE Key(Key &&other) noexcept
The SWC-DB C++ namespace 'SWC'.
constexpr SWC_CAN_INLINE uint24_t decode_vi24(const uint8_t **bufp, size_t *remainp)
bool SWC_PURE_FUNC equal(const Key &other) const noexcept
SWC_CAN_INLINE Key(const DB::Cell::Key &cell_key, Condition::Comp comp)
void length(const ConnHandlerPtr &conn, const Event::Ptr &ev)
void set(const DB::Cell::Key &cell_key, Condition::Comp comp)
bool re(const re2::RE2 ®ex, const re2::StringPiece &value)
SWC_CAN_INLINE Fraction & add(const char *fraction, Condition::Comp comp)
bool is_matching(const Cell::Key &key) const
SWC_CAN_INLINE bool is_matching(const Types::KeySeq seq, const Cell::Key &key) const
SWC_CAN_INLINE Fraction(const char *buf, uint32_t len, Condition::Comp a_comp)
SWC_CAN_INLINE bool operator==(const Fraction &other) const
Fraction & add(Fraction &&other)
SWC_CAN_INLINE void encode(uint8_t **bufp) const
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
SWC_CAN_INLINE std::string to_string() const
constexpr SWC_CAN_INLINE void encode_vi32(uint8_t **bufp, uint32_t val)
SWC_CAN_INLINE Fraction() noexcept
SWC_CAN_INLINE Fraction & add(const std::string_view &fraction, Condition::Comp comp)
SWC_CAN_INLINE Fraction & insert(uint32_t idx, const char *fraction, Condition::Comp comp)
SWC_CAN_INLINE void decode(const uint8_t **bufp, size_t *remainp)
SWC_CAN_INLINE Key(const uint8_t **bufp, size_t *remainp)
void display(std::ostream &out, bool pretty=true) const
void append(const ConnHandlerPtr &conn, const Event::Ptr &ev)
SWC_CAN_INLINE Key() noexcept
SWC_CAN_INLINE Fraction & operator=(std::string &&other) noexcept
size_t size_of_internal() const noexcept
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
SWC_CAN_INLINE Fraction & add(const uint8_t *fraction, uint32_t len, Condition::Comp comp)
constexpr SWC_CAN_INLINE uint8_t decode_i8(const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE size_type size() const noexcept
SWC_CAN_INLINE void move(Key &other) noexcept
SWC_CAN_INLINE std::string_view get(const uint32_t idx, Condition::Comp &comp) const
Fraction & insert(uint32_t idx, Fraction &&other)
Core::Vector< Fraction > Vec
SWC_CAN_INLINE std::string_view get(const uint32_t idx) const
constexpr SWC_CAN_INLINE uint32_t decode_vi32(const uint8_t **bufp, size_t *remainp)
constexpr SWC_CAN_INLINE iterator begin() noexcept
SWC_CAN_INLINE Fraction(const Fraction &other)