Continue implementing the FIFO.
authorbruceperens <bruceperens@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 22 Jan 2014 05:08:11 +0000 (05:08 +0000)
committerbruceperens <bruceperens@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 22 Jan 2014 05:08:11 +0000 (05:08 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1389 01035d8c-6547-0410-b346-abe4f91aad63

freedv-server/CMakeLists.txt
freedv-server/source/drivers.h
freedv-server/source/fifo.cpp [new file with mode: 0644]

index 35f2369be82624d7259da2da0dd85994f32e3795..fac3274d47188fa0fe056a401b9d923a9e29ff4f 100644 (file)
@@ -108,6 +108,7 @@ set(Compile.sources
   source/codec_noop.cpp
   source/driver_manager.cpp
   source/event_handler.cpp
+  source/fifo.cpp
   source/interfaces.cpp
   source/io_device.cpp
   source/keying.cpp
index c558e771b99cba9b25c5871345b8a4ce70871891..0a5cf5e9b814c607262bc0970876a86d7f6f61e2 100644 (file)
@@ -23,7 +23,7 @@ namespace FreeDV {
   /// Not thread-safe on its own, you must have a mutex for access to it.
   /// Written to avoid STL templates, Boost, etc. in order to keep down the
   /// size of the embedded version of this program. 
-  class Fifo {
+  class FIFO {
   private:
     char *             buffer;
     char *             buffer_end;
@@ -32,14 +32,14 @@ namespace FreeDV {
     const char *       out;
 
     void               out_overrun(std::size_t length) const;
-    void               reorder(std::size_t length);
+    char *             reorder(std::size_t length);
 
   public:
-    /// Create the Fifo object.
+    /// Create the FIFO object.
     /// \param length The size of the fifo, in bytes.
-                       Fifo(std::size_t length);
+                       FIFO(std::size_t length);
 
-                       ~Fifo();
+                       ~FIFO();
 
     /// Return the address of an incoming data buffer of the requested size.
     /// Throws an error if we run the buffer out of space. Well-behaved code
@@ -54,8 +54,9 @@ namespace FreeDV {
                          const char * io_end = in + io_length;
 
                          if ( io_end >= buffer_end )
-                            reorder(io_length);
-                         return in;
+                            return reorder(io_length);
+                         else
+                           return in;
                        }
 
     /// Complete the I/O after incoming_buffer().
diff --git a/freedv-server/source/fifo.cpp b/freedv-server/source/fifo.cpp
new file mode 100644 (file)
index 0000000..7ab06e6
--- /dev/null
@@ -0,0 +1,14 @@
+#include "drivers.h"
+
+namespace FreeDV {
+  char *
+  FIFO::reorder(std::size_t size)
+  {
+    return 0;
+  }
+
+  void
+  FIFO::out_overrun(std::size_t size) const
+  {
+  }
+}