Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move namespace out of extern "C" block.
[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(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value);
70   StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value,
71              void* 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(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
83             std::string value, std::string key);
84   LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
85             std::string value, 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
99 #endif