MADARA  3.1.8
Files.h
Go to the documentation of this file.
1 #ifndef _MADARA_KNOWLEDGE_BASE_FILES_H_
2 #define _MADARA_KNOWLEDGE_BASE_FILES_H_
3 
11 #include <string>
12 #include "ace/Mem_Map.h"
14 #include "madara/MADARA_export.h"
15 
16 namespace madara
17 {
18  namespace knowledge
19  {
24  class Files
25  {
26  public:
31  Files (ThreadSafeContext & map);
32 
38  MADARA_Export int read_file (const std::string & knowledge_key,
39  const std::string & filename);
40 
47  MADARA_Export int read_file (const char * filename, ACE_Mem_Map & mem_map);
48 
54  MADARA_Export ssize_t write_file (const std::string & knowledge_key,
55  const std::string & filename);
56 
64  MADARA_Export ssize_t write_file (const char * filename,
65  void *& buffer, size_t & size);
66 
67 
73  MADARA_Export int read_policy (const std::string & policy_key,
74  const std::string & policy_file);
75 
82  MADARA_Export int shape_file (const std::string & source_key,
83  const std::string & target_key,
84  const std::string & policy_key);
85 
86  private:
87  // folder to store files into
88  const static std::string files_folder_;
89 
90  // folder to store policies into
92 
93  // handle to the knowledge base
95  };
96  }
97 }
98 
99 #endif
ThreadSafeContext & map_
Definition: Files.h:94
static const std::string files_folder_
Definition: Files.h:88
MADARA_Export int read_policy(const std::string &policy_key, const std::string &policy_file)
Read a policy into the knowledge base.
Definition: Files.cpp:207
static const std::string policies_folder_
Definition: Files.h:91
MADARA_Export int shape_file(const std::string &source_key, const std::string &target_key, const std::string &policy_key)
Shape a file according to a shaping policy.
Definition: Files.cpp:21
MADARA_Export int read_file(const std::string &knowledge_key, const std::string &filename)
Read a file into the knowledge base.
Definition: Files.cpp:43
This class provides file repo capabilities to the knowledge base.
Definition: Files.h:24
This class stores variables and their values for use by any entity needing state information in a thr...
Files(ThreadSafeContext &map)
Constructor.
Definition: Files.cpp:14
MADARA_Export ssize_t write_file(const std::string &knowledge_key, const std::string &filename)
Write a file from the knowledge base to a specified location.
Definition: Files.cpp:111
static constexpr struct madara::knowledge::tags::string_t string
Provides functions and classes for the distributed knowledge base.
Copyright (c) 2015 Carnegie Mellon University.