SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Comparators.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_core_Comparators_h
8 #define swcdb_core_Comparators_h
9 
10 #include "swcdb/core/Compat.h"
11 #include <cmath>
12 #include <re2/re2.h>
13 
14 
15 namespace SWC {
16 
22 namespace Condition {
23 
24 const uint COMP_EXTENDED_VALUE = 0x01;
25 const uint COMP_EXTENDED_KEY = 0x02;
26 
27 enum Comp : uint8_t {
28  NONE = 0x00, // [ ] : -none (no comparison aplied)
29  PF = 0x01, // [ =^ ] : -pf [prefix] (starts-with)
30  GT = 0x02, // [ > ] : -gt (greater-than)
31  GE = 0x03, // [ >= ] : -ge (greater-equal)
32  EQ = 0x04, // [ = ] : -eq (equal)
33  LE = 0x05, // [ <= ] : -le (lower-equal)
34  LT = 0x06, // [ < ] : -lt (lower-than)
35  NE = 0x07, // [ != ] : -ne (not-equal)
36  RE = 0x08, // [ re ] : -re [r,regexp] (regular-expression)
37 
38  // (COMP_EXTENDED_VALUE) extended logic options: ge,le,gt,lt are LEXIC and with 'V' VOLUME
39  VGT = 0x09, // [ v> ] : -vgt (vol greater-than)
40  VGE = 0x0A, // [ v>= ] : -vge (vol greater-equal)
41  VLE = 0x0B, // [ v<= ] : -vle (vol lower-equal)
42  VLT = 0x0C, // [ v< ] : -vlt (vol lower-than)
43 
44  //
45  SBS = 0x0D, // [ %> ] : -subset [sbs] (subset)
46  SPS = 0x0E, // [ <% ] : -supset [sps] (superset)
47  POSBS = 0x0F, // [ ~> ] : -posubset [posbs] (eq/part ordered subset)
48  POSPS = 0x10, // [ <~ ] : -posupset [posps] (eq/part ordered superset)
49  FOSBS = 0x11, // [ -> ] : -fosubset [fosbs] (eq/full ordered subset)
50  FOSPS = 0x12, // [ <- ] : -fosupset [fosps] (eq/full ordered superset)
51  /* p1(spec) p2(data)
52  SUBSET:
53  int/double - (p2 <% p1) True is ((p1 mod p2) == 0)
54  domain object True is (p2[1,2,3] <% p1[6,3,2,1,9])
55  SUPSET:
56  int/double - (p2 %> p1) True is ((p2 mod p1) == 0)
57  domain object True is (p2[6,3,2,1,9] %> p1[1,2,3])
58 
59  // Partially Ordered (int/double not supported)
60  PO-SUBSET:
61  domain object True is (p2[1,2,3] '<~' p1[6,1,321,2,9,3,9])
62  PO-SUPSET:
63  domain object True is (p2[6,1,321,2,9,3,9] '~>' p1[1,2,3])
64 
65  // Fully Ordered (double not supported)
66  FO-SUBSET:
67  int - (p2 <- p1) True is ((p1 OR p2) == p1)
68  domain object True is (p2[1,2,3] '<-' p1[6,1,2,3,9])
69  FO-SUPSET:
70  int - (p2 -> p1) True is ((p2 OR p1) == p2)
71  domain object True is (p2[6,1,2,3,9] '->' p1[1,2,3])
72  */
73 
74  // COMP_EXTENDED_KEY () extended key
75  FIP = 0x13, // [ :< ] : -fip (fraction include prior)
76  FI = 0x14, // [ : ] : -fi (fraction include)
77 
78 };
79 
80 
81 
82 const char COMP_NONE[] = "none";
83 const char COMP_PF[] = "=^";
84 const char COMP_GT[] = ">";
85 const char COMP_GE[] = ">=";
86 const char COMP_EQ[] = "==";
87 const char COMP_LE[] = "<=";
88 const char COMP_LT[] = "<";
89 const char COMP_NE[] = "!=";
90 const char COMP_RE[] = "re";
91 const char COMP_VGT[] = "v>";
92 const char COMP_VGE[] = "v>=";
93 const char COMP_VLE[] = "v<=";
94 const char COMP_VLT[] = "v<";
95 const char COMP_SBS[] = "%>";
96 const char COMP_SPS[] = "<%";
97 const char COMP_POSBS[] = "~>";
98 const char COMP_POSPS[] = "<~";
99 const char COMP_FOSBS[] = "->";
100 const char COMP_FOSPS[] = "<-";
101 const char COMP_FIP[] = ":<";
102 const char COMP_FI[] = ":";
103 
104 
105 
106 Comp from(const char** buf, uint32_t* remainp, uint8_t extended=0x00) noexcept;
107 
108 const char* SWC_CONST_FUNC to_string(Comp comp) noexcept;
109 
110 extern SWC_CAN_INLINE
111 const char* to_string(uint8_t comp) {
112  return to_string(Comp(comp));
113 }
114 
115 
116 
117 
118 extern SWC_CAN_INLINE
119 Comp condition_lexic(const uint8_t *p1, uint32_t p1_len,
120  const uint8_t *p2, uint32_t p2_len) noexcept {
121  int diff = mem_cmp(p1, p2, p1_len < p2_len ? p1_len: p2_len);
122  return !diff
123  ? (p1_len == p2_len
124  ? Comp::EQ
125  : (p1_len < p2_len ? Comp::GT : Comp::LT)
126  )
127  : (diff < 0 ? Comp::GT : Comp::LT)
128  ;
129 }
130 
131 extern SWC_CAN_INLINE
132 Comp condition_volume(const uint8_t *p1, uint32_t p1_len,
133  const uint8_t *p2, uint32_t p2_len) noexcept {
134  int diff;
135  return (
136  p1_len < p2_len
137  ? Comp::GT
138  : (p1_len > p2_len
139  ? Comp::LT
140  : (!(diff = mem_cmp(p1, p2, p1_len))
141  ? Comp::EQ
142  : (diff < 0
143  ? Comp::GT
144  : Comp::LT
145  )
146  )
147  )
148  );
149 }
150 
151 
152 
153 extern SWC_CAN_INLINE
154 Comp condition(bool vol, const uint8_t *p1, uint32_t p1_len,
155  const uint8_t *p2, uint32_t p2_len) noexcept {
156  return (vol ? condition_volume : condition_lexic)
157  (p1, p1_len, p2, p2_len);
158 }
159 
160 extern SWC_CAN_INLINE
161 bool pf(const uint8_t *p1, uint32_t p1_len,
162  const uint8_t *p2, uint32_t p2_len) noexcept {
163  return p1_len <= p2_len && mem_eq(p1, p2, p1_len);
164 }
165 
166 extern SWC_CAN_INLINE
167 bool gt_lexic(const uint8_t *p1, uint32_t p1_len,
168  const uint8_t *p2, uint32_t p2_len) noexcept {
169  int diff = mem_cmp(p1, p2, p1_len < p2_len? p1_len: p2_len);
170  return diff < 0 || (!diff && p1_len < p2_len);
171 }
172 
173 extern SWC_CAN_INLINE
174 bool gt_volume(const uint8_t *p1, uint32_t p1_len,
175  const uint8_t *p2, uint32_t p2_len) noexcept{
176  return p1_len < p2_len ||
177  (p1_len == p2_len && mem_cmp(p1, p2, p2_len) < 0);
178 }
179 
180 extern SWC_CAN_INLINE
181 bool ge_lexic(const uint8_t *p1, uint32_t p1_len,
182  const uint8_t *p2, uint32_t p2_len) noexcept {
183  int diff = mem_cmp(p1, p2, p1_len < p2_len? p1_len: p2_len);
184  return diff < 0 || (!diff && p1_len <= p2_len);
185 }
186 
187 extern SWC_CAN_INLINE
188 bool ge_volume(const uint8_t *p1, uint32_t p1_len,
189  const uint8_t *p2, uint32_t p2_len) noexcept {
190  return p1_len < p2_len ||
191  (p1_len == p2_len && mem_cmp(p1, p2, p2_len) <= 0);
192 }
193 
194 extern SWC_CAN_INLINE
195 bool eq(const uint8_t *p1, uint32_t p1_len,
196  const uint8_t *p2, uint32_t p2_len) noexcept {
197  return p1_len == p2_len && mem_eq(p1, p2, p1_len);
198 }
199 
200 extern SWC_CAN_INLINE
201 bool le_lexic(const uint8_t *p1, uint32_t p1_len,
202  const uint8_t *p2, uint32_t p2_len) noexcept {
203  int diff = mem_cmp(p1, p2, p1_len < p2_len? p1_len: p2_len);
204  return diff > 0 || (!diff && p1_len >= p2_len);
205 }
206 
207 extern SWC_CAN_INLINE
208 bool le_volume(const uint8_t *p1, uint32_t p1_len,
209  const uint8_t *p2, uint32_t p2_len) noexcept {
210  return p1_len > p2_len ||
211  (p1_len == p2_len && mem_cmp(p1, p2, p1_len) >= 0);
212 }
213 
214 extern SWC_CAN_INLINE
215 bool lt_lexic(const uint8_t *p1, uint32_t p1_len,
216  const uint8_t *p2, uint32_t p2_len) noexcept {
217  int diff = mem_cmp(p1, p2, p1_len < p2_len? p1_len: p2_len);
218  return diff > 0 || (!diff && p1_len > p2_len);
219 }
220 
221 extern SWC_CAN_INLINE
222 bool lt_volume(const uint8_t *p1, uint32_t p1_len,
223  const uint8_t *p2, uint32_t p2_len) noexcept {
224  return p1_len > p2_len ||
225  (p1_len == p2_len && mem_cmp(p1, p2, p1_len) > 0);
226 }
227 
228 extern SWC_CAN_INLINE
229 bool ne(const uint8_t* p1, uint32_t p1_len,
230  const uint8_t* p2, uint32_t p2_len) noexcept {
231  return !eq(p1, p1_len, p2, p2_len);
232 }
233 
234 
235 bool re(const re2::RE2& regex, const re2::StringPiece& value);
236 
237 extern SWC_CAN_INLINE
238 bool re(const re2::RE2& regex, const char* v, uint32_t v_len) {
239  return v && v_len && re(regex, re2::StringPiece(v, v_len));
240 }
241 
242 extern SWC_CAN_INLINE
243 bool re(const uint8_t* p1, uint32_t p1_len,
244  const uint8_t* p2, uint32_t p2_len) {
245  if(!p1 || !p1_len)
246  return !p2 || !p2_len;
247  return re(
248  re2::RE2(re2::StringPiece(reinterpret_cast<const char*>(p1), p1_len)),
249  reinterpret_cast<const char*>(p2), p2_len
250  );
251 }
252 
253 extern SWC_CAN_INLINE
254 bool sbs(const uint8_t* p1, uint32_t p1_len,
255  const uint8_t* p2, uint32_t p2_len) noexcept {
256  if(!p1_len)
257  return true;
258  if(p1_len > p2_len)
259  return false;
260  Core::Vector<bool> found(p1_len, false);
261  for(uint32_t count = p1_len; p2_len; ++p2, --p2_len) {
262  for(uint32_t i = 0; i < p1_len; ++i) {
263  if(!found[i] && p1[i] == *p2) {
264  if(!--count)
265  return true;
266  found[i] = true;
267  break;
268  }
269  }
270  }
271  return false;
272 }
273 
274 extern SWC_CAN_INLINE
275 bool SWC_PURE_FUNC po_sbs(const uint8_t* p1, uint32_t p1_len,
276  const uint8_t* p2, uint32_t p2_len) noexcept {
277  if(p1_len > p2_len)
278  return false;
279  const uint8_t* p1_end = p1 + p1_len;
280  const uint8_t* p2_end = p2 + p2_len;
281  for(; p1 < p1_end && p2 < p2_end; ++p2) {
282  if(*p1 == *p2)
283  ++p1;
284  }
285  return p1 == p1_end;
286 }
287 
288 extern SWC_CAN_INLINE
289 bool SWC_PURE_FUNC fo_sbs(const uint8_t* p1, uint32_t p1_len,
290  const uint8_t* p2, uint32_t p2_len) noexcept {
291  if(p1_len > p2_len)
292  return false;
293  bool start = false;
294  const uint8_t* p1_end = p1 + p1_len;
295  const uint8_t* p2_end = p2 + p2_len;
296  for(; p1 < p1_end && p2 < p2_end; ++p2) {
297  if(*p1 == *p2) {
298  start = true;
299  ++p1;
300  } else if(start) {
301  return false;
302  }
303  }
304  return p1 == p1_end;
305 }
306 
307 extern SWC_CAN_INLINE
308 bool is_matching_lexic(uint8_t comp,
309  const uint8_t* p1, uint32_t p1_len,
310  const uint8_t* p2, uint32_t p2_len) {
311  switch (comp) {
312 
313  case Comp::PF:
314  return pf(p1, p1_len, p2, p2_len);
315 
316  case Comp::GT:
317  return gt_lexic(p1, p1_len, p2, p2_len);
318 
319  case Comp::GE:
320  return ge_lexic(p1, p1_len, p2, p2_len);
321 
322  case Comp::EQ:
323  return eq(p1, p1_len, p2, p2_len);
324 
325  case Comp::LE:
326  return le_lexic(p1, p1_len, p2, p2_len);
327 
328  case Comp::LT:
329  return lt_lexic(p1, p1_len, p2, p2_len);
330 
331  case Comp::NE:
332  return ne(p1, p1_len, p2, p2_len);
333 
334  case Comp::RE:
335  return re(p1, p1_len, p2, p2_len);
336 
337  case Comp::SBS:
338  return sbs(p1, p1_len, p2, p2_len);
339 
340  case Comp::SPS:
341  return sbs(p2, p2_len, p1, p1_len);
342 
343  case Comp::POSBS:
344  return po_sbs(p1, p1_len, p2, p2_len);
345 
346  case Comp::POSPS:
347  return po_sbs(p2, p2_len, p1, p1_len);
348 
349  case Comp::FOSBS:
350  return fo_sbs(p1, p1_len, p2, p2_len);
351 
352  case Comp::FOSPS:
353  return fo_sbs(p2, p2_len, p1, p1_len);
354 
355  default:
356  return true;
357  }
358 }
359 
360 extern SWC_CAN_INLINE
361 bool is_matching_volume(uint8_t comp,
362  const uint8_t* p1, uint32_t p1_len,
363  const uint8_t* p2, uint32_t p2_len) {
364  switch (comp) {
365 
366  case Comp::PF:
367  return pf(p1, p1_len, p2, p2_len);
368 
369  case Comp::GT:
370  return gt_volume(p1, p1_len, p2, p2_len);
371 
372  case Comp::GE:
373  return ge_volume(p1, p1_len, p2, p2_len);
374 
375  case Comp::EQ:
376  return eq(p1, p1_len, p2, p2_len);
377 
378  case Comp::LE:
379  return le_volume(p1, p1_len, p2, p2_len);
380 
381  case Comp::LT:
382  return lt_volume(p1, p1_len, p2, p2_len);
383 
384  case Comp::NE:
385  return ne(p1, p1_len, p2, p2_len);
386 
387  case Comp::RE:
388  return re(p1, p1_len, p2, p2_len);
389 
390  case Comp::SBS:
391  return sbs(p1, p1_len, p2, p2_len);
392 
393  case Comp::SPS:
394  return sbs(p2, p2_len, p1, p1_len);
395 
396  case Comp::POSBS:
397  return po_sbs(p1, p1_len, p2, p2_len);
398 
399  case Comp::POSPS:
400  return po_sbs(p2, p2_len, p1, p1_len);
401 
402  case Comp::FOSBS:
403  return fo_sbs(p1, p1_len, p2, p2_len);
404 
405  case Comp::FOSPS:
406  return fo_sbs(p2, p2_len, p1, p1_len);
407 
408 
409  default:
410  return true;
411  }
412 }
413 
414 
415 extern SWC_CAN_INLINE
416 bool is_matching_lexic(uint8_t comp,
417  const char *p1, uint32_t p1_len,
418  const char *p2, uint32_t p2_len) {
419  return is_matching_lexic(
420  comp,
421  reinterpret_cast<const uint8_t*>(p1), p1_len,
422  reinterpret_cast<const uint8_t*>(p2), p2_len
423  );
424 }
425 
426 extern SWC_CAN_INLINE
427 bool is_matching_volume(uint8_t comp,
428  const char *p1, uint32_t p1_len,
429  const char *p2, uint32_t p2_len) {
430  return is_matching_volume(
431  comp,
432  reinterpret_cast<const uint8_t*>(p1), p1_len,
433  reinterpret_cast<const uint8_t*>(p2), p2_len
434  );
435 }
436 
437 
438 extern SWC_CAN_INLINE
439 bool is_matching(bool volumetric, uint8_t comp,
440  const uint8_t *p1, uint32_t p1_len,
441  const uint8_t *p2, uint32_t p2_len) {
442  return volumetric
443  ? is_matching_volume(comp, p1, p1_len, p2, p2_len)
444  : is_matching_lexic(comp, p1, p1_len, p2, p2_len);
445 }
446 
447 extern SWC_CAN_INLINE
448 bool is_matching(bool volumetric, uint8_t comp,
449  const char *p1, uint32_t p1_len,
450  const char *p2, uint32_t p2_len) {
451  return is_matching(
452  volumetric, comp,
453  reinterpret_cast<const uint8_t*>(p1), p1_len,
454  reinterpret_cast<const uint8_t*>(p2), p2_len
455  );
456 }
457 
458 extern SWC_CAN_INLINE
459 bool is_matching_extended(uint8_t comp,
460  const uint8_t *p1, uint32_t p1_len,
461  const uint8_t *p2, uint32_t p2_len) {
462  switch (comp) {
463 
464  case Comp::PF:
465  return pf(p1, p1_len, p2, p2_len);
466 
467  case Comp::GT:
468  return gt_lexic(p1, p1_len, p2, p2_len);
469 
470  case Comp::GE:
471  return ge_lexic(p1, p1_len, p2, p2_len);
472 
473  case Comp::EQ:
474  return eq(p1, p1_len, p2, p2_len);
475 
476  case Comp::LE:
477  return le_lexic(p1, p1_len, p2, p2_len);
478 
479  case Comp::LT:
480  return lt_lexic(p1, p1_len, p2, p2_len);
481 
482  case Comp::NE:
483  return ne(p1, p1_len, p2, p2_len);
484 
485  case Comp::RE:
486  return re(p1, p1_len, p2, p2_len);
487 
488  case Comp::SBS:
489  return sbs(p1, p1_len, p2, p2_len);
490 
491  case Comp::SPS:
492  return sbs(p2, p2_len, p1, p1_len);
493 
494  case Comp::POSBS:
495  return po_sbs(p1, p1_len, p2, p2_len);
496 
497  case Comp::POSPS:
498  return po_sbs(p2, p2_len, p1, p1_len);
499 
500  case Comp::FOSBS:
501  return fo_sbs(p1, p1_len, p2, p2_len);
502 
503  case Comp::FOSPS:
504  return fo_sbs(p2, p2_len, p1, p1_len);
505 
506  case Comp::VGT:
507  return gt_volume(p1, p1_len, p2, p2_len);
508 
509  case Comp::VGE:
510  return ge_volume(p1, p1_len, p2, p2_len);
511 
512  case Comp::VLE:
513  return le_volume(p1, p1_len, p2, p2_len);
514 
515  case Comp::VLT:
516  return lt_volume(p1, p1_len, p2, p2_len);
517 
518  default:
519  return true;
520  }
521 }
522 
523 
524 // const T
525 
526 template<typename T>
527 extern constexpr SWC_CAN_INLINE
528 bool gt(const T p1, const T p2) noexcept {
529  return p1 < p2;
530 }
531 
532 template<typename T>
533 extern constexpr SWC_CAN_INLINE
534 bool ge(const T p1, const T p2) noexcept {
535  return p1 <= p2;
536 }
537 
538 template<typename T>
539 extern constexpr SWC_CAN_INLINE
540 bool eq(const T p1, const T p2) noexcept {
541  return p1 == p2;
542 }
543 
544 template<typename T>
545 extern constexpr SWC_CAN_INLINE
546 bool le(const T p1, const T p2) noexcept {
547  return p1 >= p2;
548 }
549 
550 template<typename T>
551 extern constexpr SWC_CAN_INLINE
552 bool lt(const T p1, const T p2) noexcept {
553  return p1 > p2;
554 }
555 
556 template<typename T>
557 extern constexpr SWC_CAN_INLINE
558 bool ne(const T p1, const T p2) noexcept {
559  return p1 != p2;
560 }
561 
562 template<typename T>
563 extern constexpr SWC_CAN_INLINE
564 bool sbs(const T p1, const T p2) noexcept {
565  return !p1 || (p2 % p1) == 0;
566 }
567 
568 template<>
570 bool sbs(const long double p1, const long double p2) noexcept {
571  return !p1 || fmod(p2, p1) == 0;
572 }
573 
574 template<typename T>
575 extern constexpr SWC_CAN_INLINE
576 bool fo_sbs(const T p1, const T p2) noexcept {
577  return (p2 | p1) == p2;
578 }
579 
580 template<>
581 constexpr SWC_CAN_INLINE
582 bool fo_sbs(const long double, const long double) noexcept {
583  /* Not Implemented ?
584  if(((uint64_t)p2 | (uint64_t)p1) != (uint64_t)p2)
585  return false;
586  auto t1 = p1;
587  auto t2 = p2;
588  for(;;t1 *= 10, t2 *= 10) {
589  if(!fmod(t1, 10.0) && !fmod(t2, 10.0))
590  return ((uint64_t)t2 | (uint64_t)t1) == (uint64_t)t2;
591  }
592  */
593  return false;
594 }
595 
596 template<typename T>
597 extern SWC_CAN_INLINE
598 bool is_matching(uint8_t comp, const T p1, const T p2) noexcept {
599  switch (comp) {
600 
601  case Comp::GT:
602  return gt(p1, p2);
603 
604  case Comp::GE:
605  return ge(p1, p2);
606 
607  case Comp::EQ:
608  return eq(p1, p2);
609 
610  case Comp::LE:
611  return le(p1, p2);
612 
613  case Comp::LT:
614  return lt(p1, p2);
615 
616  case Comp::NE:
617  return ne(p1, p2);
618 
619  case Comp::SBS:
620  return sbs(p1, p2);
621 
622  case Comp::SPS:
623  return sbs(p2, p1);
624 
625  case Comp::FOSBS:
626  return fo_sbs(p1, p2);
627 
628  case Comp::FOSPS:
629  return fo_sbs(p2, p1);
630 
631  default:
632  return true;
633  }
634 }
635 
636 
637 
638 } } // namespace SWC::Condition
639 
640 
641 #ifdef SWC_IMPL_SOURCE
642 #include "swcdb/core/Comparators.cc"
643 #endif
644 
645 
646 #endif // swcdb_core_Comparators_h
SWC::Condition::LE
@ LE
Definition: Comparators.h:33
SWC::Condition::POSPS
@ POSPS
Definition: Comparators.h:48
SWC::Condition::FOSPS
@ FOSPS
Definition: Comparators.h:50
SWC::Condition::is_matching_extended
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)
Definition: Comparators.h:459
SWC::Condition::mem_eq
bool mem_eq(const uint8_t *b1, const uint8_t *b2, size_t count) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: Comparators_basic.h:207
SWC::Condition::GE
@ GE
Definition: Comparators.h:31
SWC::Condition::COMP_FOSPS
const char COMP_FOSPS[]
Definition: Comparators.h:100
SWC::Condition::COMP_VLT
const char COMP_VLT[]
Definition: Comparators.h:94
SWC::Condition::le
constexpr SWC_CAN_INLINE bool le(const T p1, const T p2) noexcept
Definition: Comparators.h:546
SWC::Condition::COMP_RE
const char COMP_RE[]
Definition: Comparators.h:90
SWC::Condition::le_volume
SWC_CAN_INLINE bool le_volume(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:208
SWC::Condition::COMP_NE
const char COMP_NE[]
Definition: Comparators.h:89
SWC::Condition::GT
@ GT
Definition: Comparators.h:30
SWC::Condition::lt_volume
SWC_CAN_INLINE bool lt_volume(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:222
SWC::Condition::COMP_EXTENDED_VALUE
const uint COMP_EXTENDED_VALUE
Definition: Comparators.h:24
SWC::Condition::condition_volume
SWC_CAN_INLINE Comp condition_volume(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:132
SWC::Condition::LT
@ LT
Definition: Comparators.h:34
SWC::Condition::po_sbs
SWC_CAN_INLINE bool SWC_PURE_FUNC po_sbs(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:275
SWC::Condition::COMP_EXTENDED_KEY
const uint COMP_EXTENDED_KEY
Definition: Comparators.h:25
SWC::Condition::sbs
SWC_CAN_INLINE bool sbs(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:254
SWC::Condition::RE
@ RE
Definition: Comparators.h:36
SWC::Condition::ge_volume
SWC_CAN_INLINE bool ge_volume(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:188
SWC::Condition::eq
SWC_CAN_INLINE bool eq(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:195
SWC::Condition::VGT
@ VGT
Definition: Comparators.h:39
SWC::Condition::VGE
@ VGE
Definition: Comparators.h:40
SWC::Condition::COMP_GT
const char COMP_GT[]
Definition: Comparators.h:84
SWC::Condition::gt_volume
SWC_CAN_INLINE bool gt_volume(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:174
SWC::Condition::COMP_NONE
const char COMP_NONE[]
Definition: Comparators.h:82
SWC::Condition::pf
SWC_CAN_INLINE bool pf(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:161
SWC::Condition::is_matching_volume
SWC_CAN_INLINE bool is_matching_volume(uint8_t comp, const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len)
Definition: Comparators.h:361
SWC::Condition::gt_lexic
SWC_CAN_INLINE bool gt_lexic(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:167
SWC_CONST_FUNC
#define SWC_CONST_FUNC
Definition: Compat.h:107
SWC::Condition::Comp
Comp
Definition: Comparators.h:27
SWC::Condition::mem_cmp
int mem_cmp(const uint8_t *b1, const uint8_t *b2, size_t count) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: Comparators_basic.h:197
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::Condition::FIP
@ FIP
Definition: Comparators.h:75
SWC::Condition::COMP_POSBS
const char COMP_POSBS[]
Definition: Comparators.h:97
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Condition::COMP_GE
const char COMP_GE[]
Definition: Comparators.h:85
SWC_PURE_FUNC
#define SWC_PURE_FUNC
Definition: Compat.h:108
Compat.h
SWC::Condition::EQ
@ EQ
Definition: Comparators.h:32
SWC::Condition::ge_lexic
SWC_CAN_INLINE bool ge_lexic(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:181
SWC::Condition::COMP_FI
const char COMP_FI[]
Definition: Comparators.h:102
SWC::Condition::COMP_VLE
const char COMP_VLE[]
Definition: Comparators.h:93
SWC::Condition::NE
@ NE
Definition: Comparators.h:35
SWC::Condition::COMP_POSPS
const char COMP_POSPS[]
Definition: Comparators.h:98
SWC::Condition::lt
constexpr SWC_CAN_INLINE bool lt(const T p1, const T p2) noexcept
Definition: Comparators.h:552
SWC::Condition::PF
@ PF
Definition: Comparators.h:29
SWC::Condition::ne
SWC_CAN_INLINE bool ne(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:229
SWC::Condition::COMP_SBS
const char COMP_SBS[]
Definition: Comparators.h:95
SWC::Condition::COMP_PF
const char COMP_PF[]
Definition: Comparators.h:83
SWC::Condition::COMP_EQ
const char COMP_EQ[]
Definition: Comparators.h:86
SWC::Condition::le_lexic
SWC_CAN_INLINE bool le_lexic(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:201
SWC::Condition::is_matching
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)
Definition: Comparators.h:439
SWC::Condition::NONE
@ NONE
Definition: Comparators.h:28
SWC::Condition::re
bool re(const re2::RE2 &regex, const re2::StringPiece &value)
Definition: Comparators.cc:225
SWC::Condition::SPS
@ SPS
Definition: Comparators.h:46
SWC::Condition::condition_lexic
SWC_CAN_INLINE Comp condition_lexic(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:119
SWC::Condition::POSBS
@ POSBS
Definition: Comparators.h:47
SWC::Core::Vector< bool >
SWC::Condition::from
Comp from(const char **buf, uint32_t *remainp, uint8_t extended=0x00) noexcept
Definition: Comparators.cc:15
SWC::Condition::is_matching_lexic
SWC_CAN_INLINE bool is_matching_lexic(uint8_t comp, const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len)
Definition: Comparators.h:308
SWC::Config::T
const uint64_t T
Definition: Property.h:27
Comparators.cc
SWC::Condition::to_string
const char *SWC_CONST_FUNC to_string(Comp comp) noexcept
Definition: Comparators.cc:174
SWC::Condition::VLT
@ VLT
Definition: Comparators.h:42
SWC::Condition::FI
@ FI
Definition: Comparators.h:76
SWC::Condition::SBS
@ SBS
Definition: Comparators.h:45
SWC::Condition::COMP_FOSBS
const char COMP_FOSBS[]
Definition: Comparators.h:99
SWC::Condition::condition
SWC_CAN_INLINE Comp condition(bool vol, const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:154
SWC::Condition::COMP_SPS
const char COMP_SPS[]
Definition: Comparators.h:96
SWC::Condition::FOSBS
@ FOSBS
Definition: Comparators.h:49
SWC::Condition::COMP_VGT
const char COMP_VGT[]
Definition: Comparators.h:91
SWC::Condition::COMP_VGE
const char COMP_VGE[]
Definition: Comparators.h:92
SWC::Condition::COMP_LE
const char COMP_LE[]
Definition: Comparators.h:87
SWC::Condition::COMP_LT
const char COMP_LT[]
Definition: Comparators.h:88
SWC::Condition::gt
constexpr SWC_CAN_INLINE bool gt(const T p1, const T p2) noexcept
Definition: Comparators.h:528
SWC::Condition::lt_lexic
SWC_CAN_INLINE bool lt_lexic(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:215
SWC::Condition::COMP_FIP
const char COMP_FIP[]
Definition: Comparators.h:101
SWC::Condition::VLE
@ VLE
Definition: Comparators.h:41
SWC::Condition::fo_sbs
SWC_CAN_INLINE bool SWC_PURE_FUNC fo_sbs(const uint8_t *p1, uint32_t p1_len, const uint8_t *p2, uint32_t p2_len) noexcept
Definition: Comparators.h:289
SWC::Condition::ge
constexpr SWC_CAN_INLINE bool ge(const T p1, const T p2) noexcept
Definition: Comparators.h:534