Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cosmetics: fix "Malformed whitespace in C++" spotted by codefactor.io.
[simgrid.git] / src / instr / instr_paje_containers.hpp
1 /* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef INSTR_PAJE_CONTAINERS_HPP
7 #define INSTR_PAJE_CONTAINERS_HPP
8
9 #include "src/instr/instr_private.hpp"
10 #include <string>
11
12 namespace simgrid {
13 namespace instr {
14 class Type;
15 class LinkType;
16 class StateType;
17 class VariableType;
18
19 class Container {
20   long long int id_;
21   std::string name_; /* Unique name of this container */
22
23 public:
24   Container(const std::string& name, const std::string& type_name, Container* father);
25   Container(const Container&) = delete;
26   Container& operator=(const Container&) = delete;
27   virtual ~Container();
28
29   Type* type_; /* Type of this container */
30   Container* father_;
31   std::map<std::string, Container*> children_;
32   kernel::routing::NetPoint* netpoint_ = nullptr;
33
34   static Container* by_name_or_null(const std::string& name);
35   static Container* by_name(const std::string& name);
36   const std::string& get_name() const { return name_; }
37   const char* get_cname() { return name_.c_str(); }
38   long long int get_id() { return id_; }
39   void remove_from_parent();
40   void log_creation();
41   void log_destruction();
42
43   StateType* get_state(const std::string& name);
44   LinkType* get_link(const std::string& name);
45   VariableType* get_variable(const std::string& name);
46   void create_child(const std::string& name, const std::string& type_name);
47   static Container* get_root();
48 };
49
50 class NetZoneContainer : public Container {
51 public:
52   NetZoneContainer(const std::string& name, unsigned int level, NetZoneContainer* father);
53 };
54
55 class RouterContainer : public Container {
56 public:
57   RouterContainer(const std::string& name, Container* father);
58 };
59
60 class HostContainer : public Container {
61 public:
62   HostContainer(simgrid::s4u::Host const& host, NetZoneContainer* father);
63 };
64 }
65 }
66 #endif