RTXI  2.4
The Real-Time eXperiment Interface Documentation
atomic_fifo_tests.h
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, Weill Cornell Medical College
4 
5  This program 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 of the License, or
8  (at your option) any later version.
9 
10  This program 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 program. If not, see <http://www.gnu.org/licenses/>.
17 
18  */
19 
20 #ifndef ATOMIC_FIFO_TESTS_H
21 #define ATOMIC_FIFO_TESTS_H
22 
23 #include <gtest/gtest.h>
24 #include <atomic_fifo.h>
25 
26 // C++20 has a semaphore library, but can't use it just yet as it's too new and might not
27 // work for current users of RTXI testing facilities. Use condition variable and mutex instead.
28 #include <condition_variable>
29 #include <mutex>
30 
31 // Define all fixtures for testing purposes
32 class AtomicFifoTest : public ::testing::Test
33 {
34 protected:
37 
39 };
40 
41 // Need wrappers on fifo methods for threadding purposes
42 void send(std::mutex &m, std::condition_variable &cv, std::atomic<bool> &ready, AtomicFifo *fifo, char *message, size_t size);
43 void receive(std::mutex &m, std::condition_variable &cv, std::atomic<bool> &ready, AtomicFifo *fifo, char *output, size_t size);
44 
45 #endif
receive
void receive(std::mutex &m, std::condition_variable &cv, std::atomic< bool > &ready, AtomicFifo *fifo, char *output, size_t size)
Definition: atomic_fifo_tests.cpp:81
AtomicFifoTest::fifo
AtomicFifo * fifo
Definition: atomic_fifo_tests.h:38
send
void send(std::mutex &m, std::condition_variable &cv, std::atomic< bool > &ready, AtomicFifo *fifo, char *message, size_t size)
Definition: atomic_fifo_tests.cpp:73
AtomicFifoTest::~AtomicFifoTest
~AtomicFifoTest()
Definition: atomic_fifo_tests.h:36
AtomicFifo
Lockfree SINGLE producer / SINGLE consumer FIFO.
Definition: atomic_fifo.h:33
AtomicFifoTest
Definition: atomic_fifo_tests.h:32
AtomicFifoTest::AtomicFifoTest
AtomicFifoTest()
Definition: atomic_fifo_tests.h:35
atomic_fifo.h