1 /* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
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. */
6 #ifndef INSTR_PAJE_TYPES_HPP
7 #define INSTR_PAJE_TYPES_HPP
9 #include "src/instr/instr_private.hpp"
15 enum e_event_type : unsigned int;
32 std::map<std::string, Type*> children_;
34 Type(std::string name, std::string alias, std::string color, Type* father);
37 std::string getName() { return name_; }
38 const char* getCname() { return name_.c_str(); }
39 long long int getId() { return id_; }
40 bool isColored() { return not color_.empty(); }
42 Type* byName(std::string name);
44 ContainerType* getOrCreateContainerType(std::string name);
45 EventType* getOrCreateEventType(std::string name);
46 LinkType* getOrCreateLinkType(std::string name, Type* source, Type* dest);
47 StateType* getOrCreateStateType(std::string name);
48 VariableType* getOrCreateVariableType(std::string name, std::string color);
50 void logDefinition(e_event_type event_type);
51 void logDefinition(Type* source, Type* dest);
53 static ContainerType* createRootType();
54 static ContainerType* getRootType();
57 class ContainerType : public Type {
59 ContainerType(std::string name) : Type(name, name, "", nullptr){};
60 ContainerType(std::string name, Type* father);
63 class VariableType : public Type {
64 std::vector<VariableEvent*> events_;
67 VariableType(std::string name, std::string color, Type* father);
69 void setEvent(double timestamp, Container* container, double value);
70 void addEvent(double timestamp, Container* container, double value);
71 void subEvent(double timestamp, Container* container, double value);
74 class ValueType : public Type {
76 std::map<std::string, EntityValue*> values_;
77 ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){};
78 ValueType(std::string name, Type* father) : Type(name, name, "", father){};
80 void addEntityValue(std::string name, std::string color);
81 void addEntityValue(std::string name);
82 EntityValue* getEntityValue(std::string name);
85 class LinkType : public ValueType {
87 LinkType(std::string name, std::string alias, Type* father);
88 void startEvent(double timestamp, Container* source_container, Container* sourceContainer, std::string value,
90 void startEvent(double timestamp, Container* source_container, Container* sourceContainer, std::string value,
91 std::string key, int size);
92 void endEvent(double timestamp, Container* source_container, Container* destContainer, std::string value,
96 class EventType : public ValueType {
98 EventType(std::string name, Type* father);
101 class StateType : public ValueType {
102 std::vector<StateEvent*> events_;
105 StateType(std::string name, Type* father);
107 void setEvent(double timestamp, Container* container, std::string value_name);
108 void pushEvent(double timestamp, Container* container, std::string value_name);
109 void pushEvent(double timestamp, Container* container, std::string value_name, void* extra);
110 void popEvent(double timestamp, Container* container);