Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
factoring in instr Events
[simgrid.git] / src / instr / instr_private.hpp
index 0e3d8ec..b9e4a14 100644 (file)
@@ -78,16 +78,22 @@ public:
 
 //--------------------------------------------------
 class Value {
-public:
-  char* id_;
-  char* name_;
-  char* color_;
+private:
+  std::string name_;
+  std::string id_;
+  std::string color_;
 
+  explicit Value(std::string name, std::string color, Type* father);
+
+public:
+  ~Value() = default;
   Type* father_;
-  Value(const char* name, const char* color, Type* father);
-  ~Value();
-  static Value* get_or_new(const char* name, const char* color, Type* father);
-  static Value* get(const char* name, Type* father);
+  static Value* byNameOrCreate(std::string name, std::string color, Type* father);
+  static Value* byName(std::string name, Type* father);
+  const char* getCname() { return name_.c_str(); }
+  const char* getId() { return id_.c_str(); }
+  bool isColored() { return not color_.empty(); }
+  void print();
 };
 
 //--------------------------------------------------
@@ -121,18 +127,21 @@ public:
 
 //--------------------------------------------------
 class PajeEvent {
+protected:
+  Container* container;
+  Type* type;
+
 public:
   double timestamp_;
   e_event_type eventType_;
+  PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
+      : container(container), type(type), timestamp_(timestamp), eventType_(eventType){};
   virtual void print() = 0;
   virtual ~PajeEvent();
 };
 
 //--------------------------------------------------
 class SetVariableEvent : public PajeEvent {
-private:
-  Container* container;
-  Type* type;
   double value;
 
 public:
@@ -141,9 +150,6 @@ public:
 };
 
 class AddVariableEvent : public PajeEvent {
-private:
-  Container* container;
-  Type* type;
   double value;
 
 public:
@@ -153,9 +159,6 @@ public:
 //--------------------------------------------------
 
 class SubVariableEvent : public PajeEvent {
-private:
-  Container* container;
-  Type* type;
   double value;
 
 public:
@@ -165,9 +168,6 @@ public:
 //--------------------------------------------------
 
 class SetStateEvent : public PajeEvent {
-private:
-  Container* container;
-  Type* type;
   Value* value;
   const char* filename;
   int linenumber;
@@ -178,9 +178,6 @@ public:
 };
 
 class PushStateEvent : public PajeEvent {
-public:
-  Container* container;
-  Type* type;
   Value* value;
   int size;
   const char* filename;
@@ -194,26 +191,18 @@ public:
 };
 
 class PopStateEvent : public PajeEvent {
-  Container* container;
-  Type* type;
-
 public:
   PopStateEvent(double timestamp, Container* container, Type* type);
   void print() override;
 };
 
 class ResetStateEvent : public PajeEvent {
-  Container* container;
-  Type* type;
-
 public:
   ResetStateEvent(double timestamp, Container* container, Type* type);
   void print() override;
 };
 
 class StartLinkEvent : public PajeEvent {
-  Container* container_;
-  Type* type_;
   Container* sourceContainer_;
   std::string value_;
   std::string key_;
@@ -228,8 +217,6 @@ public:
 };
 
 class EndLinkEvent : public PajeEvent {
-  Container* container;
-  Type* type;
   Container* destContainer;
   std::string value;
   std::string key;
@@ -242,9 +229,6 @@ public:
 };
 
 class NewEvent : public PajeEvent {
-public:
-  Container* container;
-  Type* type;
   Value* val;
 
 public:
@@ -404,7 +388,6 @@ void LogContainerTypeDefinition(simgrid::instr::Type* type);
 void LogVariableTypeDefinition(simgrid::instr::Type* type);
 void LogStateTypeDefinition(simgrid::instr::Type* type);
 void LogLinkTypeDefinition(simgrid::instr::Type* type, simgrid::instr::Type* source, simgrid::instr::Type* dest);
-void LogEntityValue(simgrid::instr::Value* val);
 void LogContainerCreation(container_t container);
 void LogContainerDestruction(container_t container);
 void LogDefineEventType(simgrid::instr::Type* type);