Skip to content
Snippets Groups Projects
Commit f5673e3f authored by Sergei Zharko's avatar Sergei Zharko
Browse files

hist-server: user interruption handling

parent 8b306b63
No related branches found
No related tags found
1 merge request!1746hist-server: user interruption handling
This diff is collapsed.
......@@ -5,17 +5,17 @@
#ifndef CBM_SERVICES_HISTSERV_APP_APPLICATION_H
#define CBM_SERVICES_HISTSERV_APP_APPLICATION_H 1
#include "ProgramOptions.h"
#include "THttpServer.h"
#include "TObjArray.h"
#include "ui_callbacks.h"
#include <csignal>
#include <memory>
#include <string>
#include <thread>
#include <zmq.hpp>
#include "ProgramOptions.h"
#include "ui_callbacks.h"
class TCanvas;
class TNamed;
......@@ -44,18 +44,43 @@ namespace cbm::services::histserv
private:
//const std::string& ConfigFile() const;
bool ReceiveData(zmq::message_t& msg);
bool ReceiveHistoConfig(zmq::message_t& msg);
bool ReceiveCanvasConfig(zmq::message_t& msg);
bool ReceiveConfigAndData(std::vector<zmq::message_t>& vMsg);
/// \brief Receives histograms
bool ReceiveData(zmq::message_t& msg);
/// \brief Receives histogram configuration
bool ReceiveHistoConfig(zmq::message_t& msg);
/// \brief Receives canvas configuration
bool ReceiveCanvasConfig(zmq::message_t& msg);
/// \brief Receives a list of canvases and histograms
/// \param vMsg Message with the histograms and canvases list
bool ReceiveConfigAndData(std::vector<zmq::message_t>& vMsg);
/// \brief Read a histogram
/// \tparam HistoT Histogram type
/// \param pHist Pointer to the histogram
template<class HistoT>
bool ReadHistogram(HistoT* pHist);
/// \brief Find histogram index in the histogram array
/// \param name A name of the histogram
int FindHistogram(const std::string& name);
/// \brief Prepares canvases using received canvas configuration
/// \param uCanvIdx Index of canvas
bool PrepareCanvas(uint32_t uCanvIdx);
/// \brief Resets handled histograms
bool ResetHistograms();
/// \brief Saves handled histograms
bool SaveHistograms();
template<class HistoT>
bool ReadHistogram(HistoT* pHist);
int FindHistogram(const std::string& name);
bool PrepareCanvas(uint32_t uCanvIdx);
/// \brief A handler for system signals
/// \param signal Signal ID
//static void SignalHandler(int signal);
bool ResetHistograms();
bool SaveHistograms();
private:
ProgramOptions const& fOpt; ///< Program options object
......@@ -74,7 +99,7 @@ namespace cbm::services::histserv
/// Vector of string with ( HistoName, FolderPath ) to configure the histogram
std::vector<std::pair<std::string, std::string>> fvpsHistosFolder = {};
/// Vector of string pairs with ( CanvasName, CanvasConfig ) to configure the canvases and histos within
/// Format of Can config is "Name;Title;NbPadX(U);NbPadY(U);ConfigPad1(s);....;ConfigPadXY(s)"
/// Format of Can config is "Name;Title;NbPadX(U);NbPadY(U);ConfigPad2(s);....;ConfigPadXY(s)"
/// Format of Pad config is "GrixX(b),GridY(b),LogX(b),LogY(b),LogZ(b),HistoName(s),DrawOptions(s)"
std::vector<std::pair<std::string, std::string>> fvpsCanvasConfig = {};
std::vector<bool> fvbCanvasReady = {};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment