MADARA  3.1.8
KnowledgeBase.h
Go to the documentation of this file.
1 #ifndef _MADARA_KNOWLEDGE_BASE_H
2 #define _MADARA_KNOWLEDGE_BASE_H
3 
11 #include <ostream>
12 #include <string>
13 #include <map>
14 #include <memory>
15 
20 #include "madara/MADARA_export.h"
28 
29 
30 #ifdef _MADARA_PYTHON_CALLBACKS_
31 #include "boost/python/object.hpp"
32 #endif
33 
34 namespace madara
35 {
36 
37  namespace knowledge
38  {
39 
44  class MADARA_Export KnowledgeBase
45  {
46  public:
50  KnowledgeBase ();
51 
57  KnowledgeBase (const std::string & host, int transport);
58 
65  KnowledgeBase (const std::string & host, int transport,
66  const std::string & domain);
67 
73  KnowledgeBase (const std::string & host,
75 
80  KnowledgeBase (const KnowledgeBase & original) = default;
81 
86  void use (ThreadSafeContext & original);
87 
91  ~KnowledgeBase () = default;
92 
102  void copy (const KnowledgeBase & source,
103  const KnowledgeRequirements & settings);
104 
124  void copy (const KnowledgeBase & source,
125  const CopySet & copy_set = CopySet (),
126  bool clean_copy = false);
127 
132  KnowledgeBase &operator= (const KnowledgeBase & original) = default;
133 
137  void activate_transport (void);
138 
142  void close_transport (void);
143 
148  size_t get_num_transports (void);
149 
153  void lock (void);
154 
159  void unlock (void);
160 
168  const KnowledgeReferenceSettings & settings =
170 
178  get (const VariableReference & variable,
179  const KnowledgeReferenceSettings & settings =
181 
191  get_ref (const std::string & key,
192  const KnowledgeReferenceSettings & settings =
194 
199  std::shared_ptr<std::string> share_string(const std::string & key,
200  const KnowledgeReferenceSettings & settings =
202  {
203  if (impl_)
204  {
205  return impl_->share_string (key, settings);
206  }
207  else if (context_)
208  {
209  return context_->share_string (key, settings);
210  }
211 
212  return nullptr;
213  }
214 
219  std::shared_ptr<std::string> share_string(const VariableReference & key,
220  const KnowledgeReferenceSettings & settings =
222  {
223  if (impl_)
224  {
225  return impl_->share_string (key, settings);
226  }
227  else if (context_)
228  {
229  return context_->share_string (key, settings);
230  }
231 
232  return nullptr;
233  }
234 
239  std::shared_ptr<std::string> take_string(const std::string & key,
240  const KnowledgeReferenceSettings & settings =
242  {
243  if (impl_)
244  {
245  return impl_->take_string (key, settings);
246  }
247  else if (context_)
248  {
249  return context_->take_string (key, settings);
250  }
251 
252  return nullptr;
253  }
254 
259  std::shared_ptr<std::string> take_string(const VariableReference & key,
260  const KnowledgeReferenceSettings & settings =
262  {
263  if (impl_)
264  {
265  return impl_->take_string (key, settings);
266  }
267  else if (context_)
268  {
269  return context_->take_string (key, settings);
270  }
271 
272  return nullptr;
273  }
274 
279  std::shared_ptr<std::vector<KnowledgeRecord::Integer>>
281  const KnowledgeReferenceSettings & settings =
283  {
284  if (impl_)
285  {
286  return impl_->share_integers (key, settings);
287  }
288  else if (context_)
289  {
290  return context_->share_integers (key, settings);
291  }
292 
293  return nullptr;
294  }
295 
300  std::shared_ptr<std::vector<KnowledgeRecord::Integer>>
302  const KnowledgeReferenceSettings & settings =
304  {
305  if (impl_)
306  {
307  return impl_->share_integers (key, settings);
308  }
309  else if (context_)
310  {
311  return context_->share_integers (key, settings);
312  }
313 
314  return nullptr;
315  }
316 
321  std::shared_ptr<std::vector<KnowledgeRecord::Integer>>
323  const KnowledgeReferenceSettings & settings =
325  {
326  if (impl_)
327  {
328  return impl_->take_integers (key, settings);
329  }
330  else if (context_)
331  {
332  return context_->take_integers (key, settings);
333  }
334 
335  return nullptr;
336  }
337 
342  std::shared_ptr<std::vector<KnowledgeRecord::Integer>>
344  const KnowledgeReferenceSettings & settings =
346  {
347  if (impl_)
348  {
349  return impl_->take_integers (key, settings);
350  }
351  else if (context_)
352  {
353  return context_->take_integers (key, settings);
354  }
355 
356  return nullptr;
357  }
358 
363  std::shared_ptr<std::vector<double>>
365  const KnowledgeReferenceSettings & settings =
367  {
368  if (impl_)
369  {
370  return impl_->share_doubles (key, settings);
371  }
372  else if (context_)
373  {
374  return context_->share_doubles (key, settings);
375  }
376 
377  return nullptr;
378  }
379 
384  std::shared_ptr<std::vector<double>>
386  const KnowledgeReferenceSettings & settings =
388  {
389  if (impl_)
390  {
391  return impl_->share_doubles (key, settings);
392  }
393  else if (context_)
394  {
395  return context_->share_doubles (key, settings);
396  }
397 
398  return nullptr;
399  }
400 
405  std::shared_ptr<std::vector<double>>
407  const KnowledgeReferenceSettings & settings =
409  {
410  if (impl_)
411  {
412  return impl_->take_doubles (key, settings);
413  }
414  else if (context_)
415  {
416  return context_->take_doubles (key, settings);
417  }
418 
419  return nullptr;
420  }
421 
426  std::shared_ptr<std::vector<double>>
428  const KnowledgeReferenceSettings & settings =
430  {
431  if (impl_)
432  {
433  return impl_->take_doubles (key, settings);
434  }
435  else if (context_)
436  {
437  return context_->take_doubles (key, settings);
438  }
439 
440  return nullptr;
441  }
442 
447  std::shared_ptr<std::vector<unsigned char>>
449  const KnowledgeReferenceSettings & settings =
451  {
452  if (impl_)
453  {
454  return impl_->share_binary (key, settings);
455  }
456  else if (context_)
457  {
458  return context_->share_binary (key, settings);
459  }
460 
461  return nullptr;
462  }
463 
468  std::shared_ptr<std::vector<unsigned char>>
470  const KnowledgeReferenceSettings & settings =
472  {
473  if (impl_)
474  {
475  return impl_->share_binary (key, settings);
476  }
477  else if (context_)
478  {
479  return context_->share_binary (key, settings);
480  }
481 
482  return nullptr;
483  }
484 
489  std::shared_ptr<std::vector<unsigned char>>
491  const KnowledgeReferenceSettings & settings =
493  {
494  if (impl_)
495  {
496  return impl_->take_binary (key, settings);
497  }
498  else if (context_)
499  {
500  return context_->take_binary (key, settings);
501  }
502 
503  return nullptr;
504  }
505 
510  std::shared_ptr<std::vector<unsigned char>>
512  const KnowledgeReferenceSettings & settings =
514  {
515  if (impl_)
516  {
517  return impl_->take_binary (key, settings);
518  }
519  else if (context_)
520  {
521  return context_->take_binary (key, settings);
522  }
523 
524  return nullptr;
525  }
531  void mark_modified (const VariableReference & variable,
532  const KnowledgeUpdateSettings & settings = KnowledgeUpdateSettings());
533 
539  void mark_modified (const std::string & name,
540  const KnowledgeUpdateSettings & settings = KnowledgeUpdateSettings());
541 
549  madara::knowledge::KnowledgeRecord retrieve_index (const std::string & key,
550  size_t index,
551  const KnowledgeReferenceSettings & settings =
553 
560  int read_file (const std::string & knowledge_key,
561  const std::string & filename,
562  const EvalSettings & settings =
563  EvalSettings (false, false, true, false, false));
564 
572  int
573  read_file (
574  const VariableReference & variable,
575  const std::string & filename,
576  const EvalSettings & settings =
577  EvalSettings (false, false, true, false, false));
578 
586  int set (const VariableReference & variable,
587  const std::string & value,
588  const EvalSettings & settings =
589  EvalSettings (false, false, true, false, false));
590 
598  int set (const VariableReference & variable,
599  std::string && value,
600  const EvalSettings & settings =
601  EvalSettings (false, false, true, false, false));
602 
610  int set (const VariableReference & variable,
611  const KnowledgeRecord & value,
612  const EvalSettings & settings =
613  EvalSettings (false, false, true, false, false));
614 
622  int set (const VariableReference & variable,
623  KnowledgeRecord && value,
624  const EvalSettings & settings =
625  EvalSettings (false, false, true, false, false));
626 
634  int set (const std::string & key,
635  const KnowledgeRecord & value,
636  const EvalSettings & settings =
637  EvalSettings (false, false, true, false, false));
638 
646  int set (const std::string & key,
647  KnowledgeRecord && value,
648  const EvalSettings & settings =
649  EvalSettings (false, false, true, false, false));
650 
658  int set (const VariableReference & variable,
659  const EvalSettings & settings =
660  EvalSettings (false, false, true, false, false)) {
661  return set (variable, 1, settings);
662  }
663 
671  int set (const VariableReference & variable,
672  const std::vector <double> & value,
673  const EvalSettings & settings =
674  EvalSettings (false, false, true, false, false));
675 
683  int set (const VariableReference & variable,
684  std::vector <double> && value,
685  const EvalSettings & settings =
686  EvalSettings (false, false, true, false, false));
687 
696  int set (const VariableReference & variable,
697  const double * value,
698  uint32_t size,
699  const EvalSettings & settings =
700  EvalSettings (false, false, true, false, false));
701 
710  template<typename T>
711  int set_index (const VariableReference & variable,
712  size_t index, T&& value,
713  const EvalSettings & settings =
714  EvalSettings (false, false, true, false, false));
715 
723  template<typename T,
724  typename std::enable_if<std::is_floating_point<T>::value,
725  void*>::type = nullptr>
726  int set (const VariableReference & variable,
727  T value,
728  const EvalSettings & settings =
729  EvalSettings (false, false, true, false, false));
730 
738  int set (const VariableReference & variable,
739  const std::vector <KnowledgeRecord::Integer> & value,
740  const EvalSettings & settings =
741  EvalSettings (false, false, true, false, false));
742 
750  int set (const VariableReference & variable,
751  std::vector <KnowledgeRecord::Integer> && value,
752  const EvalSettings & settings =
753  EvalSettings (false, false, true, false, false));
754 
763  int set (const VariableReference & variable,
765  uint32_t size,
766  const EvalSettings & settings =
767  EvalSettings (false, false, true, false, false));
768 
776  template<typename T,
777  typename std::enable_if<std::is_integral<T>::value,
778  void*>::type = nullptr>
779  int set (const VariableReference & variable,
780  T value,
781  const EvalSettings & settings =
782  EvalSettings (false, false, true, false, false));
783 
792  int set_text (const VariableReference & variable,
793  const char * value, size_t size,
794  const EvalSettings & settings =
795  EvalSettings (false, false, true, false, false));
796 
805  int set_file (const std::string & key,
806  const unsigned char * value, size_t size,
807  const EvalSettings & settings =
808  EvalSettings (false, false, true, false, false));
809 
818  int set_jpeg (const std::string & key,
819  const unsigned char * value, size_t size,
820  const EvalSettings & settings =
821  EvalSettings (false, false, true, false, false));
822 
831  int set_file (const VariableReference & variable,
832  const unsigned char * value, size_t size,
833  const EvalSettings & settings =
834  EvalSettings (false, false, true, false, false));
835 
844  int set_jpeg (const VariableReference & variable,
845  const unsigned char * value, size_t size,
846  const EvalSettings & settings =
847  EvalSettings (false, false, true, false, false));
848 
857  int set_xml (const VariableReference & variable,
858  const char * value, size_t size,
859  const EvalSettings & settings =
860  EvalSettings (false, false, true, false, false));
861 
869  madara::knowledge::KnowledgeRecord retrieve_index (
870  const VariableReference & variable,
871  size_t index,
872  const KnowledgeReferenceSettings & settings =
873  EvalSettings (false, false, true, false, false));
874 
880  ssize_t write_file (const std::string & knowledge_key,
881  const std::string & filename);
882 
888  int read_policy (const std::string & policy_key,
889  const std::string & policy_file);
890 
899  std::string expand_statement (const std::string & statement);
900 
906  std::string debug_modifieds (void) const;
907 
908 #ifndef _MADARA_NO_KARL_
909 
917  compile (const std::string & expression);
918 
927  const std::string & expression,
928  const EvalSettings & settings =
929  EvalSettings ());
930 
939  CompiledExpression & expression,
940  const EvalSettings & settings =
941  EvalSettings ());
942 
952  const EvalSettings & settings =
953  EvalSettings ());
954 
965  const std::string & expression,
966  const WaitSettings & settings =
967  WaitSettings ());
968 
979  CompiledExpression & expression,
980  const WaitSettings & settings =
981  WaitSettings ());
982 
988  void define_function (const std::string & name,
990 
997  void define_function (const std::string & name,
998  knowledge::KnowledgeRecord (*func) (const char *, FunctionArguments &, Variables &));
999 
1000 #ifdef _MADARA_JAVA_
1001 
1006  void define_function (const std::string & name, jobject callable);
1007 #endif
1008 
1009 #ifdef _MADARA_PYTHON_CALLBACKS_
1010 
1015  void define_function (const std::string & name, boost::python::object callable);
1016 #endif
1017 
1023  void define_function (const std::string & name,
1024  const std::string & expression);
1025 
1031  void define_function (const std::string & name,
1032  const CompiledExpression & expression);
1033 
1034 #endif // _MADARA_NO_KARL_
1035 
1045  template<typename T,
1046  typename std::enable_if<std::is_integral<T>::value,
1047  void*>::type = nullptr>
1048  int set (const std::string & key,
1049  T value,
1050  const EvalSettings & settings =
1051  EvalSettings (false, false, true, false, false));
1052 
1063  template<typename T>
1064  int set_index (const std::string & key,
1065  size_t index, T&& value,
1066  const EvalSettings & settings =
1067  EvalSettings (false, false, true, false, false));
1068 
1079  int set (const std::string & key,
1081  uint32_t size,
1082  const EvalSettings & settings =
1083  EvalSettings (false, false, true, false, false));
1084 
1094  int set (const std::string & key,
1095  const std::vector <KnowledgeRecord::Integer> & value,
1096  const EvalSettings & settings =
1097  EvalSettings (false, false, true, false, false));
1098 
1108  int set (const std::string & key,
1109  std::vector <KnowledgeRecord::Integer> && value,
1110  const EvalSettings & settings =
1111  EvalSettings (false, false, true, false, false));
1112 
1120  int set (const std::string & key,
1121  const EvalSettings & settings =
1122  EvalSettings (false, false, true, false, false)) {
1123  return set (key, 1, settings);
1124  }
1125 
1135  template<typename T,
1136  typename std::enable_if<std::is_floating_point<T>::value,
1137  void*>::type = nullptr>
1138  int set (const std::string & key, T value,
1139  const EvalSettings & settings =
1140  EvalSettings (false, false, true, false, false));
1141 
1152  int set (const std::string & key,
1153  const double * value,
1154  uint32_t size,
1155  const EvalSettings & settings =
1156  EvalSettings (false, false, true, false, false));
1157 
1167  int set (const std::string & key,
1168  const std::vector <double> & value,
1169  const EvalSettings & settings =
1170  EvalSettings (false, false, true, false, false));
1171 
1181  int set (const std::string & key,
1182  std::vector <double> && value,
1183  const EvalSettings & settings =
1184  EvalSettings (false, false, true, false, false));
1185 
1195  int set (const std::string & key, const std::string & value,
1196  const EvalSettings & settings =
1197  EvalSettings (false, false, true, false, false));
1198 
1208  int set (const std::string & key, std::string && value,
1209  const EvalSettings & settings =
1210  EvalSettings (false, false, true, false, false));
1211 
1219  void set_quality (const std::string & key, uint32_t quality,
1220  const KnowledgeReferenceSettings & settings =
1221  KnowledgeReferenceSettings (false));
1222 
1232  std::string setup_unique_hostport (const std::string & host = "");
1233 
1234 #ifdef _USE_CID_
1235 
1239  void print_all_redeployment_results (std::ostream & output);
1240 
1245  void run_all (void);
1246 
1251  long start_latency (void);
1252 
1257  void print_my_latencies (std::ostream & output);
1258 
1263  void print_all_latencies (std::ostream & output);
1264 
1269  void print_all_summations (std::ostream & output);
1270 
1277  long vote (void);
1278 
1279 #endif // _USE_CID_
1280 
1285  madara::transport::TransportSettings & transport_settings (void);
1286 
1294  bool exists (const std::string & key,
1295  const KnowledgeReferenceSettings & settings =
1296  KnowledgeReferenceSettings (false)) const;
1297 
1305  bool exists (const VariableReference & variable,
1306  const KnowledgeReferenceSettings & settings =
1307  KnowledgeReferenceSettings (false)) const;
1308 
1315  int apply_modified (const EvalSettings & settings =
1316  EvalSettings ());
1317 
1323  int modify (const EvalSettings & settings =
1324  EvalSettings ());
1325 
1330  void print (unsigned int level = 0) const;
1331 
1337  void print_knowledge (unsigned int level = 0) const;
1338 
1347  void print (const std::string & statement,
1348  unsigned int level = 0) const;
1349 
1372  void to_string (std::string & target,
1373  const std::string & array_delimiter = ",",
1374  const std::string & record_delimiter = ";\n",
1375  const std::string & key_val_delimiter = "=") const;
1376 
1386  bool clear (const std::string & key,
1387  const KnowledgeReferenceSettings & settings =
1389 
1395  void clear (bool erase = false);
1396 
1400  void reset_checkpoint (void) const;
1401 
1405  void clear_map (void);
1406 
1412  void acquire (void);
1413 
1419  void release (void);
1420 
1428  size_t attach_transport (madara::transport::Base * transport);
1429 
1437  size_t attach_transport (const std::string & id,
1438  transport::TransportSettings & settings);
1439 
1446  size_t remove_transport (size_t index);
1447 
1454  ThreadSafeContext & get_context (void);
1455 
1460  int get_log_level (void);
1461 
1466  void attach_logger (logger::Logger & logger) const;
1467 
1472  logger::Logger & get_logger (void) const;
1473 
1478  void set_log_level (int level);
1479 
1484  std::string get_id (void);
1485 
1493  void get_matches (
1494  const std::string & prefix,
1495  const std::string & suffix,
1496  VariableReferences & matches);
1497 
1512  size_t to_vector (const std::string & subject,
1513  unsigned int start,
1514  unsigned int end,
1515  std::vector <KnowledgeRecord> & target);
1516 
1527  size_t to_map (const std::string & subject,
1528  std::map <std::string, knowledge::KnowledgeRecord> & target);
1529 
1546  size_t to_map (const std::string & prefix,
1547  const std::string & delimiter,
1548  const std::string & suffix,
1549  std::vector <std::string> & next_keys,
1550  std::map <std::string, knowledge::KnowledgeRecord> & result,
1551  bool just_keys = false);
1552 
1561  knowledge::KnowledgeMap to_map (const std::string & prefix) const;
1562 
1574  knowledge::KnowledgeMap to_map_stripped (const std::string &prefix) const;
1575 
1581  int64_t save_context (const std::string & filename) const;
1582 
1590  int64_t save_context (CheckpointSettings & settings) const;
1591 
1597  int64_t save_as_json (const std::string & filename) const;
1598 
1604  int64_t save_as_json (const CheckpointSettings & settings) const;
1605 
1611  int64_t save_as_karl (const std::string & filename) const;
1612 
1618  int64_t save_as_karl (const CheckpointSettings & settings) const;
1619 
1627  int64_t save_checkpoint (const std::string & filename,
1628  bool reset_modifieds = true);
1629 
1639  int64_t save_checkpoint (
1640  CheckpointSettings & settings) const;
1641 
1651  int64_t load_context (const std::string & filename,
1652  bool use_id = true,
1653  const KnowledgeUpdateSettings & settings =
1654  KnowledgeUpdateSettings (true, true, true, false));
1655 
1669  int64_t load_context (const std::string & filename,
1670  FileHeader & meta,
1671  bool use_id = true,
1672  const KnowledgeUpdateSettings & settings =
1673  KnowledgeUpdateSettings (true, true, true, false));
1674 
1683  int64_t load_context (CheckpointSettings & checkpoint_settings,
1684  const KnowledgeUpdateSettings & update_settings =
1685  KnowledgeUpdateSettings (true, true, true, false));
1686 
1691  void add_modifieds (const VariableReferences & modifieds) const;
1692 
1701  VariableReferences save_modifieds (void) const;
1702 
1710  int send_modifieds (
1711  const std::string & prefix = "KnowledgeBase::send_modifieds",
1712  const EvalSettings & settings =
1713  EvalSettings ());
1714 
1722  void clear_modifieds (void);
1723 
1724 
1728  void wait_for_change (void);
1729 
1737  void facade_for (ThreadSafeContext & target);
1738 
1739  private:
1740 
1743  std::shared_ptr <KnowledgeBaseImpl> impl_;
1744 
1747  };
1748 
1749  }
1750 }
1751 
1752 // include the inline functions
1753 #include "KnowledgeBase.inl"
1754 
1755 #endif // _MADARA_KNOWLEDGE_BASE_H
This class encapsulates an entry in a KnowledgeBase.
std::map< std::string, bool > CopySet
Typedef for set of copyable keys.
std::shared_ptr< std::vector< unsigned char > > take_binary(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, sharing with the internal one.
Defines a file header which is the default for KaRL checkpointing.
Definition: FileHeader.h:35
MADARA_Export int read_file(const std::string &filename, void *&buffer, size_t &size, bool add_zero_char=false)
Reads a file into a provided void pointer.
Definition: Utility.cpp:747
std::shared_ptr< std::vector< unsigned char > > share_binary(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
This class stores variables and their values for use by any entity needing state information in a thr...
std::shared_ptr< std::vector< unsigned char > > take_binary(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, sharing with the internal one.
Holds settings for checkpoints to load or save.
Provides knowledge logging services to files and terminals.
Definition: GlobalLogger.h:11
Holds basic transport settings.
std::shared_ptr< std::string > share_string(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
Optimized reference to a variable within the knowledge base.
Compiled, optimized KaRL logic.
std::vector< KnowledgeRecord > FunctionArguments
std::shared_ptr< std::vector< double > > take_doubles(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, sharing with the internal one.
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > take_integers(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, sharing with the internal one.
std::shared_ptr< KnowledgeBaseImpl > impl_
Pointer to actual implementation, i.e., the "bridge", which is reference counted to automate memory m...
std::shared_ptr< std::vector< unsigned char > > share_binary(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
std::shared_ptr< std::vector< double > > share_doubles(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
A multi-threaded logger for logging to one or more destinations.
Definition: Logger.h:88
std::shared_ptr< std::string > share_string(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
std::shared_ptr< std::string > take_string(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, while resetting this record to empty.
MADARA_Export ssize_t write_file(const std::string &filename, void *buffer, size_t size)
Writes a file with provided contents.
Definition: Utility.cpp:779
ThreadSafeContext * context_
A knowledge base can also be a facade for another knowledge base.
Holds settings requirements for knowledge, usually in copying.
void set_log_level(int level)
Sets the log level.
Definition: LogMacros.h:205
This class provides a distributed knowledge base to users.
Definition: KnowledgeBase.h:44
::std::map< std::string, KnowledgeRecord > KnowledgeMap
std::shared_ptr< std::vector< double > > share_doubles(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
An abstract base class defines a simple abstract implementation of an expression tree node...
Definition: ComponentNode.h:35
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > take_integers(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, sharing with the internal one.
std::shared_ptr< std::vector< double > > take_doubles(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, sharing with the internal one.
static constexpr struct madara::knowledge::tags::string_t string
int get_log_level(void)
Gets the log level.
Definition: LogMacros.h:214
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > share_integers(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
std::vector< VariableReference > VariableReferences
a vector of variable references
Encapsulates settings for an evaluation statement.
Definition: EvalSettings.h:26
MADARA_Export bool exists(const char *originator, uint64_t clock, uint32_t update_number, OriginatorFragmentMap &map)
Checks if a fragment already exists within a fragment map.
Provides functions and classes for the distributed knowledge base.
Settings for applying knowledge updates.
Copyright (c) 2015 Carnegie Mellon University.
Encapsulates settings for a wait statement.
Definition: WaitSettings.h:23
Settings for applying knowledge updates.
Base class from which all transports must be derived.
Definition: Transport.h:62
Provides an interface for external functions into the MADARA KaRL variable settings.
std::shared_ptr< std::vector< KnowledgeRecord::Integer > > share_integers(const std::string &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings()) const
Returns a shared_ptr, sharing with the internal one.
std::shared_ptr< std::string > take_string(const VariableReference &key, const KnowledgeReferenceSettings &settings=KnowledgeReferenceSettings())
Returns a shared_ptr, while resetting this record to empty.