- char key[INSTR_DEFAULT_STR_SIZE];
- snprintf (key, INSTR_DEFAULT_STR_SIZE, "%s-%s-%s", name, source->id, dest->id);
- ret = newType (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 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());