 |
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_core_Buffer_h
8 #define swcdb_core_Buffer_h
14 namespace SWC {
namespace Core {
22 typedef std::shared_ptr<BufferT>
Ptr;
48 :
own(other.own),
size(other.size),
base(other.base) {
57 :
own(other.own),
size(other.size),
base(other.base) {
65 template<
typename OtherT>
111 own = take_ownership;
120 if((
own = other.own)) {
122 other.base =
nullptr;
126 template<
typename OtherT>
127 void set(OtherT& other) noexcept;
137 template<
typename BufferT>
141 typedef std::shared_ptr<BufferDyn>
Ptr;
146 :
ptr(
nullptr),
mark(
nullptr) {
157 other.ptr = other.mark =
nullptr;
182 BufferT::base =
ptr =
mark =
nullptr;
193 return ptr - BufferT::base;
198 return ptr == BufferT::base;
220 size_t ptr_offset =
ptr - BufferT::base;
228 memcpy(BufferT::base, base_old, size_old);
233 mark = BufferT::base + (
mark - base_old);
234 ptr = BufferT::base + ptr_offset;
274 BufferT::own = other.own;
277 BufferT::base = other.base;
280 other.base = other.ptr = other.mark =
nullptr;
285 BufferT::own = other.own;
287 BufferT::base =
ptr =
mark = other.base;
289 other.base =
nullptr;
308 : own(other.own),
size(other.fill()), base(other.base) {
312 other.base = other.ptr = other.mark =
nullptr;
323 if((own = other.own)) {
326 other.base = other.ptr = other.mark =
nullptr;
350 #endif // swcdb_core_Buffer_h
constexpr SWC_CAN_INLINE Buffer(BufferT &&other) noexcept
void set(const value_type *data, size_t len)
virtual SWC_CAN_INLINE ~Buffer() noexcept
SWC_CAN_INLINE void reallocate(size_t len)
value_type * add(const value_type *data, size_t len)
constexpr SWC_CAN_INLINE Buffer() noexcept
constexpr SWC_CAN_INLINE Buffer(value_type *data, size_t sz, bool take_ownership) noexcept
BufferDyn< StaticBuffer > DynamicBuffer
Buffer & operator=(const Buffer &)=delete
SWC_CAN_INLINE void ensure(size_t len)
typename BufferT::value_type value_type
SWC_CAN_INLINE Buffer(size_t sz)
SWC_CAN_INLINE void _free() noexcept
BufferDyn(const BufferDyn &)=delete
constexpr Buffer(OtherT &other) noexcept
void take_ownership(BufferT &other) noexcept
SWC_CAN_INLINE value_type * add_unchecked(const value_type *data, size_t len) noexcept
static SWC_CAN_INLINE value_type * allocate(size_t sz)
constexpr SWC_CAN_INLINE Buffer(BufferT &other) noexcept
constexpr SWC_CAN_INLINE void clear() noexcept
void set(OtherT &other) noexcept
constexpr SWC_CAN_INLINE BufferDyn(size_t sz)
Buffer & operator=(Buffer &&)=delete
The SWC-DB C++ namespace 'SWC'.
constexpr SWC_CAN_INLINE void set_mark() noexcept
void add(const value_type data)
SWC_CAN_INLINE value_type * add(const std::string &data)
SWC_CAN_INLINE void free() noexcept
SWC_CAN_INLINE void free()
BufferDyn & operator=(const BufferDyn &)=delete
void set(BufferT &other) noexcept
Buffer< uint8_t > StaticBuffer
Buffer< value_type > BufferT
void take_ownership(BufferDyn< BufferT > &other) noexcept
constexpr SWC_CAN_INLINE size_t fill() const noexcept
BufferDyn & operator=(BufferDyn &&)=delete
#define SWC_EXPECT(_e_, _code_)
constexpr SWC_CAN_INLINE BufferDyn(BufferDyn &&other) noexcept
constexpr SWC_CAN_INLINE bool empty() const noexcept
constexpr value_type * release(size_t *lenp) noexcept
std::shared_ptr< BufferT > Ptr
std::shared_ptr< BufferDyn > Ptr
constexpr SWC_CAN_INLINE size_t remaining() const noexcept
constexpr SWC_CAN_INLINE BufferDyn() 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