some important hanges
This commit is contained in:
@@ -5,6 +5,25 @@
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,21 +23,9 @@ private:
|
||||
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();
|
||||
}
|
||||
void push(T const& value);
|
||||
|
||||
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;
|
||||
}
|
||||
T pop();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,19 @@
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert, Rafael Vinci, Dr. Franca Rupprecht
|
||||
*/
|
||||
|
||||
#include "GPIOInterface.h"
|
||||
|
||||
#include "../lib/wiringPi/wiringPi.h"
|
||||
#include "../lib/json/json.hpp"
|
||||
|
||||
|
||||
static void GPIOInterface::write_pin(char address, char data)
|
||||
{
|
||||
digitalWrite(address, data);
|
||||
}
|
||||
|
||||
|
||||
static bool GPIOInterface::read_pin(char address)
|
||||
{
|
||||
return digitalRead(address);
|
||||
}
|
||||
|
||||
@@ -16,24 +16,15 @@
|
||||
#include <fstream>
|
||||
#include "config.h"
|
||||
|
||||
#include "../lib/wiringPi/wiringPi.h"
|
||||
#include "../lib/json/json.hpp"
|
||||
|
||||
class GPIOInterface
|
||||
{
|
||||
public:
|
||||
GPIOInterface();
|
||||
virtual ~GPIOInterface();
|
||||
|
||||
static void write_pin(char address, char data)
|
||||
{
|
||||
digitalWrite(address, data);
|
||||
}
|
||||
static void write_pin(char address, char data);
|
||||
|
||||
static bool read_pin(char address)
|
||||
{
|
||||
return digitalRead(address);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user