Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[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   Container* container_;
39   Type* type_;
40
41 protected:
42   Type* getType() { return type_; }
43   Container* getContainer() { return container_; }
44 public:
45   double timestamp_;
46   e_event_type eventType_;
47   PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
48       : container_(container), type_(type), timestamp_(timestamp), eventType_(eventType){};
49   virtual ~PajeEvent() = default;
50   virtual void print() = 0;
51   void insertIntoBuffer();
52 };
53
54 class VariableEvent : public PajeEvent {
55   double value;
56
57 public:
58   VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value);
59   void print() override;
60 };
61
62 class StateEvent : public PajeEvent {
63   EntityValue* value;
64   std::string filename;
65   int linenumber;
66   void* extra_ = nullptr;
67
68 public:
69   StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value);
70   StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, void* extra);
71   void print() override;
72 };
73
74 class LinkEvent : public PajeEvent {
75   Container* endpoint_;
76   std::string value_;
77   std::string key_;
78   int size_ = -1;
79
80 public:
81   LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
82             std::string key);
83   LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
84             std::string key, int size);
85   void print() override;
86 };
87
88 class NewEvent : public PajeEvent {
89   EntityValue* val;
90
91 public:
92   NewEvent(double timestamp, Container* container, Type* type, EntityValue* val);
93   void print() override;
94 };
95 }
96 }
97 #endif