Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Enum class for Paje event types.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 18 Nov 2020 20:08:35 +0000 (21:08 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 18 Nov 2020 21:32:51 +0000 (22:32 +0100)
src/instr/instr_config.cpp
src/instr/instr_paje_events.cpp
src/instr/instr_paje_events.hpp
src/instr/instr_paje_header.cpp
src/instr/instr_paje_trace.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_types.hpp

index a1be187..cf95509 100644 (file)
@@ -218,7 +218,7 @@ int trace_precision;
  *************/
 xbt::signal<void(Container const&)> Container::on_creation;
 xbt::signal<void(Container const&)> Container::on_destruction;
-xbt::signal<void(Type const&, e_event_type)> Type::on_creation;
+xbt::signal<void(Type const&, PajeEventType)> Type::on_creation;
 xbt::signal<void(LinkType const&, Type const&, Type const&)> LinkType::on_creation;
 xbt::signal<void(PajeEvent&)> PajeEvent::on_creation;
 xbt::signal<void(PajeEvent const&)> PajeEvent::on_destruction;
@@ -230,9 +230,10 @@ static void on_container_creation_paje(const Container& c)
   double timestamp = SIMIX_get_clock();
   std::stringstream stream;
 
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, timestamp);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, static_cast<unsigned>(PajeEventType::CreateContainer),
+            timestamp);
 
-  stream << std::fixed << std::setprecision(trace_precision) << PAJE_CreateContainer << " ";
+  stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::CreateContainer << " ";
   stream << timestamp << " " << c.get_id() << " " << c.type_->get_id() << " " << c.father_->get_id() << " \"";
   if (c.get_name().find("rank-") != 0)
     stream << c.get_name() << "\"";
@@ -251,9 +252,10 @@ static void on_container_destruction_paje(const Container& c)
     std::stringstream stream;
     double timestamp = SIMIX_get_clock();
 
-    XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_DestroyContainer, timestamp);
+    XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, static_cast<unsigned>(PajeEventType::DestroyContainer),
+              timestamp);
 
-    stream << std::fixed << std::setprecision(trace_precision) << PAJE_DestroyContainer << " ";
+    stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::DestroyContainer << " ";
     stream << timestamp << " " << c.type_->get_id() << " " << c.get_id();
     XBT_DEBUG("Dump %s", stream.str().c_str());
     tracing_file << stream.str() << std::endl;
@@ -262,7 +264,8 @@ static void on_container_destruction_paje(const Container& c)
 
 static void on_container_creation_ti(const Container& c)
 {
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, SIMIX_get_clock());
+  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, static_cast<unsigned>(PajeEventType::CreateContainer),
+            SIMIX_get_clock());
   // if we are in the mode with only one file
   static std::ofstream* ti_unique_file = nullptr;
 
@@ -300,8 +303,8 @@ static void on_container_destruction_ti(const Container& c)
 static void on_entity_value_creation(const EntityValue& value)
 {
   std::stringstream stream;
-  XBT_DEBUG("%s: event_type=%u", __func__, PAJE_DefineEntityValue);
-  stream << std::fixed << std::setprecision(trace_precision) << PAJE_DefineEntityValue;
+  XBT_DEBUG("%s: event_type=%u", __func__, static_cast<unsigned>(PajeEventType::DefineEntityValue));
+  stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::DefineEntityValue;
   stream << " " << value.get_id() << " " << value.get_father()->get_id() << " " << value.get_name();
   if (not value.get_color().empty())
     stream << " \"" << value.get_color() << "\"";
@@ -311,7 +314,8 @@ static void on_entity_value_creation(const EntityValue& value)
 
 static void on_event_creation(PajeEvent& event)
 {
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event.eventType_, trace_precision, event.timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(event.eventType_), trace_precision,
+            event.timestamp_);
   event.stream_ << std::fixed << std::setprecision(trace_precision);
   event.stream_ << event.eventType_ << " " << event.timestamp_ << " ";
   event.stream_ << event.get_type()->get_id() << " " << event.get_container()->get_id();
@@ -329,14 +333,14 @@ static void on_state_event_destruction(const StateEvent& event)
     *tracing_files.at(event.get_container()) << event.stream_.str() << std::endl;
 }
 
