knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
ImportHierarchy.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_IMPORT_HIERARCHY_H
7 #define KNOWROB_IMPORT_HIERARCHY_H
8 
9 #include "string"
10 #include "set"
11 #include "map"
12 #include "CurrentGraph.h"
13 
14 namespace knowrob {
20  class ImportHierarchy {
21  public:
25  static constexpr std::string_view ORIGIN_ANY = "any";
29  static constexpr std::string_view ORIGIN_SYSTEM = "system";
34  static constexpr std::string_view ORIGIN_SESSION = "session";
38  static constexpr std::string_view ORIGIN_USER = "user";
42  static constexpr std::string_view ORIGIN_REASONER = "reasoner";
46  static constexpr std::string_view ORIGIN_TEST = "test";
47 
49 
54  bool isCurrentGraph(std::string_view graphName) const;
55 
60  static bool isReservedOrigin(std::string_view origin);
61 
65  void clear() { graphs_.clear(); }
66 
72 
76  const auto &defaultGraph() const { return defaultGraph_; }
77 
82  void addCurrentGraph(std::string_view graphName);
83 
88  void removeCurrentGraph(std::string_view graphName);
89 
95  void addDirectImport(std::string_view importerGraphName, std::string_view importedGraphName);
96 
101  const std::set<CurrentGraph *> &getImports(std::string_view graphName);
102 
103  protected:
104  std::map<std::string_view, std::unique_ptr<CurrentGraph>> graphs_;
106 
107  CurrentGraph& getCurrentGraph(std::string_view name);
108 
110 
112  };
113 
114 } // knowrob
115 
116 #endif //KNOWROB_IMPORT_HIERARCHY_H
void addCurrentGraph(std::string_view graphName)
void addDirectImport(std::string_view importerGraphName, std::string_view importedGraphName)
bool isSystemOrigin(CurrentGraph &graph)
std::map< std::string_view, std::unique_ptr< CurrentGraph > > graphs_
bool isSessionOrigin(CurrentGraph &graph)
bool isCurrentGraph(std::string_view graphName) const
static constexpr std::string_view ORIGIN_TEST
const auto & defaultGraph() const
void setDefaultGraph(std::string_view defaultGraph)
static constexpr std::string_view ORIGIN_SESSION
static constexpr std::string_view ORIGIN_USER
static constexpr std::string_view ORIGIN_REASONER
static bool isReservedOrigin(std::string_view origin)
void removeCurrentGraph(std::string_view graphName)
const std::set< CurrentGraph * > & getImports(std::string_view graphName)
static constexpr std::string_view ORIGIN_SYSTEM
static constexpr std::string_view ORIGIN_ANY
CurrentGraph & getCurrentGraph(std::string_view name)
TermRule & string()
Definition: terms.cpp:63