GNU Radio's FOSPHOR Package

fifo.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2013-2014 Sylvain Munaut <tnt@246tNt.com>
4 *
5 * This is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3, or (at your option)
8 * any later version.
9 *
10 * This software is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this software; see the file COPYING. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street,
18 * Boston, MA 02110-1301, USA.
19 */
20
21#ifndef INCLUDED_GR_FOSPHOR_FIFO_H
22#define INCLUDED_GR_FOSPHOR_FIFO_H
23
24#include <gnuradio/fosphor/api.h>
25
26#include <gnuradio/gr_complex.h>
27#include <gnuradio/thread/thread.h>
28
29 namespace gr {
30 namespace fosphor {
31
32 class GR_FOSPHOR_API fifo
33 {
34 private:
35 gr_complex *d_buf;
36 int d_len;
37 int d_rp;
38 int d_wp;
39
40 thread::mutex d_mutex;
41 thread::condition_variable d_cond_empty;
42 thread::condition_variable d_cond_full;
43
44 public:
45 fifo(int length);
46 ~fifo();
47
48 int free();
49 int used();
50
51 int write_max_size();
52 gr_complex *write_prepare(int size, bool wait=true);
53 void write_commit(int size);
54
55 int read_max_size();
56 gr_complex *read_peek(int size, bool wait=true);
57 void read_discard(int size);
58 };
59
60 } // namespace fosphor
61} // namespace gr
62
63#endif /* INCLUDED_GR_FOSPHOR_FIFO_H */
api.h
GR_FOSPHOR_API
#define GR_FOSPHOR_API
Definition: api.h:30
gr::fosphor::fifo
Definition: fifo.h:33
gr::fosphor::fifo::write_max_size
int write_max_size()
gr::fosphor::fifo::read_max_size
int read_max_size()
gr::fosphor::fifo::free
int free()
gr::fosphor::fifo::write_commit
void write_commit(int size)
gr::fosphor::fifo::used
int used()
gr::fosphor::fifo::read_peek
gr_complex * read_peek(int size, bool wait=true)
gr::fosphor::fifo::~fifo
~fifo()
gr::fosphor::fifo::fifo
fifo(int length)
gr::fosphor::fifo::write_prepare
gr_complex * write_prepare(int size, bool wait=true)
gr::fosphor::fifo::read_discard
void read_discard(int size)
gr
Definition: base_sink_c.h:30
fosphor
Definition: private.h:44