-static void on_type_creation(const Type& type, e_event_type event_type)
+static void on_type_creation(const Type& type, PajeEventType event_type)
 {
-  if (event_type == PAJE_DefineLinkType)
+  if (event_type == PajeEventType::DefineLinkType)
     return; // this kind of type has to be handled differently
 
   std::stringstream stream;
   stream << std::fixed << std::setprecision(trace_precision);
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event_type, trace_precision, 0.);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(event_type), trace_precision, 0.);
   stream << event_type << " " << type.get_id() << " " << type.get_father()->get_id() << " " << type.get_name();
   if (type.is_colored())
     stream << " \"" << type.get_color() << "\"";
@@ -347,8 +351,9 @@ static void on_type_creation(const Type& type, e_event_type event_type)
 static void on_link_type_creation(const Type& type, const Type& source, const Type& dest)
 {
   std::stringstream stream;
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, trace_precision, 0.);
-  stream << PAJE_DefineLinkType << " " << type.get_id() << " " << type.get_father()->get_id();
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(PajeEventType::DefineLinkType),
+            trace_precision, 0.);
+  stream << PajeEventType::DefineLinkType << " " << type.get_id() << " " << type.get_father()->get_id();
   stream << " " << source.get_id() << " " << dest.get_id() << " " << type.get_name();
   XBT_DEBUG("Dump %s", stream.str().c_str());
   tracing_file << stream.str() << std::endl;
