42 lines
640 B
C++
42 lines
640 B
C++
//
|
|
// SQLHandler.hpp
|
|
// DB_Track
|
|
//
|
|
// Created by Baranyai David on 2018. 10. 13..
|
|
//
|
|
|
|
#ifndef SQLHandler_hpp
|
|
#define SQLHandler_hpp
|
|
|
|
#include <stdio.h>
|
|
#include <iostream>
|
|
#include <mysql.h>
|
|
#include <vector>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
struct Hit
|
|
{
|
|
unsigned int channel_id;
|
|
unsigned int elapsed_time;
|
|
unsigned int amplitude_peak;
|
|
};
|
|
|
|
class SQLHandler
|
|
{
|
|
public:
|
|
SQLHandler();
|
|
~SQLHandler();
|
|
|
|
std::vector<Hit> QueryNext();
|
|
void SetRange(unsigned int);
|
|
private:
|
|
unsigned int range;
|
|
uint64_t latest_value;
|
|
MYSQL *server;
|
|
|
|
unsigned int min_hits;
|
|
};
|
|
|
|
#endif /* SQLHandler_hpp */
|