Logo AND Algorithmique Numérique Distribuée

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