index 6ba97ee..d469422 100644 (file)
@@ -13,7 +13,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_events, instr, "Paje tracing event sy
 namespace simgrid {
 namespace instr {
 
-PajeEvent::PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
+PajeEvent::PajeEvent(Container* container, Type* type, double timestamp, PajeEventType eventType)
     : container_(container), type_(type), timestamp_(timestamp), eventType_(eventType)
 {
   on_creation(*this);
@@ -25,7 +25,7 @@ PajeEvent::~PajeEvent()
   on_destruction(*this);
 }
 
-StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra)
+StateEvent::StateEvent(Container* container, Type* type, PajeEventType event_type, EntityValue* value, TIData* extra)
     : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra)
 {
 #if HAVE_SMPI
@@ -53,7 +53,7 @@ void LinkEvent::print()
 void StateEvent::print()
 {
   if (trace_format == TraceFormat::Paje) {
-    if (value != nullptr) // PAJE_PopState Event does not need to have a value
+    if (value != nullptr) // PajeEventType::PopState Event does not need to have a value
       stream_ << " " << value->get_id();
 
     if (TRACE_display_sizes())
index 2527bd7..dd24ec5 100644 (file)
@@ -17,27 +17,32 @@ namespace instr {
 class EntityValue;
 class TIData;
 
-enum e_event_type : unsigned int {
-  PAJE_DefineContainerType,
-  PAJE_DefineVariableType,
-  PAJE_DefineStateType,
-  PAJE_DefineEventType,
-  PAJE_DefineLinkType,
-  PAJE_DefineEntityValue,
-  PAJE_CreateContainer,
-  PAJE_DestroyContainer,
-  PAJE_SetVariable,
-  PAJE_AddVariable,
-  PAJE_SubVariable,
-  PAJE_SetState,
-  PAJE_PushState,
-  PAJE_PopState,
-  PAJE_ResetState,
-  PAJE_StartLink,
-  PAJE_EndLink,
-  PAJE_NewEvent
+enum class PajeEventType : unsigned int {
+  DefineContainerType,
+  DefineVariableType,
+  DefineStateType,
+  DefineEventType,
+  DefineLinkType,
+  DefineEntityValue,
+  CreateContainer,
+  DestroyContainer,
+  SetVariable,
+  AddVariable,
+  SubVariable,
+  SetState,
+  PushState,
+  PopState,
+  ResetState,
+  StartLink,
+  EndLink,
+  NewEvent
 };
 
+inline std::ostream& operator<<(std::ostream& os, PajeEventType event)
+{
+  return os << static_cast<std::underlying_type<PajeEventType>::type>(event);
+}
+
 class PajeEvent {
   Container* container_;
   Type* type_;
@@ -46,10 +51,10 @@ public:
   static xbt::signal<void(PajeEvent const&)> on_destruction;
 
   double timestamp_;
-  e_event_type eventType_;
+  PajeEventType eventType_;
   std::stringstream stream_;
 
-  PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType);
+  PajeEvent(Container* container, Type* type, double timestamp, PajeEventType eventType);
   virtual ~PajeEvent();
 
   Container* get_container() const { return container_; }
@@ -63,7 +68,7 @@ class VariableEvent : public PajeEvent {
   double value_;
 
 public:
-  VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
+  VariableEvent(double timestamp, Container* container, Type* type, PajeEventType event_type, double value)
       : PajeEvent::PajeEvent(container, type, timestamp, event_type), value_(value)
   {
   }
@@ -80,7 +85,7 @@ class StateEvent : public PajeEvent {
 
 public:
   static xbt::signal<void(StateEvent const&)> on_destruction;
-  StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra);
+  StateEvent(Container* container, Type* type, PajeEventType event_type, EntityValue* value, TIData* extra);
   ~StateEvent() override { on_destruction(*this); }
   bool has_extra() const { return extra_ != nullptr; }
   void print() override;
@@ -93,7 +98,7 @@ class LinkEvent : public PajeEvent {
   int size_ = -1;
 
 public:
-  LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
+  LinkEvent(Container* container, Type* type, PajeEventType event_type, Container* sourceContainer,
             const std::string& value, const std::string& key, int size)
       : PajeEvent(container, type, SIMIX_get_clock(), event_type)
       , endpoint_(sourceContainer)
@@ -110,7 +115,7 @@ class NewEvent : public PajeEvent {
 
 public:
   NewEvent(double timestamp, Container* container, Type* type, EntityValue* value)
-      : PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), value(value)
+      : PajeEvent::PajeEvent(container, type, timestamp, PajeEventType::NewEvent), value(value)
   {
   }
   void print() override;
index 5944628..73f4559 100644 (file)
@@ -45,7 +45,7 @@ void dump_comment_file(const std::string& filename)
 void dump_header(bool basic, bool display_sizes)
 {
   // Types
-  tracing_file << "%EventDef PajeDefineContainerType " << PAJE_DefineContainerType << std::endl;
+  tracing_file << "%EventDef PajeDefineContainerType " << PajeEventType::DefineContainerType << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   if (basic)
     tracing_file << "%       ContainerType string" << std::endl;
@@ -55,26 +55,26 @@ void dump_header(bool basic, bool display_sizes)
   tracing_file << "%       Name string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeDefineVariableType " << PAJE_DefineVariableType << std::endl;
+  tracing_file << "%EventDef PajeDefineVariableType " << PajeEventType::DefineVariableType << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   tracing_file << "%       " << (basic ? "Container" : "") << "Type string" << std::endl;
   tracing_file << "%       Name string" << std::endl;
   tracing_file << "%       Color color" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeDefineStateType " << PAJE_DefineStateType << std::endl;
+  tracing_file << "%EventDef PajeDefineStateType " << PajeEventType::DefineStateType << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   tracing_file << "%       " << (basic ? "Container" : "") << "Type string" << std::endl;
   tracing_file << "%       Name string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeDefineEventType " << PAJE_DefineEventType << std::endl;
+  tracing_file << "%EventDef PajeDefineEventType " << PajeEventType::DefineEventType << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   tracing_file << "%       " << (basic ? "Container" : "") << "Type string" << std::endl;
   tracing_file << "%       Name string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeDefineLinkType " << PAJE_DefineLinkType << std::endl;
+  tracing_file << "%EventDef PajeDefineLinkType " << PajeEventType::DefineLinkType << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   tracing_file << "%       " << (basic ? "Container" : "") << "Type string" << std::endl;
   tracing_file << "%       " << (basic ? "Source" : "Start") << "ContainerType string" << std::endl;
@@ -83,7 +83,7 @@ void dump_header(bool basic, bool display_sizes)
   tracing_file << "%EndEventDef" << std::endl;
 
   // EntityValue
-  tracing_file << "%EventDef PajeDefineEntityValue " << PAJE_DefineEntityValue << std::endl;
+  tracing_file << "%EventDef PajeDefineEntityValue " << PajeEventType::DefineEntityValue << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   tracing_file << "%       " << (basic ? "Entity" : "") << "Type string" << std::endl;
   tracing_file << "%       Name string" << std::endl;
@@ -91,7 +91,7 @@ void dump_header(bool basic, bool display_sizes)
   tracing_file << "%EndEventDef" << std::endl;
 
   // Container
-  tracing_file << "%EventDef PajeCreateContainer " << PAJE_CreateContainer << std::endl;
+  tracing_file << "%EventDef PajeCreateContainer " << PajeEventType::CreateContainer << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Alias string" << std::endl;
   tracing_file << "%       Type string" << std::endl;
@@ -99,28 +99,28 @@ void dump_header(bool basic, bool display_sizes)
   tracing_file << "%       Name string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeDestroyContainer " << PAJE_DestroyContainer << std::endl;
+  tracing_file << "%EventDef PajeDestroyContainer " << PajeEventType::DestroyContainer << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Name string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
   // Variable
-  tracing_file << "%EventDef PajeSetVariable " << PAJE_SetVariable << std::endl;
+  tracing_file << "%EventDef PajeSetVariable " << PajeEventType::SetVariable << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
   tracing_file << "%       Value double" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeAddVariable " << PAJE_AddVariable << std::endl;
+  tracing_file << "%EventDef PajeAddVariable " << PajeEventType::AddVariable << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
   tracing_file << "%       Value double" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeSubVariable " << PAJE_SubVariable << std::endl;
+  tracing_file << "%EventDef PajeSubVariable " << PajeEventType::SubVariable << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
@@ -128,14 +128,14 @@ void dump_header(bool basic, bool display_sizes)
   tracing_file << "%EndEventDef" << std::endl;
 
   // State
-  tracing_file << "%EventDef PajeSetState " << PAJE_SetState << std::endl;
+  tracing_file << "%EventDef PajeSetState " << PajeEventType::SetState << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
   tracing_file << "%       Value string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajePushState " << PAJE_PushState << std::endl;
+  tracing_file << "%EventDef PajePushState " << PajeEventType::PushState << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
@@ -151,14 +151,14 @@ void dump_header(bool basic, bool display_sizes)
 #endif
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajePopState " << PAJE_PopState << std::endl;
+  tracing_file << "%EventDef PajePopState " << PajeEventType::PopState << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
   if (not basic) {
-    tracing_file << "%EventDef PajeResetState " << PAJE_ResetState << std::endl;
+    tracing_file << "%EventDef PajeResetState " << PajeEventType::ResetState << std::endl;
     tracing_file << "%       Time date" << std::endl;
     tracing_file << "%       Type string" << std::endl;
     tracing_file << "%       Container string" << std::endl;
@@ -166,7 +166,7 @@ void dump_header(bool basic, bool display_sizes)
   }
 
   // Link
-  tracing_file << "%EventDef PajeStartLink " << PAJE_StartLink << std::endl;
+  tracing_file << "%EventDef PajeStartLink " << PajeEventType::StartLink << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
@@ -177,7 +177,7 @@ void dump_header(bool basic, bool display_sizes)
     tracing_file << "%       Size int" << std::endl;
   tracing_file << "%EndEventDef" << std::endl;
 
-  tracing_file << "%EventDef PajeEndLink " << PAJE_EndLink << std::endl;
+  tracing_file << "%EventDef PajeEndLink " << PajeEventType::EndLink << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
@@ -187,7 +187,7 @@ void dump_header(bool basic, bool display_sizes)
   tracing_file << "%EndEventDef" << std::endl;
 
   // Event
-  tracing_file << "%EventDef PajeNewEvent " << PAJE_NewEvent << std::endl;
+  tracing_file << "%EventDef PajeNewEvent " << PajeEventType::NewEvent << std::endl;
   tracing_file << "%       Time date" << std::endl;
   tracing_file << "%       Type string" << std::endl;
   tracing_file << "%       Container string" << std::endl;
index 1c6c1c4..44dc1ea 100644 (file)
@@ -49,11 +49,12 @@ void dump_buffer(bool force)
 /* internal do the instrumentation module */
 void PajeEvent::insert_into_buffer()
 {
-  XBT_DEBUG("%s: insert event_type=%u, timestamp=%f, buffersize=%zu)", __func__, eventType_, timestamp_, buffer.size());
+  XBT_DEBUG("%s: insert event_type=%u, timestamp=%f, buffersize=%zu)", __func__, static_cast<unsigned>(eventType_),
+            timestamp_, buffer.size());
   std::vector<PajeEvent*>::reverse_iterator i;
   for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
     PajeEvent* e1 = *i;
-    XBT_DEBUG("compare to %p is of type %u; timestamp:%f", e1, e1->eventType_, e1->timestamp_);
+    XBT_DEBUG("compare to %p is of type %u; timestamp:%f", e1, static_cast<unsigned>(e1->eventType_), e1->timestamp_);
     if (e1->timestamp_ <= timestamp_)
       break;
   }
index 213c45b..a075804 100644 (file)
@@ -21,7 +21,7 @@ long long int new_paje_id()
   return type_id++;
 }
 
-Type::Type(e_event_type event_type, const std::string& name, const std::string& alias, const std::string& color,
+Type::Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
            Type* father)
     : name_(name), color_(color), father_(father)
 {
@@ -37,17 +37,18 @@ Type::Type(e_event_type event_type, const std::string& name, const std::string&
 
 void StateType::set_event(const std::string& value_name)
 {
-  events_.push_back(new StateEvent(get_issuer(), this, PAJE_SetState, get_entity_value(value_name), nullptr));
+  events_.push_back(new StateEvent(get_issuer(), this, PajeEventType::SetState, get_entity_value(value_name), nullptr));
 }
 
 void StateType::push_event(const std::string& value_name, TIData* extra)
 {
-  events_.push_back(new StateEvent(get_issuer(), this, PAJE_PushState, get_entity_value(value_name), extra));
+  events_.push_back(new StateEvent(get_issuer(), this, PajeEventType::PushState, get_entity_value(value_name), extra));
 }
 
 void StateType::push_event(const std::string& value_name)
 {
-  events_.push_back(new StateEvent(get_issuer(), this, PAJE_PushState, get_entity_value(value_name), nullptr));
+  events_.push_back(
+      new StateEvent(get_issuer(), this, PajeEventType::PushState, get_entity_value(value_name), nullptr));
 }
 
 void StateType::pop_event()
@@ -57,7 +58,7 @@ void StateType::pop_event()
 
 void StateType::pop_event(TIData* extra)
 {
-  events_.push_back(new StateEvent(get_issuer(), this, PAJE_PopState, nullptr, extra));
+  events_.push_back(new StateEvent(get_issuer(), this, PajeEventType::PopState, nullptr, extra));
 }
 
 void VariableType::instr_event(double now, double delta, const char* resource, double value)
@@ -82,17 +83,17 @@ void VariableType::instr_event(double now, double delta, const char* resource, d
 
 void VariableType::set_event(double timestamp, double value)
 {
-  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_SetVariable, value));
+  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PajeEventType::SetVariable, value));
 }
 
 void VariableType::add_event(double timestamp, double value)
 {
-  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_AddVariable, value));
+  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PajeEventType::AddVariable, value));
 }
 
 void VariableType::sub_event(double timestamp, double value)
 {
-  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_SubVariable, value));
+  events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PajeEventType::SubVariable, value));
 }
 
 void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key)
