SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
SpecsValues.cc
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 
9 
10 
11 namespace SWC { namespace DB { namespace Specs {
12 
13 
14 
15 Values::Values(const Values& other)
16  : Vec(other), col_type(other.col_type) {
17 }
18 
19 void Values::copy(const Values& other) {
20  Vec::operator=(other);
21  col_type = other.col_type;
22 }
23 
25  return emplace_back(true, comp);
26 }
27 
28 Value& Values::add(Value&& other) {
29  return emplace_back(std::move(other));
30 }
31 
32 bool Values::equal(const Values& other) const noexcept {
33  if(col_type == other.col_type && size() == other.size()) {
34  auto it = cbegin();
35  for(auto it2 = other.cbegin(); it != cend(); ++it, ++it2)
36  if(!it->equal(*it2))
37  return false;
38  }
39  return true;
40 }
41 
42 void Values::print(std::ostream& out) const {
43  out << "Values(";
44  if(!empty()) {
45  out << "size=" << size() << " [";
46  for(const auto& value : *this) {
47  value.print(col_type, out);
48  out << ", ";
49  }
50  out << ']';
51  }
52  out << ')';
53 }
54 
55 void Values::display(std::ostream& out, bool pretty,
56  const std::string& offset) const {
57  out << offset << "Values([\n";
58  for(const auto& value : *this) {
59  value.display(col_type, out << offset << " Value(", pretty);
60  out << ")\n";
61  }
62  out << offset << "])\n";
63 }
64 
65 
66 }}}
SWC::Core::Vector< Value >::operator=
SWC_CAN_INLINE Vector & operator=(Vector &&other) noexcept
Definition: Vector.h:141
SWC::DB::Specs::Values::print
void print(std::ostream &out) const
Definition: SpecsValues.cc:42
SWC::DB::Specs::Values::display
void display(std::ostream &out, bool pretty, const std::string &offset) const
Definition: SpecsValues.cc:55
SWC::DB::Specs::Values::equal
bool SWC_PURE_FUNC equal(const Values &other) const noexcept
Definition: SpecsValues.cc:32
SWC::DB::Specs::Values::copy
void copy(const Values &other)
Definition: SpecsValues.cc:19
SWC::Condition::Comp
Comp
Definition: Comparators.h:27
SWC::Core::Vector< Value >::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
size
uint32_t size
Buffer size.
Definition: HeaderBufferInfo.h:47
Serialization.h
SWC::DB::Specs::Value
Definition: SpecsValue.h:17
SWC::Core::Vector< Value >
SWC::DB::Specs::Values::add
Value & add(Condition::Comp comp=Condition::EQ)
Definition: SpecsValues.cc:24
SpecsValues.h
SWC::DB::Specs::Values::col_type
Types::Column col_type
Definition: SpecsValues.h:26
SWC::DB::Specs::Values
Definition: SpecsValues.h:17
SWC::Core::Vector< Value >::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Core::Vector< Value >::emplace_back
SWC_CAN_INLINE reference emplace_back(ArgsT &&... args)
Definition: Vector.h:349
SWC::DB::Specs::Values::Values
SWC_CAN_INLINE Values(Types::Column a_col_type=Types::Column::UNKNOWN) noexcept
Definition: SpecsValues.h:29