Commit 9be6d080 authored by Johnny Jazeix's avatar Johnny Jazeix

developer (with only one p ^^)

Messages in OTF are considered as links.
Manuals have the licence in entete.
Added methods for translation.
parent 268fc031
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......@@ -61,13 +61,13 @@ double convert_to_double(const string arg){
// We had dots initially, we need to have the english system
if(is_english_system_needed) {
if(setlocale(LC_NUMERIC, "en_GB.UTF-8") == NULL){
cerr << "The locale en_GB.UTF-8 is unavailable so the decimal pointed will not be printed" << endl;
cerr << QObject::tr("The locale en_GB.UTF-8 is unavailable so the decimal pointed will not be printed").toStdString() << endl;
}
}
else {
if ( setlocale(LC_NUMERIC, "fr_FR.UTF-8")==NULL && setlocale(LC_NUMERIC, "French") == NULL){
cerr << "The locale fr_FR.UTF-8 is unavailable so the decimal with comma will not be printed" << endl;
cerr << QObject::tr("The locale fr_FR.UTF-8 is unavailable so the decimal with comma will not be printed").toStdString() << endl;
}
}
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......@@ -54,6 +54,9 @@
// For dots or commas separator in double numbers
#include <locale.h>
// For translations
#include <QObject>
/*!
* \fn convert_to_double(const std::string args)
* \brief Convert the string in double
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
This diff is collapsed.
......@@ -112,16 +112,16 @@ void Interface_graphic::load_windows(){
if (!QGLFormat::hasOpenGL())
qFatal("This system has no OpenGL support");
qFatal(tr("This system has no OpenGL support").toStdString().c_str());
/* Load the informative window from a .ui file */
file_info.open(QFile::ReadOnly);
CKFP(_ui_info_window = loader.load(&file_info, this), "Cannot open the .ui file : " << ":/window/info_window.ui");
CKFP(_ui_info_window = loader.load(&file_info, this), tr("Cannot open the .ui file : ").toStdString() << ":/window/info_window.ui");
file_info.close();
/* Load the _option_export_window from a .ui file */
file_selection_export.open(QFile::ReadOnly);
CKFP(_ui_time_selection_export = loader.load(&file_selection_export, this), "Cannot open the .ui file : " << "option_export_window.ui");
CKFP(_ui_time_selection_export = loader.load(&file_selection_export, this), tr("Cannot open the .ui file : ").toStdString() << "option_export_window.ui");
file_selection_export.close();
......@@ -130,33 +130,33 @@ void Interface_graphic::load_windows(){
_ui_time_selection_export->setWindowFlags(_ui_time_selection_export->windowFlags() | Qt::WindowStaysOnTopHint);
/* Load widget from the .ui file */
CKFP(_ui_render_area_layout = qFindChild<QVBoxLayout*>(this, "render_area_layout"), "Cannot find the render_area layout in the .ui file");
CKFP(_ui_fullscreen_menu = qFindChild<QAction*>(this, "fullscreen"), "Cannot find the fullscreen menu in the .ui file");
CKFP(_ui_info_trace_text = qFindChild<QTextEdit*>(_ui_info_window, "info_trace_text"), "Cannot find the info_trace_text QTextEdit widget in the .ui file");
CKFP(_ui_info_selection_text = qFindChild<QTextEdit*>(_ui_info_window, "info_selection_text"), "Cannot find the info_selection_text QTextEdit widget in the .ui file");
CKFP(_ui_toolbar_check = qFindChild<QAction*>(this, "toolbar_menu"), "Cannot find the tool bar checker in the .ui file");
CKFP(_ui_toolbar = qFindChild<QToolBar*>(this, "toolBar"), "Cannot find the tool bar in the .ui file");
CKFP(_ui_render_area_layout = qFindChild<QVBoxLayout*>(this, "render_area_layout"), tr("Cannot find the render_area layout in the .ui file").toStdString());
CKFP(_ui_fullscreen_menu = qFindChild<QAction*>(this, "fullscreen"), tr("Cannot find the fullscreen menu in the .ui file").toStdString());
CKFP(_ui_info_trace_text = qFindChild<QTextEdit*>(_ui_info_window, "info_trace_text"), tr("Cannot find the info_trace_text QTextEdit widget in the .ui file").toStdString());
CKFP(_ui_info_selection_text = qFindChild<QTextEdit*>(_ui_info_window, "info_selection_text"), tr("Cannot find the info_selection_text QTextEdit widget in the .ui file").toStdString());
CKFP(_ui_toolbar_check = qFindChild<QAction*>(this, "toolbar_menu"), tr("Cannot find the tool bar checker in the .ui file").toStdString());
CKFP(_ui_toolbar = qFindChild<QToolBar*>(this, "toolBar"), tr("Cannot find the tool bar in the .ui file").toStdString());
CKFP(_ui_x_scroll = qFindChild<QScrollBar*>(this, "x_scroll"), "Cannot find the horizontal scroll bar in the .ui file");
CKFP(_ui_y_scroll = qFindChild<QScrollBar*>(this, "y_scroll"), "Cannot find the vertical scroll bar in the .ui file");
CKFP(_ui_x_scroll = qFindChild<QScrollBar*>(this, "x_scroll"), tr("Cannot find the horizontal scroll bar in the .ui file").toStdString());
CKFP(_ui_y_scroll = qFindChild<QScrollBar*>(this, "y_scroll"), tr("Cannot find the vertical scroll bar in the .ui file").toStdString());
CKFP(_ui_zoom_box = qFindChild<QComboBox*>(this, "zoom_box"), "Cannot find the zoom box in the .ui file");
CKFP(_ui_zoom_box = qFindChild<QComboBox*>(this, "zoom_box"), tr("Cannot find the zoom box in the .ui file").toStdString());
// Export window
CKFP(_ui_export_ok_button = qFindChild<QPushButton*>(_ui_time_selection_export, "option_export_ok"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_min_time_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "min_time"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_export_ok_button = qFindChild<QPushButton*>(_ui_time_selection_export, "option_export_ok"), tr("Cannot find the ok push button in the export dialog .ui file").toStdString());
CKFP(_ui_min_time_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "min_time"), tr("Cannot find the ok push button in the export dialog .ui file").toStdString());
CKFP(_ui_max_time_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "max_time"), "Cannot find the ok push button in the export dialog .ui file");
CKFP(_ui_max_time_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "max_time"), tr("Cannot find the ok push button in the export dialog .ui file").toStdString());
CKFP(_ui_CheckBox_time_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "export_all"), "Cannot find the Line text \"export_all\" in the export dialog .ui file");
CKFP(_ui_CheckBox_time_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "export_all"), tr("Cannot find the Line text \"export_all\" in the export dialog .ui file").toStdString());
CKFP(_ui_wide_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "wide"), "Cannot find the Line text \"wide\" in the export dialog .ui file");
CKFP(_ui_grow_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "grow"), "Cannot find the Line text \"grow\" in the export dialog .ui file");
CKFP(_ui_accuracy_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "accuracy"), "Cannot find the Line text \"accuracy\" in the export dialog .ui file");
CKFP(_ui_CheckBox_wide_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "checkBox_wide"), "Cannot find the Line text \"wide\" in the export dialog .ui file");
CKFP(_ui_CheckBox_grow_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "checkBox_grow"), "Cannot find the Line text \"grow\" in the export dialog .ui file");
CKFP(_ui_CheckBox_accuracy_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "checkBox_accuracy"), "Cannot find the Line text \"accuracy\" in the export dialog .ui file");
CKFP(_ui_more_options_export = qFindChild<QCommandLinkButton*>(_ui_time_selection_export, "more_options"), "Cannot find the button \"more_options\" in the export dialog .ui file");
CKFP(_ui_wide_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "wide"), tr("Cannot find the Line text \"wide\" in the export dialog .ui file").toStdString());
CKFP(_ui_grow_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "grow"), tr("Cannot find the Line text \"grow\" in the export dialog .ui file").toStdString());
CKFP(_ui_accuracy_export = qFindChild<QLineEdit*>(_ui_time_selection_export, "accuracy"), tr("Cannot find the Line text \"accuracy\" in the export dialog .ui file").toStdString());
CKFP(_ui_CheckBox_wide_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "checkBox_wide"), tr("Cannot find the Line text \"wide\" in the export dialog .ui file").toStdString());
CKFP(_ui_CheckBox_grow_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "checkBox_grow"), tr("Cannot find the Line text \"grow\" in the export dialog .ui file").toStdString());
CKFP(_ui_CheckBox_accuracy_export = qFindChild<QCheckBox*>(_ui_time_selection_export, "checkBox_accuracy"), tr("Cannot find the Line text \"accuracy\" in the export dialog .ui file").toStdString());
CKFP(_ui_more_options_export = qFindChild<QCommandLinkButton*>(_ui_time_selection_export, "more_options"), tr("Cannot find the button \"more_options\" in the export dialog .ui file").toStdString());
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......@@ -52,37 +52,37 @@ const int Error::_EVERYTHING = 0;
const int Error::_WARNING = 1;
const int Error::_ERROR = 2;
string Error::_content = "";
const string Error::_PARSE = "expected \" before end of file";
const string Error::_MMAP = "mmap error";
const string Error::_EMPTY_FILE = "empty file";
const string Error::_FSTAT = "status file error";
const string Error::_OPEN = "open file error";
const string Error::_MUNMAP = "munmap error";
const string Error::_EXPECT_END_DEF = "expected %EndEventDef";
const string Error::_EXPECT_EVENT_DEF = "expected %EventDef";
const string Error::_EXPECT_NAME_DEF = "the definition is not named";
const string Error::_EXPECT_ID_DEF = "the definition is not identified";
const string Error::_UNKNOWN_ID_DEF = "there is no definition with the identity: ";
const string Error::_EXTRA_TOKEN = "extra token(s) ignored";
const string Error::_UNKNOWN_EVENT_DEF = "the following event doesn't match with any event known: ";
const string Error::_FIELD_TYPE_MISSING = "a field type is missing ";
const string Error::_FIELD_TYPE_UNKNOWN = "the following field type is unknown: ";
const string Error::_EMPTY_DEF = "a definition line is empty";
const string Error::_INCOMPATIBLE_VALUE_IN_EVENT = "incompatible value: ";
const string Error::_BAD_FILE_EXTENSION = "the extension of the file is not .trace";
const string Error::_LINE_TOO_SHORT_EVENT = "missing field value(s) in an event";
const string Error::_UNKNOWN_CONTAINER_TYPE = "Unknown container type: ";
const string Error::_UNKNOWN_CONTAINER = "Unknown container: ";
const string Error::_UNKNOWN_EVENT_TYPE = "Unknown event type: ";
const string Error::_UNKNOWN_STATE_TYPE = "Unknown state type: ";
const string Error::_UNKNOWN_VARIABLE_TYPE = "Unknown variable type: ";
const string Error::_UNKNOWN_LINK_TYPE = "Unknown link type: ";
const string Error::_UNKNOWN_ENTITY_TYPE = "Unknown entity type: ";
const string Error::_UNKNOWN_ENTITY_VALUE = "Unknown entity value: ";
string Error::_content = QObject::tr("").toStdString();
const string Error::_PARSE = QObject::tr("expected \" before end of file").toStdString();
const string Error::_MMAP = QObject::tr("mmap error").toStdString();
const string Error::_EMPTY_FILE = QObject::tr("empty file").toStdString();
const string Error::_FSTAT = QObject::tr("status file error").toStdString();
const string Error::_OPEN = QObject::tr("open file error").toStdString();
const string Error::_MUNMAP = QObject::tr("munmap error").toStdString();
const string Error::_EXPECT_END_DEF = QObject::tr("expected %EndEventDef").toStdString();
const string Error::_EXPECT_EVENT_DEF = QObject::tr("expected %EventDef").toStdString();
const string Error::_EXPECT_NAME_DEF = QObject::tr("the definition is not named").toStdString();
const string Error::_EXPECT_ID_DEF = QObject::tr("the definition is not identified").toStdString();
const string Error::_UNKNOWN_ID_DEF = QObject::tr("there is no definition with the identity: ").toStdString();
const string Error::_EXTRA_TOKEN = QObject::tr("extra token(s) ignored").toStdString();
const string Error::_UNKNOWN_EVENT_DEF = QObject::tr("the following event doesn't match with any event known: ").toStdString();
const string Error::_FIELD_TYPE_MISSING = QObject::tr("a field type is missing ").toStdString();
const string Error::_FIELD_TYPE_UNKNOWN = QObject::tr("the following field type is unknown: ").toStdString();
const string Error::_EMPTY_DEF = QObject::tr("a definition line is empty").toStdString();
const string Error::_INCOMPATIBLE_VALUE_IN_EVENT = QObject::tr("incompatible value: ").toStdString();
const string Error::_BAD_FILE_EXTENSION = QObject::tr("the extension of the file is not .trace").toStdString();
const string Error::_LINE_TOO_SHORT_EVENT = QObject::tr("missing field value(s) in an event").toStdString();
const string Error::_UNKNOWN_CONTAINER_TYPE = QObject::tr("Unknown container type: ").toStdString();
const string Error::_UNKNOWN_CONTAINER = QObject::tr("Unknown container: ").toStdString();
const string Error::_UNKNOWN_EVENT_TYPE = QObject::tr("Unknown event type: ").toStdString();
const string Error::_UNKNOWN_STATE_TYPE = QObject::tr("Unknown state type: ").toStdString();
const string Error::_UNKNOWN_VARIABLE_TYPE = QObject::tr("Unknown variable type: ").toStdString();
const string Error::_UNKNOWN_LINK_TYPE = QObject::tr("Unknown link type: ").toStdString();
const string Error::_UNKNOWN_ENTITY_TYPE = QObject::tr("Unknown entity type: ").toStdString();
const string Error::_UNKNOWN_ENTITY_VALUE = QObject::tr("Unknown entity value: ").toStdString();
void Error::set(const string kind_of_error, const int priority){
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......@@ -43,7 +43,8 @@
#ifndef ERRORS_HPP
#define ERRORS_HPP
/**
/*!
* \file Errors.hpp
* This file contains all the significations of the errors or warnings that can be thrown by the parser
*
**/
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......@@ -78,7 +78,7 @@ std::ostream &operator<<(std::ostream &out, Message::end_error_t) {
interface->error(message->str());
message->str(""); // flush the stream
} else {
std::cerr << "Warning: no interface designed to display messages." << std::endl;
std::cerr << QObject::tr("Warning: no interface designed to display messages.").toStdString() << std::endl;
}
return out;
}
......@@ -91,7 +91,7 @@ std::ostream &operator<<(std::ostream &out, Message::end_warning_t) {
interface->warning(message->str());
message->str(""); // flush the stream
} else {
std::cerr << "Warning: no interface designed to display messages." << std::endl;
std::cerr << QObject::tr("Warning: no interface designed to display messages.").toStdString() << std::endl;
}
return out;
}
......@@ -104,7 +104,7 @@ std::ostream &operator<<(std::ostream &out, Message::end_information_t) {
interface->information(message->str());
message->str(""); // flush the stream
} else {
std::cerr << "Warning: no interface designed to display messages." << std::endl;
std::cerr << QObject::tr("Warning: no interface designed to display messages.").toStdString() << std::endl;
}
return out;
}
......@@ -118,7 +118,7 @@ std::ostream &operator<<(std::ostream &out, Message::end_selection_information_t
interface->selection_information(message->str());
message->str(""); // flush the stream
} else {
std::cerr << "Warning: no interface designed to display messages." << std::endl;
std::cerr << QObject::tr("Warning: no interface designed to display messages.").toStdString() << std::endl;
}
return out;
}
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -217,7 +217,7 @@ struct FileLine {
/*!
*
* \class ParserDefinitionOTF
* \brief Parse the definitions of the trace and stock them.
* \brief Parse the definitions of the trace and store them.
*
*/
class ParserDefinitionOTF{
......@@ -268,13 +268,13 @@ private:
public:
/*!
* \fn ParserDefinitionOTF
* \fn ParserDefinitionOTF()
* \brief constructor
*/
ParserDefinitionOTF();
/*!
* \fn ~ParserDefinitionOTF
* \fn ~ParserDefinitionOTF()
* \brief destructor
*/
~ParserDefinitionOTF();
......
......@@ -223,89 +223,116 @@ int ParserEventOTF::handler_counter(void *trace, uint64_t time, uint32_t proc_id
}
int ParserEventOTF::handler_send_message (void *trace, uint64_t time, uint32_t sender, uint32_t receiver, uint32_t group, uint32_t type, uint32_t length, uint32_t source) {
return handle_message(trace, time, receiver, sender, group, type, length, source, true);
}
// We define the LinkType if not exist and we store the time and other fields
Trace *t = (Trace *)trace;
Date d = (double)time/(double)ParserDefinitionOTF::get_ticks_per_second();
int ParserEventOTF::handler_receive_message (void *trace, uint64_t time, uint32_t receiver, uint32_t sender, uint32_t group, uint32_t type, uint32_t length, uint32_t source) {
return handle_message(trace, time, receiver, sender, group, type, length, source, false);
}
Process temp_sender = ParserDefinitionOTF::get_process_by_id(sender);
Process temp_receiver = ParserDefinitionOTF::get_process_by_id(receiver);
Process temp_ancestor = ParserDefinitionOTF::get_process_by_id(temp_sender._parent);
String sender_string = String(temp_sender._name);
String ancestor_string = String(temp_ancestor._name);
String receiver_string = String(temp_receiver._name);
int ParserEventOTF::handle_message(void *trace, uint64_t time, uint32_t receiver, uint32_t sender, uint32_t /*group*/, uint32_t /*type*/, uint32_t /*length*/, uint32_t source, bool is_sender_to_receiver) {
Trace *t = (Trace *)trace;
Date d = (double)time/(double)ParserDefinitionOTF::get_ticks_per_second();
/* Value */
string name = temp_sender._name + " to " + temp_receiver._name;
String name_string = String(name);
Process proc_sender = ParserDefinitionOTF::get_process_by_id(sender);
Process proc_receiver = ParserDefinitionOTF::get_process_by_id(receiver);
String proc_sender_string = String(proc_sender._name);
ostringstream link_type_oss;
link_type_oss << type;
String link_type_string = String(link_type_oss.str());
Container *temp_container = t->search_container(proc_sender_string);
ContainerType *temp_container_type = t->search_container_type(proc_sender_string);
map<std::string, Value *> extra_fields;
Name name_temp = Name(name, "");
LinkType *link_type = t->search_link_type(link_type_string);
Container *source_cont = t->search_container(sender_string);
Container *ancestor_cont = t->search_container(receiver_string);
string direction; /* recver -> sender or the other */
String type_name;
EventType *event_type = NULL;
ContainerType *source_type = t->search_container_type(sender_string);
ContainerType *destination_type = t->search_container_type(receiver_string);
ContainerType *ancestor_type = t->search_container_type(ancestor_string);
EntityValue *value_temp = NULL;
Name temp_name;
FileSource source_file;
if(source != 0) {
source_file = ParserDefinitionOTF::get_filesource_by_id(source);
}
EntityValue *value;
map<string, Value *> opt;
if(is_sender_to_receiver) {
direction = "send";
if(ancestor_type == 0) {
// No ancestor, we are in the shit...
ancestor_type = source_type;
}
else {
direction = "get";
if(ancestor_cont == 0) {
// No ancestor, we are in the shit...
ancestor_cont = source_cont;
}
if(link_type == 0) {
Name link_name = Name(link_type_oss.str(), "");
t->define_link_type(link_name, ancestor_type, destination_type, destination_type, opt);
link_type = t->search_link_type(link_type_string);
}
value = t->search_entity_value(name_string, link_type);
t->start_link(d, link_type, ancestor_cont, source_cont, value, name_string, opt);
return OTF_RETURN_OK;
}
int ParserEventOTF::handler_receive_message (void *trace, uint64_t time, uint32_t receiver, uint32_t sender, uint32_t group, uint32_t type, uint32_t length, uint32_t source) {
String::instantiate(direction, type_name);
Trace *t = (Trace *)trace;
Date d = (double)time/(double)ParserDefinitionOTF::get_ticks_per_second();
temp_name.set_name(direction);
Process temp_sender = ParserDefinitionOTF::get_process_by_id(sender);
Process temp_receiver = ParserDefinitionOTF::get_process_by_id(receiver);
Process temp_ancestor = ParserDefinitionOTF::get_process_by_id(temp_sender._parent);
String sender_string = String(temp_sender._name);
String ancestor_string = String(temp_ancestor._name);
String receiver_string = String(temp_receiver._name);
/* Value */
string name = temp_sender._name + " to " + temp_receiver._name;
String name_string = String(name);
event_type = t->search_event_type(type_name);
if(event_type == 0) {
// We create it
t->define_event_type(temp_name, temp_container_type, extra_fields);
event_type = t->search_event_type(type_name);
}
ostringstream link_type_oss;
link_type_oss << type;
String link_type_string = String(link_type_oss.str());
value_temp = t->search_entity_value(proc_sender_string, event_type);
Name name_temp = Name(name, "");
LinkType *link_type = t->search_link_type(link_type_string);
if(value_temp == 0) {
t->define_entity_value(temp_name, event_type, extra_fields);
value_temp = t->search_entity_value(type_name, event_type);
}
Container *source_cont = t->search_container(sender_string);
Container *destination_cont = t->search_container(receiver_string);
Container *ancestor_cont = t->search_container(ancestor_string);
ContainerType *destination_type = t->search_container_type(receiver_string);
ContainerType *ancestor_type = t->search_container_type(ancestor_string);
// Add the optional fields
if(is_sender_to_receiver) {
extra_fields["Receiver"] = new String(proc_receiver._name);
EntityValue *value;
map<string, Value *> opt;
if(ancestor_type == 0) {
// No ancestor, we are in the shit...
ancestor_type = destination_type;
}
else {
/* The prototypes of send_message and receive_message are not the same !! In one case it is the sender and the receiver and in the other it is the contrary */
extra_fields["Sender"] = new String(proc_receiver._name);
if(ancestor_cont == 0) {
// No ancestor, we are in the shit...
ancestor_cont = destination_cont;
}
if(source_file._name != "") {
extra_fields["Source file"] = new String(source_file._name);
if(link_type == 0) {
Name link_name = Name(link_type_oss.str(), "");
t->define_link_type(link_name, ancestor_type, destination_type, destination_type, opt);
link_type = t->search_link_type(link_type_string);
}
// Check if nothing is empty
if(event_type == 0) {
Error::set(Error::_UNKNOWN_EVENT_TYPE + direction, Error::_ERROR);
}
if(temp_container == 0) {
Error::set(Error::_UNKNOWN_CONTAINER + proc_sender._name, Error::_ERROR);
}
if(value_temp == 0) {
Error::set(Error::_UNKNOWN_ENTITY_VALUE + proc_sender._name, Error::_ERROR);
} if(temp_container_type == 0) {
Error::set(Error::_UNKNOWN_CONTAINER_TYPE + proc_sender._name, Error::_ERROR);
}
// Creation of the event
t->new_event(d, event_type, temp_container, value_temp, extra_fields);
value = t->search_entity_value(name_string, link_type);
t->end_link(d, link_type, ancestor_cont, destination_cont, value, name_string, opt);
return OTF_RETURN_OK;
}
......
......@@ -42,7 +42,7 @@
*/
/*!
*\file ParserEventOTF.hpp
*\brief This file contains the event OTF used by the ParserPaje.
*\brief This file contains the event parser used by the ParserOTF.
*/
#ifndef PARSEREVENTOTF_HPP
......@@ -57,7 +57,7 @@
/**
* \class ParserEventOTF
* \brief Reads Hash Table to find fill the Str
* \brief Reads Use handlers in order to fill the data structure
*
*/
......@@ -87,16 +87,47 @@ private:
public:
/*!
* \fn ParserEventOTF()
* \brief constructor
*/
ParserEventOTF();
/*!
* \fn ~ParserEventOTF()
* \brief constructor
*/
~ParserEventOTF();
/*!
* \fn set_handlers(Trace *t)
* \brief Create and set the handlers for the event parsing.
* \param t The trace we want to store in.
*/
void set_handlers(Trace *t);
/*!
* \fn read_definitions(OTF_Reader *reader)
* \brief Begin the reading of the events
* \param reader The main otf file we want to read in.
*/
int read_events(OTF_Reader *reader);
/*!
* \fn set_number_event_read_by_each_pass(OTF_Reader *reader, int number);
* \brief set the number of event we want to read by pass.
* Allow us to do a prevision for the remaining time.
* \param reader The main otf file we want to read in.
* \param number The number of events read.
*/
void set_number_event_read_by_each_pass(OTF_Reader *reader, int number);
/*!
* \fn get_size_loaded()
* \brief get the size already parsed.
* It is an approximation, we consider that parsing the definitions is in a constant time.
* \return the scale of the size already parsed. (between 0 and 1)
*/
static float get_size_loaded();
};
......
......@@ -61,11 +61,11 @@ void ParserOTF::parse(string filename, Trace &trace) {
int ret = 0;
if(manager == NULL) {
printf("manager failed\n");
cerr << QObject::tr("manager failed\n").toStdString() << endl;
return;
}
if(_reader == NULL) {
printf("open failed!!\n");
cerr << QObject::tr("open failed\n").toStdString() << endl;
return;
}
parserdefinition->set_handlers(&trace);
......@@ -79,7 +79,7 @@ void ParserOTF::parse(string filename, Trace &trace) {
while ((ret = parserevent->read_events(_reader)) != 0 && !_is_canceled) {
if(ret == -1) {
fprintf(stderr, "Error while reading events. Aborting\n");
cerr << QObject::tr("Error while reading events. Aborting").toStdString() << endl;
break;
}
}
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......
......@@ -28,7 +28,7 @@
** knowledge of the CeCILL-A license and that you accept its terms.
**
**
** ViTE developpers are (for version 0.* to 1.0):
** ViTE developers are (for version 0.* to 1.0):
**
** - COULOMB Kevin
** - FAVERGE Mathieu
......@@ -83,7 +83,7 @@ Render_area::Render_area(Render_opengl* render_instance, Interface_console* core