File NPPluginManager.h
File List > core > NPPluginManager.h
Go to the documentation of this file
#ifndef NPPluginManager_h
#define NPPluginManager_h
// IO
#include "NPVDataInput.h"
#include "NPVDataOutput.h"
// Detector
#include "NPVDetector.h"
// Analysis
#include "NPVUserAnalysis.h"
#include "NPVUserInterface.h"
// Simulation
#include "NPVPhysicsProcess.h"
#include "NPVPrimaryGenerator.h"
#include "NPVReactionGenerator.h"
// std
#include <map>
#include <memory>
#include <string>
namespace nptool {
class PluginManager {
public:
PluginManager();
~PluginManager();
public:
// Load a locally available Plugins
void* LoadPlugin(std::string name, bool allow_absent_plugin = false);
// Load the list of locally available Plugins
void LoadPluginList(std::string file, bool allow_fail = false);
// Load the Online catalogue of Plugins
void LoadPluginCatalogue();
private:
// list of locally available plugin
std::map<std::string, std::string> m_available;
// list of remote plugin
std::map<std::string, std::string> m_remote;
// handle to the loaded plugin
std::map<std::string, void*> m_handle;
// Data inputi/output management
private:
// list of data input constructor available:
std::map<std::string, std::shared_ptr<nptool::VDataInput> (*)()> m_DataInputConstruct;
// list of data input constructor available:
std::map<std::string, std::shared_ptr<nptool::VDataOutput> (*)()> m_DataOutputConstruct;
// list of user interface constructor available:
std::map<std::string, std::shared_ptr<nptool::VUserInterface> (*)()> m_UserInterfaceConstruct;
// list of user interface constructor available:
std::map<std::string, std::shared_ptr<nptool::VUserAnalysis> (*)()> m_UserAnalysisConstruct;
// list of primary generator available:
std::map<std::string, std::shared_ptr<nptool::VPrimaryGenerator> (*)()> m_PrimaryGeneratorConstruct;
// list of reaction generator available:
std::map<std::string, std::shared_ptr<nptool::VReactionGenerator> (*)()> m_ReactionGeneratorConstruct;
// list of Physcis Process available:
std::map<std::string, std::shared_ptr<nptool::VPhysicsProcess> (*)()> m_PhysicsProcessConstruct;
public:
std::shared_ptr<nptool::VDataInput> ConstructDataInput(std::string name);
std::shared_ptr<nptool::VDataOutput> ConstructDataOutput(std::string name);
std::shared_ptr<nptool::VUserInterface> ConstructUserInterface(std::string name);
std::shared_ptr<nptool::VUserAnalysis> ConstructUserAnalysis(std::string name);
// Simulation related
std::shared_ptr<nptool::VPrimaryGenerator> ConstructPrimaryGenerator(std::string name);
std::shared_ptr<nptool::VReactionGenerator> ConstructReactionGenerator(std::string name);
std::shared_ptr<nptool::VPhysicsProcess> ConstructPhysicsProcess(std::string name);
// Detector management
private:
// list of data input constructor available:
std::map<std::string, std::shared_ptr<nptool::VDetector> (*)()> m_DetectorConstruct;
public:
std::shared_ptr<nptool::VDetector> ConstructDetector(std::string name);
private:
std::multimap<std::string, std::weak_ptr<VDataInput>> m_inputs;
std::multimap<std::string, std::weak_ptr<VDataOutput>> m_outputs;
std::multimap<std::string, std::weak_ptr<VUserInterface>> m_interfaces;
public:
std::multimap<std::string, std::weak_ptr<VDataInput>> GetInputs() { return m_inputs; };
std::multimap<std::string, std::weak_ptr<VDataOutput>> GetOutputs() { return m_outputs; };
std::multimap<std::string, std::weak_ptr<VUserInterface>> GetInterfaces() { return m_interfaces; };
};
} // namespace nptool
#endif