Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c3f43c3d9512e1281a58505b9520554128e54d06
[simgrid.git] / src / instr / instr_paje_events.hpp
1 /* Copyright (c) 2010-2018. 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_EVENTS_HPP
7 #define INSTR_PAJE_EVENTS_HPP
8
9 #include "src/instr/instr_private.hpp"
10 #include <string>
11
12 namespace simgrid {
13 namespace instr {
14 class EntityValue;
15 class TIData;
16
17 enum e_event_type : unsigned int {
18   PAJE_DefineContainerType,
19   PAJE_DefineVariableType,
20   PAJE_DefineStateType,
21   PAJE_DefineEventType,
22   PAJE_DefineLinkType,
23   PAJE_DefineEntityValue,
24   PAJE_CreateContainer,
25   PAJE_DestroyContainer,
26   PAJE_SetVariable,
27   PAJE_AddVariable,
28   PAJE_SubVariable,
29   PAJE_SetState,
30   PAJE_PushState,
31   PAJE_PopState,
32   PAJE_ResetState,
33   PAJE_StartLink,
34   PAJE_EndLink,
35   PAJE_NewEvent
36 };
37
38 class PajeEvent {
39   Container* container_;
40   Type* type_;
41
42 protected:
43   Type* getType() { return type_; }
44   Container* getContainer() { return container_; }
45 public:
46   double timestamp_;
47   e_event_type eventType_;
48   PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
49       : container_(container), type_(type), timestamp_(timestamp), eventType_(eventType){};
50   virtual ~PajeEvent() = default;
51   virtual void print() = 0;
52   void insertIntoBuffer();
53 };
54
55 class VariableEvent : public PajeEvent {
56   double value;
57
58 public:
59   VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value);
60   void print() override;
61 };
62
63 class StateEvent : public PajeEvent {
64   EntityValue* value;
65   std::string filename;
66   int linenumber = 0;
67   TIData* extra_ = nullptr;
68
69 public:
70   StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value);
71   StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra);
72   void print() override;
73 };
74
75 class LinkEvent : public PajeEvent {
76   Container* endpoint_;
77   std::string value_;
78   std::string key_;
79   int size_ = -1;
80
81 public:
82   LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
83             std::string key);
84   LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
85             std::string key, int size);
86   void print() override;
87 };
88
89 class NewEvent : public PajeEvent {
90   EntityValue* val;
91
92 public:
93   NewEvent(double timestamp, Container* container, Type* type, EntityValue* val);
94   void print() override;
95 };
96 }
97 }
98 #endif