Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify link events and rename getRootContainer to getRoot
[simgrid.git] / src / instr / instr_paje_containers.hpp
1 /* Copyright (c) 2010-2017. 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 public:
23   Container(std::string name, std::string type_name, Container* father);
24   virtual ~Container();
25
26   Type* type_; /* Type of this container */
27   Container* father_;
28   std::map<std::string, Container*> children_;
29   sg_netpoint_t netpoint_ = nullptr;
30
31   static Container* byNameOrNull(std::string name);
32   static Container* byName(std::string name);
33   std::string getName() { return name_; }
34   const char* getCname() { return name_.c_str(); }
35   long long int getId() { return id_; }
36   void removeFromParent();
37   void logCreation();
38   void logDestruction();
39
40   StateType* getState(std::string name);
41   LinkType* getLink(std::string name);
42   VariableType* getVariable(std::string name);
43
44   static Container* getRoot();
45 };
46
47 class NetZoneContainer : public Container {
48 public:
49   NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father);
50 };
51
52 class RouterContainer : public Container {
53 public:
54   RouterContainer(std::string name, Container* father);
55 };
56
57 class HostContainer : public Container {
58 public:
59   HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father);
60 };
61 }
62 }
63 #endif