35 #include "container.hpp" 40 typedef std::map<std::string, GenContainer*> ContainerSet;
53 INFO(GenValue::summary());
54 INFO(GenFunction::summary());
57 Value<int>* current_event_number;
60 ContainerSet containers;
61 virtual bool load_next() = 0;
62 virtual int get_events() = 0;
63 virtual int get_current_event() = 0;
65 std::map<std::string,std::string> get_container_name_value_map(){
66 std::map<std::string, std::string> value_map;
67 for(
auto container : containers)
68 value_map[container.first] = container.second->get_value_name();
72 std::map<std::string,std::string> get_function_name_impl_map(){
73 std::map<std::string, std::string> impl_map;
75 if (fn.second !=
nullptr){
81 void process(
bool silent=
false){
82 int events, current_event;
84 events = get_events();
85 if (!silent) std::cout << std::endl;
87 current_event = get_current_event();
88 if (!silent) std::cout <<
"\rprocessing event: " << current_event+1 <<
"/" << events << std::flush;
90 for(
auto con : containers){
94 if (!silent) std::cout <<
" Finished!" << std::endl;
97 virtual void save_all(){
98 for(
auto container : containers)
99 container.second->save();
102 template<
typename C,
typename... ArgTypes>
103 C* register_container(ArgTypes... args){
104 C* container =
new C(args...);
105 if (containers[container->get_name()] !=
nullptr){
106 CRITICAL(
"Container with name \""+container->get_name()+
"\" already exists.", -1);
108 containers[container->get_name()] = container;
112 GenContainer* get_container(std::string container_name){
113 GenContainer* c = containers[container_name];
115 CRITICAL(
"Request for container \"" << container_name <<
"\" failed. Doesn't exist.", -1);
121 auto& event_check = GenFunction::register_function<int()>(
"event_number",
123 return ds->get_current_event();
125 current_event_number =
new BoundValue<int>(event_check);
128 Value<int>* get_current_event_number(){
129 return current_event_number;
133 #endif // dataset_hpp The namespace containing all filval classes and functions.
static std::string format_code(const std::string &code)
Attempt to invoke clang-format for the purpose of printing out nicely formatted functions to the log ...
static std::map< const std::string, GenFunction * > function_registry
Static mapping of functions from their name to the object wrapper of the function.