SWC-DB
v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Encoder.h
Go to the documentation of this file.
1
/*
2
* SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3
* License details at <https://github.com/kashirin-alex/swc-db/#license>
4
*/
5
6
#ifndef swcdb_core_Encoder_h
7
#define swcdb_core_Encoder_h
8
9
#include "
swcdb/core/Buffer.h
"
10
11
12
namespace
SWC
{
namespace
Core {
13
14
16
namespace
Encoder
{
17
18
19
#ifndef SWC_DEFAULT_ENCODER
20
#define SWC_DEFAULT_ENCODER ZSTD
21
#endif
22
23
#define SWC_DEFAULT_COMM_ENCODER SWC::Core::Encoder::Type::SWC_DEFAULT_ENCODER
24
#define SWC_DEFAULT_STORAGE_ENCODER SWC::Core::Encoder::Type::SWC_DEFAULT_ENCODER
25
26
27
28
enum class
Type
: uint8_t {
29
DEFAULT
= 0x00,
30
PLAIN = 0x01,
31
ZLIB = 0x02,
32
SNAPPY = 0x03,
33
ZSTD = 0x04,
34
UNKNOWN
= 0xff
35
};
36
37
const
char
*
SWC_CONST_FUNC
to_string
(
Type
typ) noexcept;
38
39
Type
SWC_PURE_FUNC
encoding_from
(
const
std::string& typ) noexcept;
40
41
SWC_CAN_INLINE
42
std::string
repr_encoding
(
int
typ) {
43
return
Encoder::to_string
(
Encoder::Type
(typ));
44
}
45
46
SWC_CAN_INLINE
47
int
from_string_encoding
(
const
std::string& typ) noexcept {
48
return
int(
Encoder::encoding_from
(typ));
49
}
50
51
52
53
void
decode
(
int
& err,
Type
encoder
,
54
const
uint8_t* src,
size_t
sz_enc,
55
uint8_t *dst,
size_t
sz);
56
57
void
encode
(
int
& err,
Type
encoder
,
58
const
uint8_t* src,
size_t
src_sz,
59
size_t
* sz_enc,
DynamicBuffer
& output,
60
uint32_t reserve,
61
bool
no_plain_out=
false
,
bool
ok_more=
false
);
62
63
64
65
}}}
// namespace SWC::Core::Encoder
66
67
68
#ifdef SWC_IMPL_SOURCE
69
#include "
swcdb/core/Encoder.cc
"
70
#endif
71
72
73
#endif // swcdb_core_Encoder_h
SWC::Core::Encoder::Type
Type
Definition:
Encoder.h:28
SWC::Core::Encoder::from_string_encoding
SWC_CAN_INLINE int from_string_encoding(const std::string &typ) noexcept
Definition:
Encoder.h:47
SWC::Core::Encoder::encoding_from
Type SWC_PURE_FUNC encoding_from(const std::string &typ) noexcept
Definition:
Encoder.cc:50
SWC::Core::Encoder::Type::DEFAULT
@ DEFAULT
encoder
Core::Encoder::Type encoder
Buffer Encoder.
Definition:
HeaderBufferInfo.h:50
SWC_CONST_FUNC
#define SWC_CONST_FUNC
Definition:
Compat.h:107
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition:
Compat.h:102
SWC::Core::Encoder::decode
void decode(int &err, Type encoder, const uint8_t *src, size_t sz_enc, uint8_t *dst, size_t sz)
Definition:
Encoder.cc:99
SWC
The SWC-DB C++ namespace 'SWC'.
Definition:
main.cc:12
SWC::Core::BufferDyn< StaticBuffer >
SWC_PURE_FUNC
#define SWC_PURE_FUNC
Definition:
Compat.h:108
Buffer.h
Encoder.cc
SWC::DB::Types::Encoder
Core::Encoder::Type Encoder
Definition:
Encoder.h:15
SWC::Core::Encoder::to_string
const char *SWC_CONST_FUNC to_string(Type typ) noexcept
Definition:
Encoder.cc:31
SWC::Core::Encoder::encode
void encode(int &err, Type encoder, const uint8_t *src, size_t src_sz, size_t *sz_enc, DynamicBuffer &output, uint32_t reserve, bool no_plain_out=false, bool ok_more=false)
Definition:
Encoder.cc:222
SWC::Core::Encoder::repr_encoding
SWC_CAN_INLINE std::string repr_encoding(int typ)
Definition:
Encoder.h:42
include
swcdb
core
Encoder.h
Generated on Sat Jun 3 2023 18:00:06 for SWC-DB by
1.8.20