1 /* Copyright (c) 2010-2018. 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"
26 std::map<std::string, Type*> children_;
27 Container* issuer_ = nullptr;
28 std::stringstream stream_;
30 Type(std::string name, std::string alias, std::string color, Type* father);
33 std::string get_name() { return name_; }
34 const char* get_cname() { return name_.c_str(); }
35 long long int get_id() { return id_; }
36 bool isColored() { return not color_.empty(); }
38 Type* byName(std::string name);
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);
45 void setCallingContainer(Container* container) { issuer_ = container; }
47 void logDefinition(e_event_type event_type);
48 void logDefinition(Type* source, Type* dest);
51 class ContainerType : public Type {
53 explicit ContainerType(std::string name) : Type(name, name, "", nullptr){};
54 ContainerType(std::string name, Type* father);
57 class VariableType : public Type {
58 std::vector<VariableEvent*> events_;
60 VariableType(std::string name, std::string color, Type* father);
62 void setEvent(double timestamp, double value);
63 void addEvent(double timestamp, double value);
64 void subEvent(double timestamp, double value);
67 class ValueType : public Type {
69 std::map<std::string, EntityValue*> values_;
70 ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){};
71 ValueType(std::string name, Type* father) : Type(name, name, "", father){};
73 void addEntityValue(std::string name, std::string color);
74 void addEntityValue(std::string name);
75 EntityValue* getEntityValue(std::string name);
78 class LinkType : public ValueType {
80 LinkType(std::string name, std::string alias, Type* father);
81 void startEvent(Container* startContainer, std::string value, std::string key);
82 void startEvent(Container* startContainer, std::string value, std::string key, int size);
83 void endEvent(Container* endContainer, std::string value, std::string key);
86 class EventType : public ValueType {
88 EventType(std::string name, Type* father);
91 class StateType : public ValueType {
92 std::vector<StateEvent*> events_;
94 StateType(std::string name, Type* father);
96 void setEvent(std::string value_name);
97 void pushEvent(std::string value_name);
98 void pushEvent(std::string value_name, TIData* extra);
100 void popEvent(TIData* extra);