File NPApplication.h
File List > core > NPApplication.h
Go to the documentation of this file
#ifndef NPApplication_h
#define NPApplication_h
#include "NPCalibrationManager.h"
#include "NPCounter.h"
#include "NPDetectorManager.h"
#include "NPOptionManager.h"
#include "NPPluginManager.h"
#include "NPThreadPool.h"
#include "NPVDataInput.h"
#include "NPVDataOutput.h"
#include "NPVUserInterface.h"
#include <memory>
#include <string>
#include <thread>
// this class should be the sole entry point to the framework
namespace nptool {
class Application : public OptionManager,
public thread_pool,
public PluginManager,
public DetectorManager,
public CalibrationManager,
public Counter {
public: // With arguments
Application(int argc, char** argv, unsigned int number_of_threads);
Application(std::string s, unsigned int number_of_threads);
~Application();
// Emulated a singleton like behaviour when using the GetInstance method
private: // pointer to the single instance
static std::shared_ptr<Application> m_instance;
public: // interface to instance
static std::shared_ptr<Application>
InitApplication(int argc, char** argv, unsigned int number_of_threads = std::thread::hardware_concurrency() - 1);
static std::shared_ptr<Application>
InitApplication(std::string s, unsigned int number_of_threads = std::thread::hardware_concurrency() - 1);
static std::shared_ptr<Application> GetApplication();
public:
// Start the application
void Start(bool load = true);
// Stop the application
void Stop();
public: // Interface to OptionManager
std::string GetDetectorFile();
public:
// Utility fonction
void AddASCIIFile(std::string name, std::string title, std::string file) {
std::array<std::string, 3> arg = {name, title, file};
m_ASCIIFile.push_back(arg);
}; // list file to save to output
void AttachASCIIFiles() {
for (auto& out : GetOutputs())
for (auto& f : m_ASCIIFile) {
auto p = out.second.lock();
if (p)
p->AttachAsciiFile(f[0], f[1], f[2]);
}
};
private:
std::vector<std::array<std::string, 3>> m_ASCIIFile;
};
} // namespace nptool
#endif