]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[65-libyang-generic] Addressed comments about watcher.h
authorFrancis Dupont <fdupont@isc.org>
Wed, 12 Sep 2018 10:16:47 +0000 (12:16 +0200)
committerFrancis Dupont <fdupont@isc.org>
Wed, 12 Sep 2018 10:16:47 +0000 (12:16 +0200)
src/lib/yang/sysrepo_connection.h
src/lib/yang/watcher.cc
src/lib/yang/watcher.h

index b17e99e7bcda1f087a1a372bc4ab87c40ec56576..60e83d939b98f2d7dbbb024bad5f34803f61f092 100644 (file)
@@ -26,7 +26,7 @@ public:
     // @brief Constructor.
     SysrepoConnection();
 
-    // @brief Destructor.
+    // @brief Destructor (closing connection).
     virtual ~SysrepoConnection();
 
     // @brief Get a connection and a session.
index e4b816eaea8150f7e800aa5d5547b9a39c0187fe..4c96a3920e73f78ca2c97f9a20100e2aa8873c4f 100644 (file)
@@ -21,8 +21,8 @@ Watcher::Watcher(SysrepoConnection &connection, const string &xpath)
 Watcher::~Watcher() {
 }
 
-string
-Watcher::getXPath() {
+const string&
+Watcher::getXPath() const {
     return (xpath_);
 }
 
index 7e86b1e89bc7132a4636ca10bfb7f49c72af9338..7320475092a910c21b605e8942ae4e7047f8f0ba 100644 (file)
@@ -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<Watcher> WatcherPtr;
 
 }  // namespace isc::yang