MySQL Cache Manager & code cleanup
This commit is contained in:
@@ -14,10 +14,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <configuration.h>
|
||||
#include <memory>
|
||||
#include <stream_model.h>
|
||||
#include <configuration.h>
|
||||
#include <vector>
|
||||
|
||||
namespace etix {
|
||||
namespace cameradar {
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
virtual void update_stream(const etix::cameradar::stream_model& newmodel) = 0;
|
||||
|
||||
//! Gets all cached streams
|
||||
virtual std::vector<etix::cameradar::stream_model> get_streams() const = 0;
|
||||
virtual std::vector<etix::cameradar::stream_model> get_streams() = 0;
|
||||
|
||||
//! Gets all valid streams which have been accessed
|
||||
virtual std::vector<etix::cameradar::stream_model> get_valid_streams() const = 0;
|
||||
virtual std::vector<etix::cameradar::stream_model> get_valid_streams() = 0;
|
||||
};
|
||||
|
||||
class cache_manager_base : public cache_manager_iface {
|
||||
@@ -68,10 +68,10 @@ public:
|
||||
virtual void update_stream(const etix::cameradar::stream_model& newmodel) = 0;
|
||||
|
||||
//! Gets all cached streams
|
||||
virtual std::vector<etix::cameradar::stream_model> get_streams() const = 0;
|
||||
virtual std::vector<etix::cameradar::stream_model> get_streams() = 0;
|
||||
|
||||
//! Gets all valid streams which have been accessed
|
||||
virtual std::vector<etix::cameradar::stream_model> get_valid_streams() const = 0;
|
||||
virtual std::vector<etix::cameradar::stream_model> get_valid_streams() = 0;
|
||||
|
||||
//! Get the manager's instance
|
||||
cache_manager_base& get_instance();
|
||||
|
||||
@@ -14,11 +14,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <assert.h> // assert
|
||||
#include <csignal> // sigint
|
||||
#include <iostream> // stc::cout
|
||||
#include <assert.h> // assert
|
||||
|
||||
// To avoid an unused warning for the asserted in handle_signal
|
||||
#define _unused(x) ((void)(x))
|
||||
|
||||
namespace etix {
|
||||
|
||||
namespace cameradar {
|
||||
|
||||
enum class stop_priority { running, stop, force_stop };
|
||||
@@ -30,6 +34,7 @@ public:
|
||||
virtual int
|
||||
handle_signal(int signum) {
|
||||
assert(signum == SIGINT);
|
||||
_unused(signum);
|
||||
std::cout << "\b\b\b\033[K";
|
||||
if (this->ss == stop_priority::running)
|
||||
this->ss = stop_priority::stop;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <json/value.h>
|
||||
#include <string>
|
||||
|
||||
namespace etix {
|
||||
namespace cameradar {
|
||||
@@ -24,7 +24,7 @@ struct stream_model {
|
||||
// Ex : "172.16.100.113"
|
||||
std::string address;
|
||||
// Ex : 8554
|
||||
unsigned short port;
|
||||
unsigned int port;
|
||||
// Ex : "admin"
|
||||
std::string username = "";
|
||||
// Ex : "123456"
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cameradar_task.h> // task interface
|
||||
#include <boost/algorithm/string/find.hpp> // boost::find
|
||||
#include <iostream> // std::ofstream
|
||||
#include <fstream> // std::ofstream
|
||||
#include <stream_model.h> // data model
|
||||
#include <cachemanager.h> // cacheManager
|
||||
#include <cachemanager.h> // cacheManager
|
||||
#include <cameradar_task.h> // task interface
|
||||
#include <fstream> // std::ofstream
|
||||
#include <iostream> // std::ofstream
|
||||
#include <stream_model.h> // data model
|
||||
|
||||
namespace etix {
|
||||
namespace cameradar {
|
||||
|
||||
Reference in New Issue
Block a user