sysrepo  1.4.70
YANG datastore
Sysrepo.hpp
Go to the documentation of this file.
1 
23 #ifndef SYSREPO_H
24 #define SYSREPO_H
25 
26 #include <iostream>
27 #include <memory>
28 #include <stdexcept>
29 
30 #include "Internal.hpp"
31 
32 #include "sysrepo.h"
33 
34 namespace sysrepo {
35 
41 class Iter_Change;
42 class Session;
43 class Subscribe;
44 class Connection;
45 class Operation;
46 class Errors;
47 class Data;
48 class Val;
49 class Vals_Holder;
50 class Vals;
51 class Xpath_Ctx;
52 class Logs;
53 class Change;
54 class Tree_Change;
55 class Callback;
56 class Deleter;
57 
58 using S_Iter_Change = std::shared_ptr<Iter_Change>;
59 using S_Session = std::shared_ptr<Session>;
60 using S_Subscribe = std::shared_ptr<Subscribe>;
61 using S_Connection = std::shared_ptr<Connection>;
62 using S_Operation = std::shared_ptr<Operation>;
63 using S_Errors = std::shared_ptr<Errors>;
64 using S_Data = std::shared_ptr<Data>;
65 using S_Val = std::shared_ptr<Val>;
66 using S_Vals_Holder = std::shared_ptr<Vals_Holder>;
67 using S_Vals = std::shared_ptr<Vals>;
68 using S_Xpath_Ctx = std::shared_ptr<Xpath_Ctx>;
69 using S_Logs = std::shared_ptr<Logs>;
70 using S_Change = std::shared_ptr<Change>;
71 using S_Tree_Change = std::shared_ptr<Tree_Change>;
72 using S_Callback = std::shared_ptr<Callback>;
73 using S_Deleter = std::shared_ptr<Deleter>;
74 
75 /* this is a workaround for python not recognizing
76  * enum's in function default values */
77 static const int DS_RUNNING = SR_DS_RUNNING;
78 static const int EDIT_DEFAULT = SR_EDIT_DEFAULT;
79 static const int CONN_DEFAULT = SR_CONN_DEFAULT;
80 static const int SUBSCR_DEFAULT = SR_SUBSCR_DEFAULT;
81 static const int OPER_DEFAULT = SR_OPER_DEFAULT;
82 
83 #ifdef SWIG
84 // https://github.com/swig/swig/issues/1158
85 void throw_exception (int error);
86 #else
87 void throw_exception [[noreturn]] (int error);
88 #endif
89 
91 const char *get_repo_path();
93 uint32_t connection_count();
94 
99 class sysrepo_exception : public std::runtime_error
100 {
101 public:
103  virtual ~sysrepo_exception() override;
105 private:
106  sr_error_t m_error_code;
107 };
108 
113 class Logs
114 {
115 public:
116  Logs();
117  ~Logs();
119  void set_stderr(sr_log_level_t log_level);
121  void set_syslog(const char *app_name, sr_log_level_t log_level);
122 };
123 
125 }
126 #endif
sysrepo::sysrepo_exception::~sysrepo_exception
virtual ~sysrepo_exception() override
sysrepo::S_Deleter
std::shared_ptr< Deleter > S_Deleter
Definition: Sysrepo.hpp:73
sysrepo.h
public API sysrepo header
Internal.hpp
Sysrepo class header for internal C++ classes.
sysrepo::S_Tree_Change
std::shared_ptr< Tree_Change > S_Tree_Change
Definition: Sysrepo.hpp:71
sysrepo::Logs::set_stderr
void set_stderr(sr_log_level_t log_level)
sysrepo::S_Subscribe
std::shared_ptr< Subscribe > S_Subscribe
Definition: Sysrepo.hpp:60
SR_SUBSCR_DEFAULT
@ SR_SUBSCR_DEFAULT
Default behavior of the subscription. In case of sr_module_change_subscribe call it means that:
Definition: sysrepo.h:1131
sysrepo::Logs::Logs
Logs()
sysrepo
Definition: Connection.hpp:35
sysrepo::sysrepo_exception::error_code
sr_error_t error_code() const
sysrepo::throw_exception
void throw_exception(int error)
sysrepo::S_Vals_Holder
std::shared_ptr< Vals_Holder > S_Vals_Holder
Definition: Sysrepo.hpp:66
sysrepo::S_Errors
std::shared_ptr< Errors > S_Errors
Definition: Sysrepo.hpp:63
sysrepo::S_Iter_Change
std::shared_ptr< Iter_Change > S_Iter_Change
Definition: Sysrepo.hpp:58
sysrepo::S_Session
std::shared_ptr< Session > S_Session
Definition: Sysrepo.hpp:59
sysrepo::S_Change
std::shared_ptr< Change > S_Change
Definition: Sysrepo.hpp:70
sysrepo::S_Val
std::shared_ptr< Val > S_Val
Definition: Sysrepo.hpp:65
sr_log_level_t
sr_log_level_t
Log levels used to determine if message of certain severity should be printed.
Definition: sysrepo.h:82
sysrepo::Logs::~Logs
~Logs()
sysrepo::S_Operation
std::shared_ptr< Operation > S_Operation
Definition: Sysrepo.hpp:62
sysrepo::Logs
Class for wrapping ref sr_log_level_t.
Definition: Sysrepo.hpp:114
sysrepo::S_Callback
std::shared_ptr< Callback > S_Callback
Definition: Sysrepo.hpp:72
sysrepo::sysrepo_exception
Class for wrapping sr_error_t.
Definition: Sysrepo.hpp:100
sysrepo::connection_count
uint32_t connection_count()
sysrepo::S_Logs
std::shared_ptr< Logs > S_Logs
Definition: Sysrepo.hpp:69
SR_DS_RUNNING
@ SR_DS_RUNNING
Definition: sysrepo.h:200
sysrepo::Logs::set_syslog
void set_syslog(const char *app_name, sr_log_level_t log_level)
SR_EDIT_DEFAULT
@ SR_EDIT_DEFAULT
Definition: sysrepo.h:833
sysrepo::S_Data
std::shared_ptr< Data > S_Data
Definition: Sysrepo.hpp:64
sysrepo::get_repo_path
const char * get_repo_path()
sysrepo::S_Xpath_Ctx
std::shared_ptr< Xpath_Ctx > S_Xpath_Ctx
Definition: Sysrepo.hpp:68
sysrepo::S_Vals
std::shared_ptr< Vals > S_Vals
Definition: Sysrepo.hpp:67
sr_error_t
enum sr_error_e sr_error_t
Sysrepo error codes.
sysrepo::sysrepo_exception::sysrepo_exception
sysrepo_exception(const sr_error_t error_code)
sysrepo::S_Connection
std::shared_ptr< Connection > S_Connection
Definition: Sysrepo.hpp:61
SR_CONN_DEFAULT
@ SR_CONN_DEFAULT
Definition: sysrepo.h:179
SR_OPER_DEFAULT
@ SR_OPER_DEFAULT
Definition: sysrepo.h:697