Added C++ wrapper for comedi_get_buffer_contents().
authorFrank Mori Hess <fmhess@speakeasy.net>
Thu, 13 Nov 2008 14:17:15 +0000 (14:17 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Thu, 13 Nov 2008 14:17:15 +0000 (14:17 +0000)
c++/include/comedilib.hpp

index 16eeec97ef9b5bdca109b347bd17b53cca5854a8..a999ec40fe29922640c7139f48d9341f0819f508 100644 (file)
@@ -405,6 +405,19 @@ namespace comedi
                        }
                        return retval;
                }
+               unsigned get_buffer_contents() const
+               {
+                       int retval = comedi_get_buffer_contents(comedi_handle(), index());
+                       if(retval < 0)
+                       {
+                               std::ostringstream message;
+                               message << __PRETTY_FUNCTION__ << ": comedi_get_buffer_contents() failed.";
+                               std::cerr << message.str() << std::endl;
+                               comedi_perror("comedi_get_buffer_contents");
+                               throw std::runtime_error(message.str());
+                       }
+                       return retval;
+               }
                void get_clock_source(unsigned *clock, unsigned *period_ns) const
                {
                        int retval = comedi_get_clock_source(comedi_handle(), index(), clock, period_ns);