|
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.
11 namespace SWC {
namespace DB {
namespace Specs {
12 namespace Serial {
namespace Value {
19 :
Field(a_fid), comp(a_comp), value(a_value) {
23 :
Field(bufp, remainp),
24 comp(Condition::
Comp(Serialization::
decode_i8(bufp, remainp))),
46 out <<
fid <<
':' <<
'I' <<
':'
55 const long double& a_value)
56 :
Field(a_fid), comp(a_comp), value(a_value) {
60 :
Field(bufp, remainp),
61 comp(Condition::
Comp(Serialization::
decode_i8(bufp, remainp))),
83 out <<
fid <<
':' <<
'D' <<
':'
92 const uint8_t* ptr,
size_t len,
94 :
Field(a_fid), comp(a_comp), value() {
97 :
value.
set(
const_cast<uint8_t*
>(ptr), len,
false);
102 :
Field(bufp, remainp),
103 comp(Condition::
Comp(Serialization::
decode_i8(bufp, remainp))),
109 :
value.
set(
const_cast<uint8_t*
>(ptr), len,
false);
131 out <<
fid <<
':' <<
'B' <<
':'
136 for(
const uint8_t* ptr =
value.
base; ptr < end; ++ptr) {
139 if(31 < *ptr && *ptr < 127) {
142 sprintf(hex,
"0x%X", *ptr);
155 :
Field(a_fid), seq(a_seq), key() {
159 :
Field(a_fid), seq(a_seq), key(a_key) {
163 :
Field(bufp, remainp),
184 out <<
fid <<
':' <<
'K' <<
':';
193 :
Field(a_fid), comp(a_comp),
200 comp(a_comp), items(a_items), _found() {
204 :
Field(bufp, remainp),
205 comp(Condition::
Comp(Serialization::
decode_i8(bufp, remainp))),
234 uint8_t* ptr = value.
base;
245 const uint8_t* ptr = vfield->
base;
246 size_t remain = vfield->size;
251 for(; remain && it !=
items.
cend(); ++it) {
266 for(; remain && it !=
items.
cend(); ++it) {
292 for(uint32_t i = 0; i < sz; ++i) {
315 for(uint32_t i = 0; ;) {
341 for(
bool start =
false; remain && it !=
items.
cend(); ) {
357 for(
auto it = ord; ;) {
373 for(
auto it = ord; ;) {
410 :
Field(a_fid), comp(a_comp),
417 comp(a_comp), items(a_items), _found() {
421 :
Field(bufp, remainp),
422 comp(Condition::
Comp(Serialization::
decode_i8(bufp, remainp))),
431 item.value.append(
reinterpret_cast<const char*
>(vptr), vlen);
454 uint8_t* ptr = value.
base;
465 const uint8_t* ptr = vfield->
base;
466 size_t remain = vfield->size;
471 for(; remain && it !=
items.
cend(); ++it) {
476 reinterpret_cast<const uint8_t*
>(it->value.c_str()),
490 for(; remain && it !=
items.
cend(); ++it) {
495 reinterpret_cast<const uint8_t*
>(it->value.c_str()),
521 for(uint32_t i = 0; i < sz; ++i) {
525 reinterpret_cast<const uint8_t*
>(
items[i].value.c_str()),
549 &ptr, &remain, &vlen);
550 for(uint32_t i = 0; ;) {
554 reinterpret_cast<const uint8_t*
>(
items[i].value.c_str()),
574 reinterpret_cast<const uint8_t*
>(it->value.c_str()),
584 for(
bool start =
false; remain && it !=
items.
cend(); ) {
589 reinterpret_cast<const uint8_t*
>(it->value.c_str()),
605 for(
auto it = ord; ;) {
608 reinterpret_cast<const uint8_t*
>(it->value.c_str()),
626 for(
auto it = ord; ;) {
629 reinterpret_cast<const uint8_t*
>(it->value.c_str()),
657 const uint8_t* cptr =
reinterpret_cast<const uint8_t*
>(it->value.c_str());
658 const uint8_t* end = cptr + it->value.size();
659 for(; cptr < end; ++cptr) {
662 if(31 < *cptr && *cptr < 127) {
665 sprintf(hex,
"0x%X", *cptr);
682 : fields(), _fields_ptr() {
717 for(
auto& field : fields) {
718 if(field->fid == fid)
731 sz += field->encoded_length();
739 uint8_t* ptr = buffer.
base;
760 for(
auto it = fields_ptr.
begin(); it != fields_ptr.
cend(); ++it) {
762 if((*it)->type() == TypeT && vfieldp->
fid == (*it)->fid) {
763 if(!(*it)->is_matching(vfieldp))
781 const uint8_t* ptr = v.
base;
782 size_t remain = v.
size;
793 if(!Value::is_matching<Type::INT64>(
_fields_ptr, &vfield, &more))
800 if(!Value::is_matching<Type::DOUBLE>(
_fields_ptr, &vfield, &more))
807 if(!Value::is_matching<Type::BYTES>(
_fields_ptr, &vfield, &more))
814 if(!Value::is_matching<Type::KEY>(
_fields_ptr, &vfield, &more))
821 if(!Value::is_matching<Type::LIST_INT64>(
_fields_ptr, &vfield, &more))
828 if(!Value::is_matching<Type::LIST_BYTES>(
_fields_ptr, &vfield, &more))
843 out <<
"SerialFields(size=" <<
fields.
size() <<
" [";
845 fields[i]->print(out <<
'(');
bool is_matching(Cell::Serial::Value::Field *vfieldp) override
void print(std::ostream &out) const override
void print(std::ostream &out) const override
SWC_CAN_INLINE bool is_matching_extended(uint8_t comp, const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len)
constexpr SWC_CAN_INLINE uint8_t encoded_length_double() noexcept
void print(std::ostream &out) const
Core::Vector< bool > _found
SWC_CAN_INLINE void resize(size_type sz, ArgsT &&... args)
void add(Field::Ptr &&field)
SWC_CAN_INLINE uint32_t encoded_length() const noexcept
virtual void encode(uint8_t **bufp) const =0
constexpr SWC_CAN_INLINE size_t encoded_length_bytes(size_t len) noexcept
SWC_CAN_INLINE void set(const char *data_n, Condition::Comp comp_n, bool owner)
void encode(uint8_t **bufp) const override
Core::Vector< Field * > _fields_ptr
constexpr SWC_CAN_INLINE const uint8_t * decode_bytes(const uint8_t **bufp, size_t *remainp, size_t *lenp)
SWC_CAN_INLINE void encode_double(uint8_t **bufp, long double val) noexcept
size_t SWC_PURE_FUNC encoded_length() const noexcept override
bool is_matching(Cell::Serial::Value::Field *vfieldp) override
void encode(uint8_t **bufp) const override
Field_BYTES(uint24_t fid, Condition::Comp comp, const uint8_t *ptr, size_t len, bool take_ownership)
virtual size_t encoded_length() const noexcept
void print(std::ostream &out) const override
size_t SWC_PURE_FUNC encoded_length() const noexcept override
constexpr SWC_CAN_INLINE void encode_i8(uint8_t **bufp, uint8_t val) noexcept
SWC_CAN_INLINE void encode_bytes(uint8_t **bufp, const void *data, size_t len)
size_t SWC_PURE_FUNC encoded_length() const noexcept override
SWC_CAN_INLINE void free() noexcept
bool is_matching(const Cells::Cell &cell)
void encode(uint8_t **bufp) const override
constexpr SWC_CAN_INLINE bool empty() const noexcept
void encode(uint8_t **bufp) const override
The SWC-DB C++ namespace 'SWC'.
void print(std::ostream &out) const override
SWC_CAN_INLINE bool is_matching(Core::Vector< Field * > &fields_ptr, Cell::Serial::Value::Field *vfieldp, bool *more)
void encode(uint8_t **bufp) const override
Field_KEY(uint24_t fid, Types::KeySeq seq)
Types::Encoder get_value(StaticBuffer &v, bool owner) const
SWC_CAN_INLINE Fields() noexcept
Core::Vector< bool > _found
void encode(uint8_t **bufp) const override
std::unique_ptr< Field > Ptr
size_t SWC_PURE_FUNC encoded_length() const noexcept override
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi64(uint64_t val) noexcept
SWC_CAN_INLINE bool is_matching(bool volumetric, uint8_t comp, const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len)
bool is_matching(Cell::Serial::Value::Field *vfieldp) override
SWC_CAN_INLINE bool is_matching(const Types::KeySeq seq, const Cell::Key &key) const
SWC_CAN_INLINE Type read_type(const uint8_t **bufp, size_t *remainp)
size_t SWC_PURE_FUNC encoded_length() const noexcept override
Field_DOUBLE(uint24_t fid, Condition::Comp comp, const long double &value)
Core::Vector< Field::Ptr > fields
Field_LIST_INT64(uint24_t fid, Condition::Comp comp)
SWC_CAN_INLINE void encode(uint8_t **bufp) const
constexpr SWC_CAN_INLINE const_iterator cend() const noexcept
bool is_matching(Cell::Serial::Value::Field *vfieldp) override
bool SWC_PURE_FUNC has_field_id(uint24_t fid) const noexcept
constexpr SWC_CAN_INLINE uint64_t decode_vi64(const uint8_t **bufp, size_t *remainp)
const char *SWC_CONST_FUNC to_string(Comp comp) noexcept
constexpr SWC_CAN_INLINE void encode_vi64(uint8_t **bufp, uint64_t val)
void display(std::ostream &out, bool pretty=true) const
bool is_matching(Cell::Serial::Value::Field *vfieldp) override
Field_INT64(uint24_t fid, Condition::Comp comp, int64_t value)
SWC_CAN_INLINE void push_back(ArgsT &&... args)
SWC_CAN_INLINE long double decode_double(const uint8_t **bufp, size_t *remainp)
size_t SWC_PURE_FUNC encoded_length() const noexcept override
size_t encoded_length() const noexcept
constexpr SWC_CAN_INLINE const_iterator cbegin() const noexcept
bool SWC_PURE_FUNC is_matching(Cell::Serial::Value::Field *vfieldp) override
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 reference emplace_back(ArgsT &&... args)
void print(std::ostream &out) const override
void print(std::ostream &out) const override
Field_LIST_BYTES(uint24_t fid, Condition::Comp comp)
constexpr SWC_CAN_INLINE iterator begin() noexcept
SWC_CAN_INLINE void assign(const value_type *data, size_t len)
void set(value_type *data, size_t len, bool take_ownership) noexcept
void encode(Specs::Value &value) const