diff --git a/parser/src/Parser.cpp b/parser/src/Parser.cpp deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/parser/src/ParserEventDecoder.cpp b/parser/src/ParserEventDecoder.cpp index c8f2f17f3af54452d3e1253ceba03e30c2371c37..86f6e71a560a0840512dce732262c6b9d5a5fa53 100644 --- a/parser/src/ParserEventDecoder.cpp +++ b/parser/src/ParserEventDecoder.cpp @@ -2,10 +2,78 @@ ParserEventDecoder::ParserEventDecoder(){ - + } -//void ParserEventDecoder::sort_definition(Definition& d,Line& line){ +void ParserEventDecoder::store_event(const Definition &definition,Line &line, Trace &trace){ + + String alias; + bool alias_is_initialized; + + String name; + bool name_is_initialized; + + String container_type; + bool container_type_is_initialized; + + String source_container_type; + bool source_container_type_is_initialized; + + String dest_container_type; + bool dest_container_type_is_initialized; + + String entity_type; + bool entity_type_is_initialized; + + Date time; + bool time_is_initialized; + + String type; + bool type_is_initialized; + + String container; + bool container_is_initialized; + + String value_string; + bool value_string_is_initialized; + + Double value_double; + bool value_double_is_initialized; + + String source_container; + bool source_container_is_initialized; + + String dest_container; + bool dest_container_is_initialized; + + String key; + bool key_is_initialized; + + int i=1; + vector<field> fields = definition.get_fields(); + int number_of_values fields.size(); + + while(i < number_of_values) { + + string current_value; + if (!line.item(i,current_value)) { + cout << "warning : missing values" << endl; + return; + } + + if (fields[i-1].name == "Alias") { + if((fields[i-1].type != "string") || (fields[i-1].type != "integer")) { + cout << "warning : type not suitable" << endl; + return; + } + if(!Date::instanciate(current_value, alias)) { + cout << "warning : incompatible value" << endl; + return; + } + } + i++; + } + +} -//} diff --git a/parser/src/ParserEventDecoder.hpp b/parser/src/ParserEventDecoder.hpp index f42ceaa4488b4a27ed220fb589bd8ed49cf9509d..24a1e74b319b5a7850f3a237bf536ec3ece52981 100644 --- a/parser/src/ParserEventDecoder.hpp +++ b/parser/src/ParserEventDecoder.hpp @@ -27,8 +27,7 @@ private: public: ParserEventDecoder(); - void store_event(Definition &, Line &// , Trace & - ); + void store_event(const Definition &, Line &, Trace &); diff --git a/parser/src/algorithmeEventParser.cpp b/parser/src/algorithmeEventParser.cpp deleted file mode 100644 index cff2cf9488ee003a3688752c9fd3cee578768a05..0000000000000000000000000000000000000000 --- a/parser/src/algorithmeEventParser.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#algorithme pour convertion -convertir(String type, String valeur) : Type -{ -if (type=="int") - return new Integer(valeur) -else if (type=="String") - return new Str(valeur) -else if (type=="Color") - return new Color(valeur) - } - -#algorithme pour EventParser - -E : Hash des evenements (constuit dans le parserDef), ligne -S : Trace - - -Event & e = Hash(atoi(liretoken(ligne))) -if (e.name = "PajedefineContainer" ) - { - int i = 0; - String token; - Map facultatif<int, Type>; - while (token = liretoken(ligne)) - { - String typeattendu = e.vector[i].type; - String champattendu = e.vector[i].champ; - i++; - - if (champattendu=="name") - { - - String parametre1 = token; - } - else if (champattendu=="couleur") - { - Couleur parametre2(typeattendu,token); - } - else //facultatif - { - facultatif += convertir(typeattendu,token); - } - } - trace.storePajedefineContainer(parametre1,parametre2,facultatif); - - }