SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SpecsScan.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 
7 #ifndef swcdb_db_cells_SpecsScan_h
8 #define swcdb_db_cells_SpecsScan_h
9 
10 
12 
13 
14 namespace SWC { namespace DB {
15 
16 
18 namespace Specs {
19 
20 
21 class Scan final {
22  public:
23 
25 
27  explicit Scan() noexcept : columns(), flags() { }
28 
30  explicit Scan(uint32_t reserve) : columns(), flags() {
31  columns.reserve(reserve);
32  }
33 
35  explicit Scan(const Scan& other)
36  : columns(other.columns), flags(other.flags) {
37  }
38 
40  explicit Scan(Scan&& other) noexcept
41  : columns(std::move(other.columns)), flags(other.flags) {
42  }
43 
45  explicit Scan(const Columns& a_columns) : columns(a_columns), flags() { }
46 
48  explicit Scan(Columns&& a_columns) noexcept
49  : columns(std::move(a_columns)), flags() { }
50 
52  explicit Scan(const uint8_t** bufp, size_t* remainp) : columns(), flags() {
53  decode(bufp, remainp);
54  }
55 
56  ~Scan() noexcept { }
57 
59  Scan& operator=(Scan&& other) noexcept {
60  columns = std::move(other.columns);
61  flags.copy(other.flags);
62  return *this;
63  }
64 
66  Scan& operator=(const Scan& other) {
67  columns = other.columns;
68  flags.copy(other.flags);
69  return *this;
70  }
71 
73  void free() noexcept {
74  columns.clear();
75  }
76 
77  bool SWC_PURE_FUNC equal(const Scan &other) const noexcept;
78 
79  size_t SWC_PURE_FUNC encoded_length() const noexcept;
80 
81  void encode(uint8_t** bufp) const;
82 
83  void decode(const uint8_t** bufp, size_t* remainp);
84 
86  std::string to_string() const {
87  std::string s;
88  {
89  std::stringstream ss;
90  print(ss);
91  s = ss.str();
92  }
93  return s;
94  }
95 
96  void print(std::ostream& out) const;
97 
98  void display(std::ostream& out, bool pretty=true,
99  std::string offset = "") const;
100 
103 
104 };
105 
106 }}}
107 
108 
109 #ifdef SWC_IMPL_SOURCE
111 #endif
112 
113 #endif // swcdb_db_cells_SpecsScan_h
SWC::DB::Specs::Scan::operator=
SWC_CAN_INLINE Scan & operator=(const Scan &other)
Definition: SpecsScan.h:66
SWC::DB::Specs::Scan
Definition: SpecsScan.h:21
SWC::DB::Specs::Scan::encode
void encode(uint8_t **bufp) const
Definition: SpecsScan.cc:32
SpecsScan.cc
SWC::DB::Specs::Scan::operator=
SWC_CAN_INLINE Scan & operator=(Scan &&other) noexcept
Definition: SpecsScan.h:59
SWC::Core::Vector::clear
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
Definition: Vector.h:120
SWC::DB::Specs::Scan::to_string
SWC_CAN_INLINE std::string to_string() const
Definition: SpecsScan.h:86
SWC::DB::Specs::Scan::print
void print(std::ostream &out) const
Definition: SpecsScan.cc:48
SWC::DB::Specs::Scan::equal
bool SWC_PURE_FUNC equal(const Scan &other) const noexcept
Definition: SpecsScan.cc:14
SpecsColumn.h
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan(Scan &&other) noexcept
Definition: SpecsScan.h:40
SWC::DB::Specs::Scan::encoded_length
size_t SWC_PURE_FUNC encoded_length() const noexcept
Definition: SpecsScan.cc:25
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan(const uint8_t **bufp, size_t *remainp)
Definition: SpecsScan.h:52
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan(uint32_t reserve)
Definition: SpecsScan.h:30
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::DB::Specs::Scan::columns
Columns columns
Definition: SpecsScan.h:101
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::DB::Specs::Scan::~Scan
~Scan() noexcept
Definition: SpecsScan.h:56
SWC::DB::Specs::Scan::free
SWC_CAN_INLINE void free() noexcept
Definition: SpecsScan.h:73
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan() noexcept
Definition: SpecsScan.h:27
SWC_PURE_FUNC
#define SWC_PURE_FUNC
Definition: Compat.h:108
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan(const Scan &other)
Definition: SpecsScan.h:35
SWC::DB::Specs::Scan::decode
void decode(const uint8_t **bufp, size_t *remainp)
Definition: SpecsScan.cc:39
SWC::DB::Specs::Flags::copy
constexpr SWC_CAN_INLINE void copy(const Flags &other) noexcept
Definition: SpecsFlags.h:53
SWC::DB::Specs::Flags
Definition: SpecsFlags.h:18
SWC::Core::Vector< Column >
SWC::DB::Specs::Scan::Columns
Core::Vector< Column > Columns
Definition: SpecsScan.h:24
SWC::DB::Specs::Scan::flags
Flags flags
Definition: SpecsScan.h:102
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan(const Columns &a_columns)
Definition: SpecsScan.h:45
SWC::DB::Specs::Scan::Scan
SWC_CAN_INLINE Scan(Columns &&a_columns) noexcept
Definition: SpecsScan.h:48
SWC::DB::Specs::Scan::display
void display(std::ostream &out, bool pretty=true, std::string offset="") const
Definition: SpecsScan.cc:58
SWC::Core::Vector::reserve
SWC_CAN_INLINE void reserve(size_type cap)
Definition: Vector.h:288