X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/22e5e3137c9c96940f1bd2ef05487bc35fddc262..cc735fda92d738d39f1017a15afb3ac7acd6b47c:/src/instr/instr_paje_containers.hpp diff --git a/src/instr/instr_paje_containers.hpp b/src/instr/instr_paje_containers.hpp index 8f3fc3f001..52a2b2d816 100644 --- a/src/instr/instr_paje_containers.hpp +++ b/src/instr/instr_paje_containers.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2020. 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. */ @@ -12,45 +12,61 @@ namespace simgrid { namespace instr { class Type; +class LinkType; +class StateType; +class VariableType; class Container { + static Container* root_container_; + static std::map all_containers_; + long long int id_; std::string name_; /* Unique name of this container */ + +protected: + static void set_root(Container* root) { root_container_ = root; } + public: - Container(std::string name, std::string type_name, Container* father); + static xbt::signal on_creation; + static xbt::signal on_destruction; + + explicit Container(const std::string& name, const std::string& type_name, Container* father); + Container(const Container&) = delete; + Container& operator=(const Container&) = delete; virtual ~Container(); Type* type_; /* Type of this container */ Container* father_; std::map children_; - sg_netpoint_t netpoint_ = nullptr; - - static Container* byNameOrNull(std::string name); - static Container* byName(std::string name); - std::string getName() { return name_; } - const char* getCname() { return name_.c_str(); } - long long int getId() { return id_; } - void removeFromParent(); - void logCreation(); - void logDestruction(); - - static Container* getRootContainer(); + + static Container* by_name_or_null(const std::string& name); + static Container* by_name(const std::string& name); + const std::string& get_name() const { return name_; } + const char* get_cname() const { return name_.c_str(); } + long long int get_id() const { return id_; } + void remove_from_parent(); + + StateType* get_state(const std::string& name); + LinkType* get_link(const std::string& name); + VariableType* get_variable(const std::string& name); + void create_child(const std::string& name, const std::string& type_name); + static Container* get_root() { return root_container_; } }; class NetZoneContainer : public Container { public: - NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father); + NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father); }; class RouterContainer : public Container { public: - RouterContainer(std::string name, Container* father); + RouterContainer(const std::string& name, Container* father); }; class HostContainer : public Container { public: - HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father); + HostContainer(s4u::Host const& host, NetZoneContainer* father); }; -} -} +} // namespace instr +} // namespace simgrid #endif