35 #include "container.hpp" 40 typedef std::map<std::string, GenContainer*> ContainerSet;
53 INFO(GenValue::summary());
54 INFO(GenFunction::summary());
59 ContainerSet containers;
60 virtual bool load_next() = 0;
61 virtual int get_events() = 0;
62 virtual int get_current_event() = 0;
64 std::map<std::string,std::string> get_container_name_value_map(){
65 std::map<std::string, std::string> value_map;
66 for(
auto container : containers)
67 value_map[container.first] = container.second->get_value_name();
71 std::map<std::string,std::string> get_function_name_impl_map(){
72 std::map<std::string, std::string> impl_map;
74 if (fn.second !=
nullptr){
80 void process(
bool silent=
false){
81 int events, current_event;
83 events = get_events();
84 if (!silent) std::cout << std::endl;
86 current_event = get_current_event();
87 if (!silent) std::cout <<
"\rprocessing event: " << current_event+1 <<
"/" << events << std::flush;
89 for(
auto con : containers){
93 if (!silent) std::cout <<
" Finished!" << std::endl;
96 virtual void save_all(){
97 for(
auto container : containers)
98 container.second->save();
101 template<
typename C,
typename... ArgTypes>
102 C* register_container(ArgTypes... args){
103 C* container =
new C(args...);
104 if (containers[container->get_name()] !=
nullptr){
105 CRITICAL(
"Container with name \""+container->get_name()+
"\" already exists.", -1);
107 containers[container->get_name()] = container;
111 GenContainer* get_container(std::string container_name){
112 GenContainer* c = containers[container_name];
114 CRITICAL(
"Request for container \"" << container_name <<
"\" failed. Doesn't exist.", -1);
120 #endif // dataset_hpp The namespace containing all filval classes and functions.
Definition: api.hpp:38
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 ...
Definition: value.hpp:176
static std::map< const std::string, GenFunction * > function_registry
Static mapping of functions from their name to the object wrapper of the function.
Definition: value.hpp:155