#ifndef container_hpp #define container_hpp #include "value.hpp" #include "filter.hpp" #include namespace filval{ class GenContainer{ private: std::string name; std::string desc; std::vector filters; protected: virtual void _fill() = 0; public: GenContainer(const std::string name) :name(name){ } void add_filter(GenValue* filter){ filters.push_back(dynamic_cast(filter)); } void fill(){ for (auto filter : filters){ if (!filter->get_value()){ return; } } _fill(); } void set_description(const std::string& description){ desc = description; } const std::string& get_name(){ return name; } }; typedef std::map ContainerSet; template class Container : public GenContainer{ protected: H* container; public: Container(H* container, const std::string name) :GenContainer(name), container(container){ } virtual H* get_container(){ return container; } }; template class ContainerVector : public Container >{ private: Value* value; void _fill(){ this->container->push_back(value->get_value()); } public: ContainerVector(std::vector *container, Value* value, const std::string name) :Container >(container, name), value(value){ } ContainerVector(Value* value, const std::string name) :Container >(NULL, name), value(value){ this->container = new std::vector(); } }; } #endif // container_hpp