@@ -102,12 +103,12 @@ void LinkType::start_event(Container* startContainer, const std::string& value,
 
 void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key, int size)
 {
-  new LinkEvent(get_issuer(), this, PAJE_StartLink, startContainer, value, key, size);
+  new LinkEvent(get_issuer(), this, PajeEventType::StartLink, startContainer, value, key, size);
 }
 
 void LinkType::end_event(Container* endContainer, const std::string& value, const std::string& key)
 {
-  new LinkEvent(get_issuer(), this, PAJE_EndLink, endContainer, value, key, -1);
+  new LinkEvent(get_issuer(), this, PajeEventType::EndLink, endContainer, value, key, -1);
 }
 
 Type* Type::by_name(const std::string& name)
index 269175c..9b69640 100644 (file)
@@ -30,9 +30,9 @@ protected:
   Container* get_issuer() const { return issuer_; }
 
 public:
-  static xbt::signal<void(Type const&, e_event_type event_type)> on_creation;
+  static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
 
-  Type(e_event_type event_type, const std::string& name, const std::string& alias, const std::string& color,
+  Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
        Type* father);
   virtual ~Type() = default;
 
@@ -63,15 +63,16 @@ public:
 
 class ContainerType : public Type {
 public:
-  explicit ContainerType(const std::string& name) : Type(PAJE_DefineContainerType, name, name, "", nullptr){};
-  ContainerType(const std::string& name, Type* father) : Type(PAJE_DefineContainerType, name, name, "", father){};
+  explicit ContainerType(const std::string& name) : Type(PajeEventType::DefineContainerType, name, name, "", nullptr){};
+  ContainerType(const std::string& name, Type* father)
+      : Type(PajeEventType::DefineContainerType, name, name, "", father){};
 };
 
 class VariableType : public Type {
   std::vector<VariableEvent*> events_;
 public:
   VariableType(const std::string& name, const std::string& color, Type* father)
-      : Type(PAJE_DefineVariableType, name, name, color, father)
+      : Type(PajeEventType::DefineVariableType, name, name, color, father)
   {
   }
   void instr_event(double now, double delta, const char* resource, double value);
@@ -83,9 +84,9 @@ public:
 class ValueType : public Type {
 public:
   std::map<std::string, EntityValue> values_;
-  ValueType(e_event_type event_type, const std::string& name, const std::string& alias, Type* father)
+  ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* father)
       : Type(event_type, name, alias, "", father){};
-  ValueType(e_event_type event_type, const std::string& name, Type* father)
+  ValueType(PajeEventType event_type, const std::string& name, Type* father)
       : Type(event_type, name, name, "", father){};
   ~ValueType() override = default;
   void add_entity_value(const std::string& name, const std::string& color);
@@ -97,7 +98,7 @@ class LinkType : public ValueType {
 public:
   static xbt::signal<void(LinkType const&, Type const&, Type const&)> on_creation;
   LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* father)
-      : ValueType(PAJE_DefineLinkType, name, alias, father)
+      : ValueType(PajeEventType::DefineLinkType, name, alias, father)
   {
     on_creation(*this, *source, *dest);
   }
@@ -108,13 +109,13 @@ public:
 
 class EventType : public ValueType {
 public:
-  EventType(const std::string& name, Type* father) : ValueType(PAJE_DefineEventType, name, father) {}
+  EventType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineEventType, name, father) {}
 };
 
 class StateType : public ValueType {
   std::vector<StateEvent*> events_;
 public:
-  StateType(const std::string& name, Type* father) : ValueType(PAJE_DefineStateType, name, father) {}
+  StateType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineStateType, name, father) {}
   void set_event(const std::string& value_name);
   void push_event(const std::string& value_name);
   void push_event(const std::string& value_name, TIData* extra);