}
HostContainer::HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father)
- : Container::Container(host.get_cname(), "HOST", father)
+ : Container::Container(host.get_name(), "HOST", father)
{
xbt_assert(father, "Only the Root container has no father");
trivaNodeTypes.insert(type_->get_name());
}
-Container::Container(std::string name, std::string type_name, Container* father)
+Container::Container(std::string name, const std::string& type_name, Container* father)
: name_(std::move(name)), father_(father)
{
static long long int container_id = 0;
container_id++;
if (father_) {
- XBT_DEBUG("new container %s, child of %s", name.c_str(), father->name_.c_str());
+ XBT_DEBUG("new container %s, child of %s", get_cname(), father->get_cname());
if (not type_name.empty()) {
type_ = father_->type_->by_name_or_create<ContainerType>(type_name);
//register all kinds by name
if (not allContainers.emplace(name_, this).second)
- THROWF(tracing_error, 1, "container %s already present in allContainers data structure", name_.c_str());
+ THROWF(tracing_error, 1, "container %s already present in allContainers data structure", get_cname());
- XBT_DEBUG("Add container name '%s'", name_.c_str());
+ XBT_DEBUG("Add container name '%s'", get_cname());
//register NODE types for triva configuration
if (type_name == "LINK")
Container::~Container()
{
- XBT_DEBUG("destroy container %s", name_.c_str());
+ XBT_DEBUG("destroy container %s", get_cname());
// Begin with destroying my own children
for (auto child : children_)
delete child.second;
allContainers.erase(name_);
}
-void Container::create_child(std::string name, std::string type_name)
+void Container::create_child(std::string name, const std::string& type_name)
{
- new Container(std::move(name), std::move(type_name), this);
+ new Container(std::move(name), type_name, this);
}
Container* Container::by_name_or_null(const std::string& name)
StateType* Container::get_state(const std::string& name)
{
- StateType* ret = dynamic_cast<StateType*>(type_->by_name(name));
+ StateType* ret = static_cast<StateType*>(type_->by_name(name));
ret->set_calling_container(this);
return ret;
}
LinkType* Container::get_link(const std::string& name)
{
- LinkType* ret = dynamic_cast<LinkType*>(type_->by_name(name));
+ LinkType* ret = static_cast<LinkType*>(type_->by_name(name));
ret->set_calling_container(this);
return ret;
}
VariableType* Container::get_variable(const std::string& name)
{
- VariableType* ret = dynamic_cast<VariableType*>(type_->by_name(name));
+ VariableType* ret = static_cast<VariableType*>(type_->by_name(name));
ret->set_calling_container(this);
return ret;
}