Commit 53753f37 authored by Pascal Noisette's avatar Pascal Noisette
Browse files

No commit message

No commit message
parent 4c99c8a9
......@@ -8,6 +8,7 @@ int ParserDefinitionDecoder::definitions_number(){
}
void ParserDefinitionDecoder::store_definition(Line &line){
//read the definition header
string &definition_name = line.item(2);
......@@ -54,6 +55,9 @@ Definition& ParserDefinitionDecoder::get_definition(int i){
return _definitions[i];
}
std::map<int,Definition>* ParserDefinitionDecoder::HashTableofDefinitions(){
return &_definitions;
}
void ParserDefinitionDecoder::print_definitions(){
map<int,Definition>::iterator it;
......
......@@ -29,8 +29,8 @@ public:
void store_definition(Line &);
Definition& get_definition(int i);
/*! \brief Print all the definitions. Useful for debug.*/
void print_definitions();
void print_definitions();
std::map<int,Definition>* HashTableofDefinitions();
};
#endif // PARSERDEFINITIONDECODER_HPP
#include "ParserEventDecoder.hpp"
ParserEventDecoder::ParserEventDecoder(std::map<int,Definition>* table){
_definitions_ptr = table;
}
void ParserEventDecoder::sort_definition(Definition& d,Line& line){
}
#ifndef PARSEREVENTDECODER_HPP
#define PARSEREVENTDECODER_HPP
#define PARSEREVENTDECODER_HPP
#include <iostream>
#include <map>
#include "Definition.hpp"
#include "Line.hpp"
/**
* \class ParserEventDecoder
* \brief Reads Hash Table to find fill the Str
......@@ -9,7 +12,11 @@
class ParserEventDecoder{
private:
private:
std::map<int,Definition>* _definitions_ptr;
/*!
*
*\fn convert(String type, String value)
......@@ -20,8 +27,9 @@ private:
*/
public:
void sort_definition(Definition,Line);
public:
ParserEventDecoder(std::map<int,Definition>*);
void sort_definition(Definition& d,Line&);
......
#include "../src/Line.hpp"
#include "../src/ParserDefinitionDecoder.hpp"
#include "../src/ParserDefinitionDecoder.hpp"
#include "../src/ParserEventDecoder.hpp"
#include <iostream>
#include <fstream>
......@@ -7,23 +8,36 @@ using namespace std;
int main(int argc, char **argv){
ParserDefinitionDecoder *parser = new ParserDefinitionDecoder();
ParserDefinitionDecoder *parserdefinition = new ParserDefinitionDecoder();
ParserEventDecoder *parserevent = new ParserEventDecoder(parserdefinition->HashTableofDefinitions());
Line line("trace_to_parse.trace");
int linescount = 0;
std::string pourcent = "%";
while(!line.eof()){
line.newline();
std::string pourcent = "%";
if(line.starts_with(pourcent)){
parser->store_definition(line);
parserdefinition->store_definition(line);
}
else
std::cout<<"pas %"<<endl;
{
int number;
if (sscanf(line.item(0).c_str(),"%d",&number)!=1)
std::cout<<"NAN"<<endl;
else
parserevent->sort_definition(parserdefinition->get_definition(number),line);
}
}
//parserdefinition->print_definitions();
parser->print_definitions();
delete parserdefinition;
delete parserevent;
delete parser;
return EXIT_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment