Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
simplify the way states are used in high-level instr modules
[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 StateType;
16
17 class Container {
18   long long int id_;
19   std::string name_; /* Unique name of this container */
20 public:
21   Container(std::string name, std::string type_name, Container* father);
22   virtual ~Container();
23
24   Type* type_; /* Type of this container */
25   Container* father_;
26   std::map<std::string, Container*> children_;
27   sg_netpoint_t netpoint_ = nullptr;
28
29   static Container* byNameOrNull(std::string name);
30   static Container* byName(std::string name);
31   std::string getName() { return name_; }
32   const char* getCname() { return name_.c_str(); }
33   long long int getId() { return id_; }
34   void removeFromParent();
35   void logCreation();
36   void logDestruction();
37
38   StateType* getState(std::string name);
39   static Container* getRootContainer();
40 };
41
42 class NetZoneContainer : public Container {
43 public:
44   NetZoneContainer(std::string name, unsigned int level, NetZoneContainer* father);
45 };
46
47 class RouterContainer : public Container {
48 public:
49   RouterContainer(std::string name, Container* father);
50 };
51
52 class HostContainer : public Container {
53 public:
54   HostContainer(simgrid::s4u::Host& host, NetZoneContainer* father);
55 };
56 }
57 }
58 #endif