Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f1d24c24bd3138eb1f1d762275a82095aa18d63c
[simgrid.git] / src / instr / instr_paje_types.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_TYPES_HPP
7 #define INSTR_PAJE_TYPES_HPP
8
9 #include "src/instr/instr_private.hpp"
10 namespace simgrid {
11 namespace instr {
12 enum e_event_type : unsigned int;
13 class EntityValue;
14 class ContainerType;
15 class EventType;
16 class LinkType;
17 class StateType;
18 class VariableType;
19
20 class Type {
21   long long int id_;
22   std::string name_;
23   std::string color_;
24   Type* father_;
25
26 public:
27   std::map<std::string, Type*> children_;
28
29   Type(std::string name, std::string alias, std::string color, Type* father);
30   virtual ~Type();
31
32   std::string getName() { return name_; }
33   const char* getCname() { return name_.c_str(); }
34   long long int getId() { return id_; }
35   bool isColored() { return not color_.empty(); }
36
37   Type* byName(std::string name);
38
39   ContainerType* getOrCreateContainerType(std::string name);
40   EventType* getOrCreateEventType(std::string name);
41   LinkType* getOrCreateLinkType(std::string name, Type* source, Type* dest);
42   StateType* getOrCreateStateType(std::string name);
43   VariableType* getOrCreateVariableType(std::string name, std::string color);
44
45   void logDefinition(e_event_type event_type);
46   void logDefinition(Type* source, Type* dest);
47
48   static ContainerType* createRootType();
49   static ContainerType* getRootType();
50 };
51
52 class ContainerType : public Type {
53 public:
54   ContainerType(std::string name, Type* father);
55 };
56
57 class VariableType : public Type {
58 public:
59   VariableType(std::string name, std::string color, Type* father);
60 };
61
62 class ValueType : public Type {
63 public:
64   std::map<std::string, EntityValue*> values_;
65   ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){};
66   ValueType(std::string name, Type* father) : Type(name, name, "", father){};
67   virtual ~ValueType();
68   void addEntityValue(std::string name, std::string color);
69   void addEntityValue(std::string name);
70   EntityValue* getEntityValue(std::string name);
71 };
72
73 class LinkType : public ValueType {
74 public:
75   LinkType(std::string name, std::string alias, Type* father);
76 };
77
78 class EventType : public ValueType {
79 public:
80   EventType(std::string name, Type* father);
81 };
82
83 class StateType : public ValueType {
84 public:
85   StateType(std::string name, Type* father);
86 };
87 }
88 }
89 #endif