SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
Property.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 
7 #include "swcdb/core/Exception.h"
9 
10 
11 namespace SWC { namespace Config { namespace Property {
12 
13 const char* Value::to_string(Type type) noexcept {
14  switch(type) {
15  case TYPE_BOOL:
16  return "TYPE_BOOL";
17  case TYPE_UINT8:
18  return "TYPE_UINT8";
19  case TYPE_UINT16:
20  return "TYPE_UINT16";
21  case TYPE_INT32:
22  return "TYPE_INT32";
23  case TYPE_INT64:
24  return "TYPE_INT64";
25  case TYPE_DOUBLE:
26  return "TYPE_DOUBLE";
27  case TYPE_STRING:
28  return "TYPE_STRING";
29  case TYPE_ENUM:
30  return "TYPE_ENUM";
31  case TYPE_STRINGS:
32  return "TYPE_STRINGS";
33  case TYPE_INT64S:
34  return "TYPE_INT64S";
35  case TYPE_DOUBLES:
36  return "TYPE_DOUBLES";
37  case TYPE_BOOL_G:
38  return "TYPE_BOOL_G";
39  case TYPE_UINT8_G:
40  return "TYPE_UINT8_G";
41  case TYPE_UINT16_G:
42  return "TYPE_UINT16_G";
43  case TYPE_INT32_G:
44  return "TYPE_INT32_G";
45  case TYPE_UINT64_G:
46  return "TYPE_UINT64_G";
47  case TYPE_ENUM_G:
48  return "TYPE_ENUM_G";
49  case TYPE_STRINGS_G:
50  return "TYPE_STRINGS_G";
51  default:
52  return "unknown";
53  }
54 }
55 
56 
59  t1 == t2,
60  "Value-Type mismatch expectation t1=%s == t2=%s",
61  to_string(t1), to_string(t2)
62  );
63 }
64 
65 Value::Value(uint8_t a_flags) noexcept : flags(a_flags) { }
66 
67 Value::Value(Value::Ptr ptr) noexcept : flags(ptr->flags.load()) { }
68 
69 Value::~Value() noexcept { }
70 
71 std::ostream& Value::operator<<(std::ostream& ostream) {
72  return ostream << to_string();
73 }
74 
75 bool Value::is_skippable() const noexcept {
76  return flags & Value::SKIPPABLE;
77 }
78 
79 bool Value::is_guarded() const noexcept {
80  return flags & Value::GUARDED;
81 }
82 
83 Value::Ptr Value::default_value(bool defaulted) noexcept {
84  defaulted
85  ? flags.fetch_xor(Value::DEFAULT)
86  : flags.fetch_and(Value::DEFAULT);
87  return this;
88 }
89 
90 bool Value::is_default() const noexcept {
91  return flags & Value::DEFAULT;
92 }
93 
96  return this;
97 }
98 
99 bool Value::is_zero_token() const noexcept {
100  return flags & Value::NO_TOKEN;
101 }
102 
103 
104 
109 void from_string(const char* s, double* value) {
110  char *last;
111  double res = strtod(s, &last);
112 
113  if (s == last)
114  SWC_THROWF(Error::CONFIG_GET_ERROR, "Bad Value %s", s);
115 
116  switch (*last) {
117  case 'k':
118  case 'K': res *= 1000LL; break;
119  case 'm':
120  case 'M': res *= 1000000LL; break;
121  case 'g':
122  case 'G': res *= 1000000000LL; break;
123  case '\0': break;
124  default:
126  "Bad Value %s unknown suffix %s", s, last);
127  }
128  *value = res;
129 }
130 
131 void from_string(const char* s, int64_t* value) {
132  char *last;
133  errno = 0;
134  *value = strtoll(s, &last, 0);
135 
136  if (s == last)
137  SWC_THROWF(Error::CONFIG_GET_ERROR, "Bad Value %s", s);
138 
139  if(errno)
141  "Bad Value %s, number out of range of 64-bit integer", s);
142 
143  switch (*last) {
144  case 'k':
145  case 'K': *value *= 1000LL; break;
146  case 'm':
147  case 'M': *value *= 1000000LL; break;
148  case 'g':
149  case 'G': *value *= 1000000000LL; break;
150  case '\0': break;
151  default:
153  "Bad Value %s unknown suffix %s", s, last);
154  }
155 }
156 
157 void from_string(const char* s, uint64_t* value) {
158  char *last;
159  errno = 0;
160  *value = strtoull(s, &last, 0);
161 
162  if (s == last)
163  SWC_THROWF(Error::CONFIG_GET_ERROR, "Bad Value %s", s);
164 
165  if(errno)
167  "Bad Value %s, number out of range of unsigned 64-bit integer", s);
168 
169  switch (*last) {
170  case 'k':
171  case 'K': *value *= 1000LL; break;
172  case 'm':
173  case 'M': *value *= 1000000LL; break;
174  case 'g':
175  case 'G': *value *= 1000000000LL; break;
176  case '\0': break;
177  default:
179  "Bad Value %s unknown suffix %s", s, last);
180  }
181 }
182 
183 void from_string(const char* s, uint8_t* value) {
184  int64_t res;
185  from_string(s, &res);
186 
187  if (res > UINT8_MAX || res < 0)
189  "Bad Value %s, number out of range of 8-bit unsigned integer", s);
190  *value = res;
191 }
192 
193 
194 void from_string(const char* s, uint16_t* value) {
195  int64_t res;
196  from_string(s, &res);
197 
198  if (res > UINT16_MAX || res < 0)
200  "Bad Value %s, number out of range of 16-bit unsigned integer", s);
201  *value = res;
202 }
203 
204 void from_string(const char* s, int32_t* value) {
205  int64_t res;
206  from_string(s, &res);
207 
208  if (res > INT32_MAX || res < INT32_MIN)
210  "Bad Value %s, number out of range of 32-bit integer", s);
211  *value = res;
212 }
213 
214 
215 
216 
217 
218 Value_bool::Value_bool(const bool& v, uint8_t a_flags) noexcept
219  : Value(a_flags), value(v) {
220 }
221 
222 Value_bool::Value_bool(Value_bool* ptr) noexcept : Value(ptr), value(ptr->get()) { }
223 
225 
227  auto ptr = new Value_bool(this);
228  if(!values.empty())
229  ptr->set_from(values);
230  return ptr;
231 }
232 
234  auto from = get_pointer<Value_bool>(ptr);
235  flags.store(from->flags);
236  value = from->value;
237 }
238 
239 void Value_bool::set_from(const Strings& values) {
240  auto& str = values.back();
241  value = (str.length() == 1 && *str.data() == '1') ||
242  Condition::str_case_eq(str.data(), "true", 4) ||
243  Condition::str_case_eq(str.data(), "yes", 3);
244 }
245 
246 Value::Type Value_bool::type() const noexcept {
247  return value_type;
248 }
249 
250 std::string Value_bool::to_string() const {
251  return value ? "true" : "false";
252 }
253 
254 
255 
256 Value_uint8::Value_uint8(const uint8_t& v, uint8_t a_flags) noexcept
257  : Value(a_flags), value(v) {
258 }
259 
260 Value_uint8::Value_uint8(Value_uint8* ptr) noexcept : Value(ptr), value(ptr->get()) { }
261 
263 
265  auto ptr = new Value_uint8(this);
266  if(!values.empty())
267  ptr->set_from(values);
268  return ptr;
269 }
270 
272  auto from = get_pointer<Value_uint8>(ptr);
273  flags.store(from->flags);
274  value = from->value;
275 }
276 
277 void Value_uint8::set_from(const Strings& values) {
278  from_string(values.back(), &value);
279 }
280 
281 Value::Type Value_uint8::type() const noexcept {
282  return value_type;
283 }
284 
285 std::string Value_uint8::to_string() const {
286  return std::to_string(int16_t(value));
287 }
288 
289 
290 
291 Value_uint16::Value_uint16(const uint16_t& v, uint8_t a_flags) noexcept
292  : Value(a_flags), value(v) { }
293 
294 Value_uint16::Value_uint16(Value_uint16* ptr) noexcept : Value(ptr), value(ptr->get()) { }
295 
297 
299  auto ptr = new Value_uint16(this);
300  if(!values.empty())
301  ptr->set_from(values);
302  return ptr;
303 }
304 
306  auto from = get_pointer<Value_uint16>(ptr);
307  flags.store(from->flags);
308  value = from->value;
309 }
310 
311 void Value_uint16::set_from(const Strings& values) {
312  from_string(values.back(), &value);
313 }
314 
315 Value::Type Value_uint16::type() const noexcept {
316  return value_type;
317 }
318 
319 std::string Value_uint16::to_string() const {
320  return std::to_string(value);
321 }
322 
323 
324 
325 Value_int32::Value_int32(const int32_t& v, uint8_t a_flags) noexcept
326  : Value(a_flags), value(v) { }
327 
328 Value_int32::Value_int32(Value_int32* ptr) noexcept : Value(ptr), value(ptr->get()) { }
329 
331 
333  auto ptr = new Value_int32(this);
334  if(!values.empty())
335  ptr->set_from(values);
336  return ptr;
337 }
338 
340  auto from = get_pointer<Value_int32>(ptr);
341  flags.store(from->flags);
342  value = from->value;
343 }
344 
345 void Value_int32::set_from(const Strings& values) {
346  from_string(values.back(), &value);
347 }
348 
349 Value::Type Value_int32::type() const noexcept {
350  return value_type;
351 }
352 
353 std::string Value_int32::to_string() const {
354  return std::to_string(value);
355 }
356 
357 
358 
359 Value_int64::Value_int64(const int64_t& v, uint8_t a_flags) noexcept
360  : Value(a_flags), value(v) { }
361 
362 Value_int64::Value_int64(Value_int64* ptr) noexcept : Value(ptr), value(ptr->get()) { }
363 
365 
367  auto ptr = new Value_int64(this);
368  if(!values.empty())
369  ptr->set_from(values);
370  return ptr;
371 }
372 
374  auto from = get_pointer<Value_int64>(ptr);
375  flags.store(from->flags);
376  value = from->value;
377 }
378 
379 void Value_int64::set_from(const Strings& values) {
380  from_string(values.back(), &value);
381 }
382 
383 Value::Type Value_int64::type() const noexcept {
384  return value_type;
385 }
386 
387 std::string Value_int64::to_string() const {
388  return std::to_string(value);
389 }
390 
391 
392 
393 Value_double::Value_double(const double& v, uint8_t a_flags) noexcept
394  : Value(a_flags), value(v) { }
395 
396 Value_double::Value_double(Value_double* ptr) noexcept : Value(ptr), value(ptr->get()) { }
397 
399 
401  auto ptr = new Value_double(this);
402  if(!values.empty())
403  ptr->set_from(values);
404  return ptr;
405 }
406 
408  auto from = get_pointer<Value_double>(ptr);
409  flags.store(from->flags);
410  value = from->value;
411 }
412 
413 void Value_double::set_from(const Strings& values) {
414  from_string(values.back(), &value);
415 }
416 
417 Value::Type Value_double::type() const noexcept {
418  return value_type;
419 }
420 
421 std::string Value_double::to_string() const {
422  return format("%g", value);
423 }
424 
425 
426 
427 Value_string::Value_string(std::string&& v, uint8_t a_flags) noexcept
428  : Value(a_flags), value(std::move(v)) {
429 }
430 
431 Value_string::Value_string(Value_string* ptr) : Value(ptr), value(ptr->get()) { }
432 
434 
436  auto ptr = new Value_string(this);
437  if(!values.empty())
438  ptr->set_from(values);
439  return ptr;
440 }
441 
443  auto from = get_pointer<Value_string>(ptr);
444  flags.store(from->flags);
445  value = from->value;
446 }
447 
448 void Value_string::set_from(const Strings& values) {
449  value = values.back();
450 }
451 
452 Value::Type Value_string::type() const noexcept {
453  return value_type;
454 }
455 
456 std::string Value_string::to_string() const {
457  return value;
458 }
459 
460 
461 
462 Value_enum::Value_enum(const int32_t& v,
464  Repr_t&& repr,
465  uint8_t a_flags)
466  : Value(a_flags), value(v),
467  call_from_string(std::move(from_string)),
468  call_repr(std::move(repr)) {
469 }
470 
472  : Value(ptr), value(ptr->get()),
473  call_from_string(ptr->call_from_string),
474  call_repr(ptr->call_repr) {
475 }
476 
478 
480  auto ptr = new Value_enum(this);
481  if(!values.empty())
482  ptr->set_from(values);
483  return ptr;
484 }
485 
487  auto from = get_pointer<Value_enum>(ptr);
488  flags.store(from->flags);
489  value = from->value;
490  if(!call_from_string)
491  call_from_string = from->call_from_string;
492  if(!call_repr)
493  call_repr = from->call_repr;
494 }
495 
496 void Value_enum::set_from(const Strings& values) {
497  if(!call_from_string)
499  "Bad Value %s, no from_string cb set", values.back().c_str());
500 
501  int nv = call_from_string(values.back());
502  if(nv < 0)
504  "Bad Value %s, no corresponding enum", values.back().c_str());
505  value = nv;
506 }
507 
508 Value::Type Value_enum::type() const noexcept {
509  return value_type;
510 }
511 
512 std::string Value_enum::to_string() const {
513  return format(
514  "%s # (%d)",
515  (call_repr ? call_repr(get()).c_str() : "repr not defined"), get());
516 }
517 
518 
519 
520 // lists
521 Value_strings::Value_strings(Strings&& v, uint8_t a_flags) noexcept
522  : Value(a_flags), value(std::move(v)) {
523 }
524 
525 Value_strings::Value_strings(Value_strings* ptr) : Value(ptr), value(ptr->get()) { }
526 
528 
530  auto ptr = new Value_strings(this);
531  if(!values.empty())
532  ptr->set_from(values);
533  return ptr;
534 }
535 
537  auto from = get_pointer<Value_strings>(ptr);
538  flags.store(from->flags);
539  value = from->value;
540 }
541 
542 void Value_strings::set_from(const Strings& values) {
543  value = values;
544 }
545 
547  return value_type;
548 }
549 
550 std::string Value_strings::to_string() const {
551  return format_list(value);
552 }
553 
554 
555 
556 Value_int64s::Value_int64s(Int64s&& v, uint8_t a_flags) noexcept
557  : Value(a_flags), value(std::move(v)) {
558 }
559 
560 Value_int64s::Value_int64s(Value_int64s* ptr) : Value(ptr), value(ptr->get()) { }
561 
563 
565  auto ptr = new Value_int64s(this);
566  if(!values.empty())
567  ptr->set_from(values);
568  return ptr;
569 }
570 
572  auto from = get_pointer<Value_int64s>(ptr);
573  flags.store(from->flags);
574  value = from->value;
575 }
576 
577 void Value_int64s::set_from(const Strings& values) {
578  value.clear();
579  int64_t v;
580  for(const std::string& s: values) {
581  from_string(s, &v);
582  value.push_back(v);
583  }
584 }
585 
586 Value::Type Value_int64s::type() const noexcept {
587  return value_type;
588 }
589 
590 std::string Value_int64s::to_string() const {
591  return format_list(value);
592 }
593 
594 
595 
596 Value_doubles::Value_doubles(Doubles&& v, uint8_t a_flags) noexcept
597  : Value(a_flags), value(std::move(v)) {
598 }
599 
600 Value_doubles::Value_doubles(Value_doubles* ptr) : Value(ptr), value(ptr->get()) { }
601 
603 
605  auto ptr = new Value_doubles(this);
606  if(!values.empty())
607  ptr->set_from(values);
608  return ptr;
609 }
610 
612  auto from = get_pointer<Value_doubles>(ptr);
613  flags.store(from->flags);
614  value = from->get();
615 }
616 
617 void Value_doubles::set_from(const Strings& values) {
618  value.clear();
619  double v;
620  for(const std::string& s: values) {
621  from_string(s, &v);
622  value.push_back(v);
623  }
624 }
625 
627  return value_type;
628 }
629 
630 std::string Value_doubles::to_string() const {
631  return format_list(value);
632 }
633 
634 
635 
636 // Guarded Atomic
637 Value_bool_g::Value_bool_g(const bool& v, Value_bool_g::OnChg_t&& cb, uint8_t a_flags)
638  : Value(a_flags | Value::GUARDED),
639  value(v), on_chg_cb(std::move(cb)) {
640 }
641 
643  : Value(ptr),
644  value(ptr->get()), on_chg_cb(ptr->on_chg_cb) {
645 }
646 
648 
650  auto ptr = new Value_bool_g(this);
651  if(!values.empty())
652  ptr->set_from(values);
653  return ptr;
654 }
655 
657  auto from = get_pointer<Value_bool_g>(ptr);
658  flags.store(from->flags);
659 
660  bool chg = value != from->value;
661  value.store(from->value.load());
662  if(!on_chg_cb)
663  on_chg_cb = from->on_chg_cb;
664  if(chg)
665  on_change();
666 }
667 
668 void Value_bool_g::set_from(const Strings& values) {
669  auto& str = values.back();
670  value.store((str.length() == 1 && *str.data() == '1') ||
671  Condition::str_case_eq(str.data(), "true", 4) ||
672  Condition::str_case_eq(str.data(), "yes", 3));
673 }
674 
675 Value::Type Value_bool_g::type() const noexcept {
676  return value_type;
677 }
678 
679 std::string Value_bool_g::to_string() const {
680  return value ? "true" : "false";
681 }
682 
683 void Value_bool_g::set(bool v) noexcept {
684  value.store(v);
685 }
686 
687 
689  if(on_chg_cb)
690  on_chg_cb(get());
691 }
692 
694  on_chg_cb = std::move(cb);
695 }
696 
697 
698 
699 Value_uint8_g::Value_uint8_g(const uint8_t& v, Value_uint8_g::OnChg_t&& cb, uint8_t a_flags)
700  : Value(a_flags | Value::GUARDED),
701  value(v), on_chg_cb(std::move(cb)) {
702 }
703 
705  : Value(ptr),
706  value(ptr->get()), on_chg_cb(ptr->on_chg_cb) {
707 }
708 
710 
712  auto ptr = new Value_uint8_g(this);
713  if(!values.empty())
714  ptr->set_from(values);
715  return ptr;
716 }
717 
719  auto from = get_pointer<Value_uint8_g>(ptr);
720  flags.store(from->flags);
721  bool chg = value != from->value;
722  value.store(from->value.load());
723  if(!on_chg_cb)
724  on_chg_cb = from->on_chg_cb;
725  if(chg)
726  on_change();
727 }
728 
729 void Value_uint8_g::set_from(const Strings& values) {
730  uint8_t v;
731  from_string(values.back(), &v);
732  value.store(v);
733 }
734 
736  return value_type;
737 }
738 
739 std::string Value_uint8_g::to_string() const {
740  return std::to_string(int16_t(value));
741 }
742 
744  if(on_chg_cb)
745  on_chg_cb(get());
746 }
747 
749  on_chg_cb = std::move(cb);
750 }
751 
752 
753 
755  Value_uint16_g::OnChg_t&& cb, uint8_t a_flags)
756  : Value(a_flags | Value::GUARDED),
757  value(v), on_chg_cb(std::move(cb)) {
758 }
759 
761  : Value(ptr),
762  value(ptr->get()), on_chg_cb(ptr->on_chg_cb) {
763 }
764 
766 
768  auto ptr = new Value_uint16_g(this);
769  if(!values.empty())
770  ptr->set_from(values);
771  return ptr;
772 }
773 
775  auto from = get_pointer<Value_uint16_g>(ptr);
776  flags.store(from->flags);
777  bool chg = value != from->value;
778  value.store(from->value.load());
779  if(!on_chg_cb)
780  on_chg_cb = from->on_chg_cb;
781  if(chg)
782  on_change();
783 }
784 
785 void Value_uint16_g::set_from(const Strings& values) {
786  uint16_t v;
787  from_string(values.back(), &v);
788  value.store(v);
789 }
790 
792  return value_type;
793 }
794 
795 std::string Value_uint16_g::to_string() const {
796  return std::to_string(value);
797 }
798 
800  if(on_chg_cb)
801  on_chg_cb(get());
802 }
803 
805  on_chg_cb = std::move(cb);
806 }
807 
808 
809 
810 Value_int32_g::Value_int32_g(const int32_t& v, Value_int32_g::OnChg_t&& cb, uint8_t a_flags)
811  : Value(a_flags | Value::GUARDED),
812  value(v), on_chg_cb(std::move(cb)) {
813 }
814 
816  : Value(ptr),
817  value(ptr->get()), on_chg_cb(ptr->on_chg_cb) {
818 }
819 
821 
823  auto ptr = new Value_int32_g(this);
824  if(!values.empty())
825  ptr->set_from(values);
826  return ptr;
827 }
828 
830  auto from = get_pointer<Value_int32_g>(ptr);
831  flags.store(from->flags);
832  bool chg = value != from->value;
833  value.store(from->value.load());
834  if(!on_chg_cb)
835  on_chg_cb = from->on_chg_cb;
836  if(chg)
837  on_change();
838 }
839 
840 void Value_int32_g::set_from(const Strings& values) {
841  int32_t v;
842  from_string(values.back(), &v);
843  value.store(v);
844 }
845 
847  return value_type;
848 }
849 
850 std::string Value_int32_g::to_string() const {
851  return std::to_string(value);
852 }
853 
855  if(on_chg_cb)
856  on_chg_cb(get());
857 }
858 
860  on_chg_cb = std::move(cb);
861 }
862 
863 
864 
866  Value_uint64_g::OnChg_t&& cb, uint8_t a_flags)
867  : Value(a_flags | Value::GUARDED),
868  value(v), on_chg_cb(std::move(cb)) {
869 }
870 
872  : Value(ptr),
873  value(ptr->get()), on_chg_cb(ptr->on_chg_cb) {
874 }
875 
877 
879  auto ptr = new Value_uint64_g(this);
880  if(!values.empty())
881  ptr->set_from(values);
882  return ptr;
883 }
884 
886  auto from = get_pointer<Value_uint64_g>(ptr);
887  flags.store(from->flags);
888  bool chg = value != from->value;
889  value.store(from->value.load());
890  if(!on_chg_cb)
891  on_chg_cb = from->on_chg_cb;
892  if(chg)
893  on_change();
894 }
895 
896 void Value_uint64_g::set_from(const Strings& values) {
897  uint64_t v;
898  from_string(values.back(), &v);
899  value.store(v);
900 }
901 
903  return value_type;
904 }
905 
906 std::string Value_uint64_g::to_string() const {
907  return std::to_string(value);
908 }
909 
911  if(on_chg_cb)
912  on_chg_cb(get());
913 }
914 
916  on_chg_cb = std::move(cb);
917 }
918 
919 
920 
921 Value_enum_g::Value_enum_g(const int32_t& v,
924  Value_enum_g::Repr_t&& repr,
925  uint8_t a_flags)
926  : Value(a_flags | Value::GUARDED), value(v),
927  on_chg_cb(std::move(cb)),
928  call_from_string(std::move(from_string)),
929  call_repr(std::move(repr)) {
930 }
931 
933  : Value(ptr), value(ptr->get()),
934  on_chg_cb(ptr->on_chg_cb),
935  call_from_string(ptr->call_from_string),
936  call_repr(ptr->call_repr) {
937 }
938 
940 
942  auto ptr = new Value_enum_g(this);
943  if(!values.empty())
944  ptr->set_from(values);
945  return ptr;
946 }
947 
949  auto from = get_pointer<Value_enum_g>(ptr);
950  flags.store(from->flags);
951  bool chg = value != from->value;
952  value.store(from->get());
953  if(!on_chg_cb)
954  on_chg_cb = from->on_chg_cb;
955  if(!call_from_string)
956  call_from_string = from->call_from_string;
957  if(!call_repr)
958  call_repr = from->call_repr;
959 
960  if(chg)
961  on_change();
962 }
963 
964 void Value_enum_g::set_from(const Strings& values) {
965  if(!call_from_string)
967  "Bad Value %s, no from_string cb set", values.back().c_str());
968  int nv = call_from_string(values.back());
969  if(nv < 0)
971  "Bad Value %s, no corresponding enum", values.back().c_str());
972  value.store(nv);
973 }
974 
975 Value::Type Value_enum_g::type() const noexcept {
976  return value_type;
977 }
978 
979 std::string Value_enum_g::to_string() const {
980  return format(
981  "%s # (%d)",
982  (call_repr ? call_repr(get()).c_str() : "repr not defined"), get());
983 }
984 
985 void Value_enum_g::set(int32_t nv) {
986  value.store(nv);
987  on_change();
988 }
989 
991  if(on_chg_cb)
992  on_chg_cb(get());
993 }
994 
996  on_chg_cb = std::move(cb);
997 }
998 
999 
1000 
1001 // Guarded Mutex
1003  uint8_t a_flags) noexcept
1004  : Value(a_flags | Value::GUARDED),
1005  mutex(), value(std::move(v)), on_chg_cb(std::move(cb)) {
1006 }
1007 
1009  : Value(ptr),
1010  mutex(), value(ptr->get()), on_chg_cb(ptr->on_chg_cb) {
1011 }
1012 
1014 
1016  auto ptr = new Value_strings_g(this);
1017  if(!values.empty())
1018  ptr->set_from(values);
1019  return ptr;
1020 }
1021 
1023  auto from = get_pointer<Value_strings_g>(ptr);
1024  flags.store(from->flags);
1025  bool chg;
1026  {
1028  chg = value != from->get();
1029  value = from->get();
1030  if(!on_chg_cb)
1031  on_chg_cb = from->on_chg_cb;
1032  }
1033  if(chg)
1034  on_change();
1035 }
1036 
1037 void Value_strings_g::set_from(const Strings& values) {
1039  value = values;
1040 }
1041 
1043  return value_type;
1044 }
1045 
1046 std::string Value_strings_g::to_string() const {
1048  return format_list(value);
1049 }
1050 
1053  return value;
1054 }
1055 
1056 size_t Value_strings_g::size() noexcept {
1058  return value.size();
1059 }
1060 
1061 std::string Value_strings_g::get_item(size_t n) {
1063  return value[n];
1064 }
1065 
1067  if(on_chg_cb)
1068  on_chg_cb();
1069 }
1070 
1073  on_chg_cb = std::move(cb);
1074 }
1075 
1076 
1077 
1078 }}} // namespace SWC::Config::Property
1079 
SWC::Config::Property::Value_string::value
std::string value
Definition: Property.h:342
SWC::Config::Property::Value_int32_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:829
SWC::Config::Property::Value_strings_g::value_type
static const Type value_type
Definition: Property.h:713
SWC::Config::Property::Value_strings_g::value
Strings value
Definition: Property.h:745
SWC::Config::Property::Value_bool_g::on_change
void on_change() const
Definition: Property.cc:688
SWC::Config::Property::Value_uint8_g::value_type
static const Type value_type
Definition: Property.h:513
SWC::Config::Property::Value_strings_g::size
size_t size() noexcept
Definition: Property.cc:1056
SWC::Config::Property::Value_int32::value_type
static const Type value_type
Definition: Property.h:232
SWC::Config::Property::Value_uint64_g::Value_uint64_g
Value_uint64_g(const uint64_t &v, OnChg_t &&cb, uint8_t flags=0)
Definition: Property.cc:865
SWC::Config::Property::Value_int64::Value_int64
Value_int64(const int64_t &v, uint8_t flags=0) noexcept
Definition: Property.cc:359
SWC::Config::Property::Value::is_skippable
bool is_skippable() const noexcept
Definition: Property.cc:75
SWC::Config::Property::Value_uint8_g::get
SWC_CAN_INLINE uint8_t get() const noexcept
Definition: Property.h:535
SWC::Config::Property::Value_strings_g::on_change
void on_change() const
Definition: Property.cc:1066
SWC::Config::Property::Value_int64::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:366
SWC::Config::Property::Value_bool_g::value_type
static const Type value_type
Definition: Property.h:474
SWC::Config::Property::Value_bool_g::~Value_bool_g
virtual ~Value_bool_g() noexcept
Definition: Property.cc:647
SWC::Config::Property::Value_uint16::Value_uint16
Value_uint16(const uint16_t &v, uint8_t flags=0) noexcept
Definition: Property.cc:291
SWC::Config::Property::Value_uint8::Value_uint8
Value_uint8(const uint8_t &v, uint8_t flags=0) noexcept
Definition: Property.cc:256
SWC::Config::Property::Value_uint8_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:711
SWC::Config::Property::Value_uint16_g::Value_uint16_g
Value_uint16_g(const uint16_t &v, OnChg_t &&cb, uint8_t flags=0)
Definition: Property.cc:754
SWC::Config::Property::Value_uint16_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:774
SWC::Config::Property::Value_uint64_g::get
SWC_CAN_INLINE uint64_t get() const noexcept
Definition: Property.h:648
SWC::Config::Property::Value_enum_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:941
SWC::Config::Property::Value_uint8::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:264
SWC::Config::Property::Value_uint8_g::to_string
std::string to_string() const override
Definition: Property.cc:739
SWC::Config::Property::Value_int32_g::~Value_int32_g
virtual ~Value_int32_g() noexcept
Definition: Property.cc:820
SWC::Config::Property::Value_uint64_g
Definition: Property.h:624
SWC::Config::Property::Value_double::to_string
std::string to_string() const override
Definition: Property.cc:421
SWC::Config::Property::Value::default_value
Ptr default_value(bool defaulted) noexcept
Definition: Property.cc:83
SWC::Config::Property::Value_strings::Value_strings
Value_strings(Strings &&v, uint8_t flags=0) noexcept
Definition: Property.cc:521
SWC::Config::Property::Value_int64::value
int64_t value
Definition: Property.h:284
SWC::Config::Property::Value_uint8_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:748
SWC::Config::Property::Value_enum::~Value_enum
virtual ~Value_enum() noexcept
Definition: Property.cc:477
SWC::Config::Property::Value_uint16::value
uint16_t value
Definition: Property.h:226
SWC::Config::Property::Value_int32::to_string
std::string to_string() const override
Definition: Property.cc:353
SWC::Config::Property::Value_uint8_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:718
SWC::Config::Property::Value_uint16_g::get
SWC_CAN_INLINE uint16_t get() const noexcept
Definition: Property.h:572
SWC::Core::Vector::clear
SWC_CAN_INLINE void clear() noexcept(_NoExceptDestructor)
Definition: Vector.h:120
SWC::Config::Property::Value_uint64_g::to_string
std::string to_string() const override
Definition: Property.cc:906
SWC::Config::Property::Value_bool_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:507
SWC::Config::Property::Value::is_guarded
bool is_guarded() const noexcept
Definition: Property.cc:79
SWC::Config::Property::Value_strings_g::OnChg_t
std::function< void()> OnChg_t
Definition: Property.h:716
SWC::Config::Property::Value_int64s::value
Int64s value
Definition: Property.h:437
SWC::Config::Property::Value::to_string
virtual std::string to_string() const =0
SWC::Config::Property::Value_int64::~Value_int64
virtual ~Value_int64() noexcept
Definition: Property.cc:364
SWC::Config::Property::Value_bool_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:656
SWC::Config::Property::Value_int64s::to_string
std::string to_string() const override
Definition: Property.cc:590
SWC::Config::Property::Value_doubles::value_type
static const Type value_type
Definition: Property.h:443
SWC::Config::Property::Value_uint16_g::value_type
static const Type value_type
Definition: Property.h:550
SWC::Config::Property::Value_uint8_g::OnChg_t
std::function< void(uint8_t)> OnChg_t
Definition: Property.h:516
SWC::Config::Property::Value_enum::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:479
SWC::Config::Property::Value::SKIPPABLE
static const uint8_t SKIPPABLE
Definition: Property.h:63
SWC::Config::Property::Value_string::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:442
SWC::Config::Property::Value_strings::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:536
SWC::Config::Property::Value_int32_g::Value_int32_g
Value_int32_g(const int32_t &v, OnChg_t &&cb, uint8_t flags=0)
Definition: Property.cc:810
SWC::Config::Property::Value_int32_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:822
SWC::Config::Property::Value_enum::call_repr
Repr_t call_repr
Definition: Property.h:379
SWC::Config::Property::Value::is_default
bool is_default() const noexcept
Definition: Property.cc:90
SWC::Config::Property::Value_uint16::value_type
static const Type value_type
Definition: Property.h:203
SWC_ASSERTF
#define SWC_ASSERTF(_e_, _fmt_,...)
Definition: Exception.h:175
SWC::Config::Property::Value_string::~Value_string
virtual ~Value_string() noexcept
Definition: Property.cc:433
SWC::Config::Property::Value_uint8::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:281
SWC::Config::Property::Value_enum_g::value
Core::Atomic< int32_t > value
Definition: Property.h:702
SWC::Config::Property::Value_strings
Definition: Property.h:383
SWC::Config::Property::Value_int32::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:332
SWC::Config::Property::Value_uint64_g::OnChg_t
std::function< void(uint64_t)> OnChg_t
Definition: Property.h:629
SWC::Config::Property::Value_strings_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:1071
SWC::Config::Property::Value_uint64_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:878
SWC::Config::Property::Value_uint16::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:298
SWC::Config::Property::Value_uint8_g::value
Core::Atomic< uint8_t > value
Definition: Property.h:543
SWC::Config::Property::Value_uint16
Definition: Property.h:201
SWC::Config::Property::Value_uint8::value_type
static const Type value_type
Definition: Property.h:174
SWC::Config::Property::Value_bool
Definition: Property.h:143
SWC::Config::Property::Value_int32_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:846
SWC::Config::Property::Value_bool_g::Value_bool_g
Value_bool_g(const bool &v, OnChg_t &&cb, uint8_t flags=0)
Definition: Property.cc:637
SWC::Config::Property::Value_int64s::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:586
SWC::Config::Property::Value_int32_g::value
Core::Atomic< int32_t > value
Definition: Property.h:618
SWC::Config::Property::Value_string::to_string
std::string to_string() const override
Definition: Property.cc:456
SWC::Config::Property::Value_int32_g::get
SWC_CAN_INLINE int32_t get() const noexcept
Definition: Property.h:610
SWC::Config::Property::Value_doubles::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:626
SWC::Config::Property::Value_bool::value_type
static const Type value_type
Definition: Property.h:145
SWC::Config::Property::Value::Value
Value(uint8_t flags=0) noexcept
Definition: Property.cc:65
SWC::Config::Property::Value_int32_g::on_change
void on_change() const
Definition: Property.cc:854
SWC::Config::Property::Value_uint8::to_string
std::string to_string() const override
Definition: Property.cc:285
SWC::Config::Property::Value_strings::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:529
SWC::Config::Property::Value_uint64_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:902
SWC::Config::Property::Value_int32_g::to_string
std::string to_string() const override
Definition: Property.cc:850
SWC::Config::Property::Value_doubles::to_string
std::string to_string() const override
Definition: Property.cc:630
SWC::Config::Property::Value_uint8_g::~Value_uint8_g
virtual ~Value_uint8_g() noexcept
Definition: Property.cc:709
SWC::Core::MutexAtomic::scope
Definition: MutexAtomic.h:77
SWC::Config::Property::Value_bool::to_string
std::string to_string() const override
Definition: Property.cc:250
SWC::Config::Property::Value_bool_g::to_string
std::string to_string() const override
Definition: Property.cc:679
SWC::Config::Property::Value_enum::FromString_t
std::function< int(const std::string &)> FromString_t
Definition: Property.h:350
SWC::Config::Property::Value_int32
Definition: Property.h:230
SWC::Config::Property::Value_uint64_g::on_change
void on_change() const
Definition: Property.cc:910
SWC::Config::Property::Value_doubles
Definition: Property.h:441
SWC::Config::Property::Value_uint8_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:735
SWC::Config::Property::Value_int32_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:619
SWC::Config::Property::Value_uint16::to_string
std::string to_string() const override
Definition: Property.cc:319
SWC::Config::Property::Value_strings_g
Definition: Property.h:711
SWC::Config::Property::Value_uint16_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:581
SWC::Core::AtomicBase::store
constexpr SWC_CAN_INLINE void store(T v) noexcept
Definition: Atomic.h:37
SWC::Config::Property::Value_strings::~Value_strings
virtual ~Value_strings() noexcept
Definition: Property.cc:527
SWC::Config::Property::Value::DEFAULT
static const uint8_t DEFAULT
Definition: Property.h:65
SWC::Config::Property::Value_int64
Definition: Property.h:259
SWC::Core::Vector::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC::Config::Property::Value_uint16::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:305
SWC::Config::Property::Value_uint16_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:791
Exception.h
SWC::Core::Vector::back
constexpr SWC_CAN_INLINE reference back() noexcept
Definition: Vector.h:254
SWC::Config::Property::Value_int32::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:349
SWC::Config::Property::Value_strings_g::to_string
std::string to_string() const override
Definition: Property.cc:1046
SWC::Config::Property::Value_uint64_g::value
Core::Atomic< uint64_t > value
Definition: Property.h:656
SWC::Config::Property::Value_int32::value
int32_t value
Definition: Property.h:255
SWC::Config::Property::Value_enum_g::set
void set(int32_t nv)
Definition: Property.cc:985
SWC::Config::Property::Value_enum::to_string
std::string to_string() const override
Definition: Property.cc:512
SWC::Config::Property::Value_int64s::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:571
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
Property.h
SWC::Config::Property::Value_strings_g::Value_strings_g
Value_strings_g(Strings &&v, OnChg_t &&cb, uint8_t flags=0) noexcept
Definition: Property.cc:1002
SWC::Config::Property::Value_int64::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:383
SWC::Config::Property::Value_doubles::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:604
SWC::Config::Property::Value_int32_g::value_type
static const Type value_type
Definition: Property.h:588
SWC::Config::Property::Value_enum::call_from_string
FromString_t call_from_string
Definition: Property.h:378
SWC::Config::Property::Value_uint16_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:804
SWC::Config::Property::Value::~Value
virtual ~Value() noexcept
Definition: Property.cc:69
SWC::Config::Property::Value_strings_g::mutex
Core::MutexAtomic mutex
Definition: Property.h:744
SWC::Config::Property::Value_enum::get
SWC_CAN_INLINE int32_t get() const noexcept
Definition: Property.h:373
SWC::Config::Property::Value_bool::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:246
SWC::Config::Property::Value_strings::value_type
static const Type value_type
Definition: Property.h:385
SWC::Config::Property::Value_bool_g::set
void set(bool v) noexcept
Definition: Property.cc:683
SWC::Config::Property::Value_uint8::value
uint8_t value
Definition: Property.h:197
SWC::Config::Property::Value_enum::value_type
static const Type value_type
Definition: Property.h:348
SWC::Config::Property::Value_enum_g::call_repr
Repr_t call_repr
Definition: Property.h:705
SWC::Config::Property::Value_int32::~Value_int32
virtual ~Value_int32() noexcept
Definition: Property.cc:330
SWC_THROWF
#define SWC_THROWF(_code_, _fmt_,...)
Definition: Exception.h:136
SWC::Config::Property::Value_uint16_g::on_change
void on_change() const
Definition: Property.cc:799
SWC::Config::Property::Value_enum::value
int32_t value
Definition: Property.h:377
SWC::Config::Property::Value_string::Value_string
Value_string(std::string &&v, uint8_t flags=0) noexcept
Definition: Property.cc:427
SWC::Config::Property::Value::operator<<
std::ostream & operator<<(std::ostream &ostream)
Definition: Property.cc:71
SWC::Config::Property::Value::GUARDED
static const uint8_t GUARDED
Definition: Property.h:64
SWC::Config::Property::Value_bool_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:649
SWC::Config::str
Property::Value_string::Ptr str(std::string &&v)
Definition: PropertiesParser.cc:45
SWC::Config::Property::from_string
void from_string(const char *s, double *value)
Definition: Property.cc:109
SWC::Config::Property::Value_enum_g::value_type
static const Type value_type
Definition: Property.h:664
SWC::Config::Property::Value_enum_g::call_from_string
FromString_t call_from_string
Definition: Property.h:704
SWC::Config::Property::Value::Type
Type
Definition: Property.h:38
SWC::Config::Property::Value_uint16::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:315
SWC::Config::Property::Value_uint64_g::~Value_uint64_g
virtual ~Value_uint64_g() noexcept
Definition: Property.cc:876
SWC::Config::Property::Value_bool_g::OnChg_t
std::function< void(bool)> OnChg_t
Definition: Property.h:477
SWC::Config::Property::Value_strings::value
Strings value
Definition: Property.h:408
SWC::Config::Property::Value::NO_TOKEN
static const uint8_t NO_TOKEN
Definition: Property.h:66
SWC::Config::Property::Value_int64s::~Value_int64s
virtual ~Value_int64s() noexcept
Definition: Property.cc:562
SWC::Config::Property::Value_uint8_g
Definition: Property.h:511
SWC::Config::Property::Value_int32_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:859
SWC::Config::Property::Value_strings_g::get
Strings get() const
Definition: Property.cc:1051
SWC::Config::Property::Value_uint16_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:767
SWC::Config::Property::Value_bool_g::get
SWC_CAN_INLINE bool get() const noexcept
Definition: Property.h:496
SWC::Config::Property::Value_bool::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:226
SWC::Config::Property::Value_strings::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:546
SWC::Config::Property::Value_uint8::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:271
SWC::Config::Property::Value_double::~Value_double
virtual ~Value_double() noexcept
Definition: Property.cc:398
SWC::Config::Property::Value_string
Definition: Property.h:317
SWC::Config::Property::Value
Definition: Property.h:35
SWC::Config::Property::Value::flags
Core::Atomic< uint8_t > flags
Definition: Property.h:114
SWC::Config::Property::Value_double::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:400
SWC::Config::Property::Value_int64s::value_type
static const Type value_type
Definition: Property.h:414
SWC::Config::Property::Value_enum_g
Definition: Property.h:662
SWC::Config::Property::Value_double::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:417
SWC::Config::Property::Value_uint16_g::to_string
std::string to_string() const override
Definition: Property.cc:795
SWC::format
std::string format(const char *fmt,...) __attribute__((format(printf
Definition: String.cc:17
SWC::Config::Property::Value_uint16_g::value
Core::Atomic< uint16_t > value
Definition: Property.h:580
SWC::Config::Property::Value_enum_g::to_string
std::string to_string() const override
Definition: Property.cc:979
SWC::Core::Vector< std::string >
SWC::format_list
std::string SWC_PRAGMA_DIAGNOSTIC_PUSH SWC_PRAGMA_DIAGNOSTIC_IGNORED("-Wformat-nonliteral") std SWC_PRAGMA_DIAGNOSTIC_POP std::string format_list(const SequenceT &seq, const char *sep=", ")
Definition: String.h:34
SWC::Config::Property::Value_bool::Value_bool
Value_bool(const bool &v, uint8_t flags=0) noexcept
Definition: Property.cc:218
SWC::Config::Property::Value_enum::Repr_t
std::function< std::string(int)> Repr_t
Definition: Property.h:351
SWC::Config::Property::Value_uint16_g::OnChg_t
std::function< void(uint16_t)> OnChg_t
Definition: Property.h:553
SWC::Config::Property::Value_enum_g::Value_enum_g
Value_enum_g(const int32_t &v, OnChg_t &&cb, FromString_t &&from_string, Repr_t &&repr, uint8_t flags=0)
Definition: Property.cc:921
SWC::Config::Property::Value_enum_g::Repr_t
Value_enum::Repr_t Repr_t
Definition: Property.h:669
SWC::Config::Property::Value::zero_token
Ptr zero_token() noexcept
Definition: Property.cc:94
SWC::Condition::from
Comp from(const char **buf, uint32_t *remainp, uint8_t extended=0x00) noexcept
Definition: Comparators.cc:15
SWC::Config::Property::Value_strings_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:1042
SWC::Config::Property::Value_uint8::~Value_uint8
virtual ~Value_uint8() noexcept
Definition: Property.cc:262
SWC::Config::Property::Value_enum::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:486
SWC::Config::Property::Value_uint8
Definition: Property.h:172
SWC::Config::Property::Value_bool::value
bool value
Definition: Property.h:168
SWC::Config::Property::Value_bool::~Value_bool
virtual ~Value_bool() noexcept
Definition: Property.cc:224
SWC::Config::Property::Value_bool::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:233
SWC::Config::Property::Value_strings_g::get_item
std::string get_item(size_t n)
Definition: Property.cc:1061
SWC::Config::Property::Value_enum::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:508
SWC::Config::Property::Value_enum_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:975
SWC::Config::Property::Value_int64s
Definition: Property.h:412
SWC::Config::Property::Value_uint16_g
Definition: Property.h:548
SWC::Config::Property::Value_uint64_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:885
SWC::Config::Property::Value_enum_g::OnChg_t
std::function< void(int32_t)> OnChg_t
Definition: Property.h:667
SWC::Config::Property::Value_enum_g::~Value_enum_g
virtual ~Value_enum_g() noexcept
Definition: Property.cc:939
SWC::Config::Property::Value_enum_g::on_change
void on_change() const
Definition: Property.cc:990
SWC::Config::Property::Value_enum_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:703
SWC::Config::Property::Value_doubles::Value_doubles
Value_doubles(Doubles &&v, uint8_t flags=0) noexcept
Definition: Property.cc:596
SWC::Config::Property::Value_string::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:435
SWC::Config::Property::Value_int32::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:339
SWC::Config::Property::Value_uint16_g::~Value_uint16_g
virtual ~Value_uint16_g() noexcept
Definition: Property.cc:765
SWC::Config::Property::Value_double::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:407
SWC::Config::Property::Value_int64::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:373
SWC::Config::Property::Value_strings_g::make_new
Value::Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:1015
SWC::Config::Property::Value_double::value
double value
Definition: Property.h:313
SWC::Config::Property::Value_int64::to_string
std::string to_string() const override
Definition: Property.cc:387
SWC::Config::Property::Value_string::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:452
SWC::Config::Property::Value_double::value_type
static const Type value_type
Definition: Property.h:290
SWC::Config::Property::Value_bool_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:693
SWC::Config::Property::Value_doubles::value
Doubles value
Definition: Property.h:466
SWC::Config::Property::Value_double
Definition: Property.h:288
SWC::Config::Property::Value_enum_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:995
SWC::Config::Property::Value_int64s::Value_int64s
Value_int64s(Int64s &&v, uint8_t flags=0) noexcept
Definition: Property.cc:556
flags
uint8_t flags
Flags.
Definition: Header.h:55
SWC::Config::Property::Value_int32::Value_int32
Value_int32(const int32_t &v, uint8_t flags=0) noexcept
Definition: Property.cc:325
SWC::Error::CONFIG_GET_ERROR
@ CONFIG_GET_ERROR
Definition: Error.h:80
SWC::Config::Property::Value::is_zero_token
bool is_zero_token() const noexcept
Definition: Property.cc:99
SWC::Config::Property::Value_strings_g::~Value_strings_g
virtual ~Value_strings_g() noexcept
Definition: Property.cc:1013
SWC::Core::Vector::push_back
SWC_CAN_INLINE void push_back(ArgsT &&... args)
Definition: Vector.h:331
SWC::Config::Property::Value_bool_g
Definition: Property.h:472
SWC::Config::Property::Value_uint8_g::on_change
void on_change() const
Definition: Property.cc:743
SWC::Config::Property::Value_enum::Value_enum
Value_enum(const int32_t &v, FromString_t &&from_string, Repr_t &&repr, uint8_t flags=0)
Definition: Property.cc:462
SWC::Config::Property::Value_strings_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:746
SWC::Core::to_string
SWC_CAN_INLINE std::string to_string(const BitFieldInt< T, SZ > &v)
Definition: BitFieldInt.h:263
SWC::Config::Property::Value_strings::to_string
std::string to_string() const override
Definition: Property.cc:550
SWC::Config::Property::Value_int32_g::OnChg_t
std::function< void(int32_t)> OnChg_t
Definition: Property.h:591
SWC::Config::Property::Value_uint64_g::value_type
static const Type value_type
Definition: Property.h:626
SWC::Config::Property::Value_enum_g::FromString_t
Value_enum::FromString_t FromString_t
Definition: Property.h:668
SWC::Config::Property::Value_string::value_type
static const Type value_type
Definition: Property.h:319
SWC::Core::Vector::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Config::Property::Value_uint64_g::set_cb_on_chg
void set_cb_on_chg(OnChg_t &&cb)
Definition: Property.cc:915
SWC::Config::Property::Value_enum_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:948
SWC::Config::Property::Value_enum
Definition: Property.h:346
SWC::Condition::str_case_eq
bool str_case_eq(const char *s1, const char *s2, size_t count) noexcept SWC_ATTRIBS((SWC_ATTRIB_O3))
Definition: Comparators_basic.h:257
SWC::Config::Property::Value_bool_g::value
Core::AtomicBool value
Definition: Property.h:506
SWC::Config::Property::Value_uint16::~Value_uint16
virtual ~Value_uint16() noexcept
Definition: Property.cc:296
SWC::Config::Property::Value_double::Value_double
Value_double(const double &v, uint8_t flags=0) noexcept
Definition: Property.cc:393
SWC::Config::Property::Value_doubles::~Value_doubles
virtual ~Value_doubles() noexcept
Definition: Property.cc:602
SWC::Config::Property::Value_strings_g::set_from
void set_from(Value::Ptr ptr) override
Definition: Property.cc:1022
SWC::Config::Property::Value_int64::value_type
static const Type value_type
Definition: Property.h:261
SWC::Config::Property::Value_uint8_g::Value_uint8_g
Value_uint8_g(const uint8_t &v, OnChg_t &&cb, uint8_t flags=0)
Definition: Property.cc:699
SWC::Config::Property::Value_int32_g
Definition: Property.h:586
SWC::Config::Property::Value::assure_match
static void assure_match(Type t1, Type t2)
Definition: Property.cc:57
SWC::Config::Property::Value_doubles::set_from
void set_from(Ptr ptr) override
Definition: Property.cc:611
SWC::Config::Property::Value_bool_g::type
Type SWC_CONST_FUNC type() const noexcept override
Definition: Property.cc:675
SWC::Config::Property::Value_enum_g::get
SWC_CAN_INLINE int32_t get() const noexcept
Definition: Property.h:692
SWC::Config::Property::Value_uint64_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:657
SWC::Core::Atomic::fetch_xor
constexpr SWC_CAN_INLINE T fetch_xor(T v) noexcept
Definition: Atomic.h:98
SWC::Config::Property::Value_uint8_g::on_chg_cb
OnChg_t on_chg_cb
Definition: Property.h:544
SWC::Config::Property::Value_int64s::make_new
Ptr make_new(const Strings &values=Strings()) override
Definition: Property.cc:564