-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_containers, instr, "Paje tracing event system (containers)");
-static container_t rootContainer = nullptr; /* the root container */
-static std::map<std::string, container_t> allContainers; /* all created containers indexed by name */
-
namespace simgrid {
namespace instr {
-long long int new_paje_id()
-{
- static long long int type_id = 0;
- return type_id++;
-}
-
-Container* Container::get_root()
-{
- return rootContainer;
-}
+Container* Container::root_container_ = nullptr; /* the root container */
+std::map<std::string, Container*, std::less<>> Container::all_containers_; /* all created containers indexed by name */
NetZoneContainer::NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father)
: Container::Container(name, "", father)
on_creation(*this);
} else {
type_ = new ContainerType("0");
- rootContainer = this;
+ set_root(this);
}
}
}
//register all kinds by name
- if (not allContainers.emplace(name_, this).second)
+ if (not all_containers_.emplace(name_, this).second)
throw TracingError(XBT_THROW_POINT,
- xbt::string_printf("container %s already present in allContainers data structure", get_cname()));
+ xbt::string_printf("container %s already present in all_containers_", get_cname()));
XBT_DEBUG("Add container name '%s'", get_cname());
}
for (auto child : children_)
delete child.second;
- // remove me from the allContainers data structure
- allContainers.erase(name_);
+ // remove me from the all_containers_ data structure
+ all_containers_.erase(name_);
// obligation to dump previous events because they might reference the container that is about to be destroyed
last_timestamp_to_dump = SIMIX_get_clock();
Container* Container::by_name_or_null(const std::string& name)
{
- auto cont = allContainers.find(name);
- return cont == allContainers.end() ? nullptr : cont->second;
+ auto cont = all_containers_.find(name);
+ return cont == all_containers_.end() ? nullptr : cont->second;
}
Container* Container::by_name(const std::string& name)
EntityValue::EntityValue(const std::string& name, const std::string& color, Type* father)
: name_(name), color_(color), father_(father)
{
- id_ = simgrid::instr::new_paje_id();
on_creation(*this);
}