- char key[INSTR_DEFAULT_STR_SIZE];
- snprintf(key, INSTR_DEFAULT_STR_SIZE, "%s-%s-%s", name, source->id_, dest->id_);
- ret = new Type (name, key, nullptr, TYPE_LINK, father);
- XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name_, ret->id_, father->name_, father->id_,
- source->name_, source->id_, dest->name_, dest->id_);
- LogLinkTypeDefinition(ret, source, dest);
+void LinkType::end_event(Container* endContainer, std::string value, 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(std::string name)
+{
+ Type* ret = nullptr;
+ for (auto 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;
+ }
+ }
+ }
+ if (ret == nullptr)
+ THROWF(tracing_error, 2, "type with name (%s) not found in father type (%s)", name.c_str(), get_cname());