1 /* Copyright (c) 2010-2020. 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_EVENTS_HPP
7 #define INSTR_PAJE_EVENTS_HPP
9 #include "src/instr/instr_private.hpp"
10 #include "src/internal_config.h"
20 enum e_event_type : unsigned int {
21 PAJE_DefineContainerType,
22 PAJE_DefineVariableType,
26 PAJE_DefineEntityValue,
28 PAJE_DestroyContainer,
42 Container* container_;
45 static xbt::signal<void(PajeEvent&)> on_creation;
46 static xbt::signal<void(PajeEvent const&)> on_destruction;
49 e_event_type eventType_;
50 std::stringstream stream_;
52 PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType);
55 Container* get_container() const { return container_; }
56 Type* get_type() const { return type_; }
58 virtual void print() = 0;
59 void insert_into_buffer();
62 class VariableEvent : public PajeEvent {
66 VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
67 : PajeEvent::PajeEvent(container, type, timestamp, event_type), value_(value)
70 void print() override { stream_ << " " << value_; }
73 class StateEvent : public PajeEvent {
76 std::string filename = "(null)";
79 std::unique_ptr<TIData> extra_;
82 static xbt::signal<void(StateEvent const&)> on_destruction;
83 StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra);
84 ~StateEvent() override { on_destruction(*this); }
85 bool has_extra() const { return extra_ != nullptr; }
86 void print() override;
89 class LinkEvent : public PajeEvent {
96 LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
97 const std::string& value, const std::string& key, int size)
98 : PajeEvent(container, type, SIMIX_get_clock(), event_type)
99 , endpoint_(sourceContainer)
105 void print() override;
108 class NewEvent : public PajeEvent {
112 NewEvent(double timestamp, Container* container, Type* type, EntityValue* value)
113 : PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), value(value)
116 void print() override;
119 } // namespace simgrid