- if (not color) {
- char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1";
- ret = new Type (name, name, white, TYPE_VARIABLE, father);
- }else{
- ret = new Type (name, name, color, TYPE_VARIABLE, father);
+void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key, int size)
+{
+ new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, key, size);
+}
+
+void LinkType::end_event(Container* endContainer, const std::string& value, const std::string& key)
+{
+ new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key, -1);
+}
+
+void Type::log_definition(e_event_type event_type)
+{
+ if (trace_format != simgrid::instr::TraceFormat::Paje)
+ return;
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event_type, TRACE_precision(), 0.);
+ stream_ << event_type << " " << get_id() << " " << father_->get_id() << " " << get_name();
+ if (is_colored())
+ stream_ << " \"" << color_ << "\"";
+ XBT_DEBUG("Dump %s", stream_.str().c_str());
+ tracing_file << stream_.str() << std::endl;
+}
+
+void Type::log_definition(simgrid::instr::Type* source, simgrid::instr::Type* dest)
+{
+ if (trace_format != simgrid::instr::TraceFormat::Paje)
+ return;
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, TRACE_precision(), 0.);
+ stream_ << PAJE_DefineLinkType << " " << get_id() << " " << father_->get_id() << " " << source->get_id();
+ stream_ << " " << dest->get_id() << " " << get_name();
+ XBT_DEBUG("Dump %s", stream_.str().c_str());
+ tracing_file << stream_.str() << std::endl;
+}
+
+Type* Type::by_name(const std::string& name)
+{
+ Type* ret = nullptr;
+ for (auto const& elm : children_) {
+ if (elm.second->name_ == name) {
+ if (ret != nullptr) {
+ THROWF (tracing_error, 0, "there are two children types with the same name?");
+ } else {
+ ret = elm.second.get();
+ }
+ }