00001 //-------------------------------------------------- 00013 //--------------------------------------------------- 00014 00015 #ifndef IMEDGINE_CONFIG_HANDLER_H_ 00016 #define IMEDGINE_CONFIG_HANDLER_H_ 00017 00018 #include <QtXml/QXmlDefaultHandler> 00019 #include <QtXml/QXmlAttributes> 00020 #include <QString> 00021 00022 #include "../algorithms/algorithm_config.h" 00023 #include "../algorithms/algorithm_definition.h" 00024 #include "../global/global_definitions.h" 00025 00026 namespace imedgine 00027 { 00028 class DatasetDefinition; 00029 00030 //--------------------------------------------------- 00043 //--------------------------------------------------- 00044 00045 class ConfigHandler: public QXmlDefaultHandler 00046 { 00047 00048 public: 00049 //--------------------------------------------------- 00052 00053 ConfigHandler(AlgorithmConfig::algorithm_config_pointer_type algorithm_config); 00054 00055 //--------------------------------------------------- 00057 00058 ~ConfigHandler(); 00059 00060 //--------------------------------------------------- 00062 00063 bool startElement(const QString &namespace_uri, const QString &local_name, const QString &qname, const QXmlAttributes &attrs); 00064 00065 //--------------------------------------------------- 00067 00068 bool characters (const QString &characters); 00069 00070 //--------------------------------------------------- 00072 00073 bool endElement(const QString &namespace_uri, const QString &local_name, const QString &qname); 00074 00075 private: 00076 00077 //--------------------------------------------------- 00085 00086 dataset_type getDatasetType(std::string type, std::string bytes); 00087 00088 //--------------------------------------------------- 00091 00092 AlgorithmConfig::algorithm_config_pointer_type algorithm_config_; 00093 00094 //--------------------------------------------------- 00097 00098 AlgorithmConfig::algorithm_definition_pointer_type current_definition_; 00099 00100 //--------------------------------------------------- 00103 00104 AlgorithmDefinition::dataset_definition_pointer_type current_dataset_; 00105 00106 //--------------------------------------------------- 00109 00110 AlgorithmDefinition::accepted_datasets_collection_type current_combination_; 00111 00112 //--------------------------------------------------- 00115 00116 AlgorithmDefinition::combinations_definition_list_type combinations_; 00117 00118 //--------------------------------------------------- 00121 00122 AlgorithmDefinition::accepted_datasets_type accepted_datasets_; 00123 00124 //--------------------------------------------------- 00127 00128 dataset_type current_type_; 00129 00130 bool is_algorithm_; 00131 bool is_combinations_; 00132 bool is_combination_; 00133 bool is_input_; 00134 bool is_output_; 00135 bool is_dataset_; 00136 bool is_name_; 00137 bool is_classification_; 00138 bool is_library_; 00139 bool is_type_; 00140 }; 00141 } 00142 00143 #endif // IMEDGINE_CONFIG_HANDLER_ 00144 00145