uh the fucking tests are fucking compiling :sigh: ♿ fuck itgit add *git add *git add *git add *git add *
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* BlockingQueue.cpp
|
||||
*
|
||||
* Created on: Jun 15, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||
*/
|
||||
|
||||
#include "BlockingQueue.h"
|
||||
|
||||
template <typename T>
|
||||
void BlockingQueue<T>::push(T const& value)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->d_mutex);
|
||||
p_queue.push(value);
|
||||
this->d_condition.notify_one();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T BlockingQueue<T>::pop()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->d_mutex);
|
||||
this->d_condition.wait(lock, [=]{ return !this->p_queue.empty(); });
|
||||
T rc = *this->p_queue.end();
|
||||
this->p_queue.pop();
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* BlockingQueue.hpp
|
||||
*
|
||||
* Created on: May 17, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||
*/
|
||||
|
||||
#ifndef SRC_UTILITIES_BLOCKINGQUEUE_H_
|
||||
#define SRC_UTILITIES_BLOCKINGQUEUE_H_
|
||||
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <boost/heap/priority_queue.hpp>
|
||||
|
||||
using namespace boost;
|
||||
|
||||
template <typename T>
|
||||
class BlockingQueue
|
||||
{
|
||||
private:
|
||||
std::mutex d_mutex;
|
||||
std::condition_variable d_condition;
|
||||
heap::priority_queue<T, heap::stable<true>> p_queue;
|
||||
|
||||
public:
|
||||
void push(T const& value);
|
||||
|
||||
T pop();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* SRC_UTILITIES_BLOCKINGQUEUE_H_ */
|
||||
45
FlippR-Driver/src/utilities/BlockingQueue.hpp
Normal file
45
FlippR-Driver/src/utilities/BlockingQueue.hpp
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* BlockingQueue.hpp
|
||||
*
|
||||
* Created on: May 17, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||
*/
|
||||
|
||||
#ifndef SRC_UTILITIES_BLOCKINGQUEUE_HPP_
|
||||
#define SRC_UTILITIES_BLOCKINGQUEUE_HPP_
|
||||
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <boost/heap/priority_queue.hpp>
|
||||
|
||||
using namespace boost;
|
||||
|
||||
template <typename T>
|
||||
class BlockingQueue
|
||||
{
|
||||
private:
|
||||
std::mutex d_mutex;
|
||||
std::condition_variable d_condition;
|
||||
heap::priority_queue<T, heap::stable<true>> p_queue;
|
||||
|
||||
public:
|
||||
void push(T const& value)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->d_mutex);
|
||||
p_queue.push(value);
|
||||
this->d_condition.notify_one();
|
||||
}
|
||||
|
||||
T pop()
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->d_mutex);
|
||||
this->d_condition.wait(lock, [=]{ return !this->p_queue.empty(); });
|
||||
T rc = *this->p_queue.end();
|
||||
this->p_queue.pop();
|
||||
return rc;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* SRC_UTILITIES_BLOCKINGQUEUE_HPP_ */
|
||||
@@ -7,17 +7,17 @@
|
||||
|
||||
#include "GPIOInterface.h"
|
||||
|
||||
#include "../lib/wiringPi/wiringPi.h"
|
||||
//#include "../lib/wiringPi/wiringPi.h"
|
||||
#include "../lib/json/json.hpp"
|
||||
|
||||
|
||||
static void GPIOInterface::write_pin(char address, char data)
|
||||
void GPIOInterface::write_pin(char address, char data)
|
||||
{
|
||||
digitalWrite(address, data);
|
||||
//digitalWrite(address, data);
|
||||
}
|
||||
|
||||
|
||||
static bool GPIOInterface::read_pin(char address)
|
||||
bool GPIOInterface::read_pin(char address)
|
||||
{
|
||||
return digitalRead(address);
|
||||
//return digitalRead(address);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,7 @@
|
||||
class GPIOInterface
|
||||
{
|
||||
public:
|
||||
GPIOInterface();
|
||||
virtual ~GPIOInterface();
|
||||
virtual ~GPIOInterface() {};
|
||||
|
||||
static void write_pin(char address, char data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user