From: Francis Dupont Date: Wed, 12 Sep 2018 10:16:47 +0000 (+0200) Subject: [65-libyang-generic] Addressed comments about watcher.h X-Git-Tag: 65-libyang-control-socket_base~1^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6eb662297d7c2cc0e8a1ef0148726dc662e46dcd;p=thirdparty%2Fkea.git [65-libyang-generic] Addressed comments about watcher.h --- diff --git a/src/lib/yang/sysrepo_connection.h b/src/lib/yang/sysrepo_connection.h index b17e99e7bc..60e83d939b 100644 --- a/src/lib/yang/sysrepo_connection.h +++ b/src/lib/yang/sysrepo_connection.h @@ -26,7 +26,7 @@ public: // @brief Constructor. SysrepoConnection(); - // @brief Destructor. + // @brief Destructor (closing connection). virtual ~SysrepoConnection(); // @brief Get a connection and a session. diff --git a/src/lib/yang/watcher.cc b/src/lib/yang/watcher.cc index e4b816eaea..4c96a3920e 100644 --- a/src/lib/yang/watcher.cc +++ b/src/lib/yang/watcher.cc @@ -21,8 +21,8 @@ Watcher::Watcher(SysrepoConnection &connection, const string &xpath) Watcher::~Watcher() { } -string -Watcher::getXPath() { +const string& +Watcher::getXPath() const { return (xpath_); } diff --git a/src/lib/yang/watcher.h b/src/lib/yang/watcher.h index 7e86b1e89b..7320475092 100644 --- a/src/lib/yang/watcher.h +++ b/src/lib/yang/watcher.h @@ -23,34 +23,48 @@ namespace yang { /// JSON that can be sent over control channel and understood by Kea. class Watcher { public: - // Constructor (requires xpath to install a callback) - Watcher(SysrepoConnection &connection, const std::string &xpath); + // @brief Constructor (requires xpath to install a callback). + // + // @param connection The sysrepo connection. + // @param xpath The xpath to watch to. + Watcher(SysrepoConnection& connection, const std::string& xpath); + // @brief Destructor (doing nothing). virtual ~Watcher(); - virtual std::string getXPath(); + // @brief Get the xpath. + // @return The xpath to watch to. + virtual const std::string& getXPath() const; // This method will be called when the callback returns. // Need to figure out the type used. - void setYangData(void *data); + // + // @param data The yang data. + void setYangData(void* data); - // This method translates Netconf data to JSON format + // @brief This method translates Netconf data to JSON format // understood by Kea. virtual void translate() = 0; - // Once setYangData is called, + // @brief Get JSON once setYangData is called, + // @return The JSON representation of the yang data. isc::data::ElementPtr getJSON(); protected: - std::string xpath_; + // @brief The xpath to watch to. + const std::string& xpath_; - void *netconf_data_; + // @brief The yang data. + void* netconf_data_; + // @brief The JSON representation of the yang data. isc::data::ElementPtr json_; + // @brief The sysrepo connection. SysrepoConnection &connection_; }; +/// @brief The type of shared pointers to watcher objects. typedef boost::shared_ptr WatcherPtr; } // namespace isc::yang