bindings: cxx: rename line_bulk::add() to line_bulk::append()
authorBartosz Golaszewski <bartekgola@gmail.com>
Tue, 27 Feb 2018 12:41:46 +0000 (13:41 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Tue, 27 Feb 2018 12:41:46 +0000 (13:41 +0100)
This routine adds the line at the end of the internal list of lines.
Rename it to append() in case we ever want to introduce prepend().

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
bindings/cxx/chip.cpp
bindings/cxx/gpiod.hpp
bindings/cxx/line_bulk.cpp

index 7d4d80beead0b8f19484d4f6881e7fbdba8bfa85..43b411d49dd2bb466d8cefcb1f6ccfc97f0ba8d9 100644 (file)
@@ -144,7 +144,7 @@ line_bulk chip::get_lines(const ::std::vector<unsigned int>& offsets) const
        line_bulk lines;
 
        for (auto& it: offsets)
-               lines.add(this->get_line(it));
+               lines.append(this->get_line(it));
 
        return ::std::move(lines);
 }
@@ -154,7 +154,7 @@ line_bulk chip::get_all_lines(void) const
        line_bulk lines;
 
        for (unsigned int i = 0; i < this->num_lines(); i++)
-               lines.add(this->get_line(i));
+               lines.append(this->get_line(i));
 
        return ::std::move(lines);
 }
@@ -164,7 +164,7 @@ line_bulk chip::find_lines(const ::std::vector<::std::string>& names) const
        line_bulk lines;
 
        for (auto& it: names)
-               lines.add(this->find_line(it));
+               lines.append(this->find_line(it));
 
        return ::std::move(lines);
 }
index ff46f264a95423413390526155289540af128fdc..032cb512257a890e3c5c07842b6cee32601f4827 100644 (file)
@@ -560,7 +560,7 @@ public:
         * @note The new line must be owned by the same chip as all the other
         *       lines already held by this line_bulk object.
         */
-       GPIOD_API void add(const line& new_line);
+       GPIOD_API void append(const line& new_line);
 
        /**
         * @brief Get the line at given offset.
index 6f0d08f58b3a646286e3feb953b704e0a212b3e8..9937a4918c0f53bcd3a42f7986fb07f5fcdea806 100644 (file)
@@ -55,10 +55,10 @@ line_bulk::line_bulk(const ::std::vector<line>& lines)
        this->_m_bulk.reserve(lines.size());
 
        for (auto& it: lines)
-               this->add(it);
+               this->append(it);
 }
 
-void line_bulk::add(const line& new_line)
+void line_bulk::append(const line& new_line)
 {
        if (!new_line)
                throw ::std::logic_error("line_bulk cannot hold empty line objects");
@@ -199,7 +199,7 @@ line_bulk line_bulk::event_wait(const ::std::chrono::nanoseconds& timeout) const
                                          "error polling for events");
        } else if (rv > 0) {
                for (unsigned int i = 0; i < event_bulk.num_lines; i++)
-                       ret.add(line(event_bulk.lines[i], this->_m_bulk[i].get_chip()));
+                       ret.append(line(event_bulk.lines[i], this->_m_bulk[i].get_chip()));
        }
 
        return ::std::move(ret);