RTXI  3.0.0
The Real-Time eXperiment Interface Reference Manual
fifo.hpp
Go to the documentation of this file.
1 /*
2  The Real-Time eXperiment Interface (RTXI)
3  Copyright (C) 2011 Georgia Institute of Technology, University of Utah,
4  Will Cornell Medical College
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 */
20 
21 #ifndef FIFO_H
22 #define FIFO_H
23 
24 #include <memory>
25 
26 #include <sys/types.h>
27 
28 namespace RT::OS
29 {
45 class Fifo
46 {
47 public:
48  Fifo() = default; // default constructor
49  Fifo(const Fifo& fifo) = delete; // copy constructor
50  Fifo& operator=(const Fifo& fifo) = delete; // copy assignment operator
51  Fifo(Fifo&&) = default; // move constructor
52  Fifo& operator=(Fifo&&) = default; // move assignment operator
53  virtual ~Fifo() = default;
54 
64  virtual int64_t read(void* buf, size_t data_size) = 0;
65 
74  virtual int64_t write(void* buf, size_t data_size) = 0;
75 
85  virtual int64_t readRT(void* buf, size_t data_size) = 0;
86 
95  virtual int64_t writeRT(void* buf, size_t data_size) = 0;
96 
102  virtual size_t getCapacity() = 0;
103 
111  virtual void poll() = 0;
112 
116  virtual void close() = 0;
117 };
118 
129 int getFifo(std::unique_ptr<Fifo>& fifo, size_t fifo_size);
130 } // namespace RT::OS
131 
132 #endif /* FIFO_H */
virtual int64_t writeRT(void *buf, size_t data_size)=0
Fifo()=default
virtual void close()=0
Fifo(Fifo &&)=default
virtual int64_t write(void *buf, size_t data_size)=0
virtual int64_t readRT(void *buf, size_t data_size)=0
Fifo & operator=(const Fifo &fifo)=delete
virtual ~Fifo()=default
Fifo(const Fifo &fifo)=delete
virtual void poll()=0
virtual int64_t read(void *buf, size_t data_size)=0
virtual size_t getCapacity()=0
Fifo & operator=(Fifo &&)=default
Definition: fifo.cpp:31
int getFifo(std::unique_ptr< Fifo > &fifo, size_t fifo_size)
Definition: fifo.cpp:194