X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f409d6f711ba652a6fd78e185791cf7870b6765d..c04075c49b6bc68df4f37240b4ac53e7a108abaa:/src/instr/instr_paje_types.hpp diff --git a/src/instr/instr_paje_types.hpp b/src/instr/instr_paje_types.hpp index 51f55a356f..d09cb2b040 100644 --- a/src/instr/instr_paje_types.hpp +++ b/src/instr/instr_paje_types.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -22,25 +22,30 @@ class Type { long long int id_ = new_paje_id(); std::string name_; std::string color_; - Type* father_; + Type* parent_; std::map, std::less<>> children_; Container* issuer_ = nullptr; + static xbt::signal on_creation; + protected: Container* get_issuer() const { return issuer_; } public: - static xbt::signal on_creation; + static void on_creation_cb(const std::function& cb) + { + on_creation.connect(cb); + } Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color, - Type* father); + Type* parent); virtual ~Type() = default; long long int get_id() const { return id_; } const std::string& get_name() const { return name_; } const char* get_cname() const { return name_.c_str(); } const std::string& get_color() const { return color_; } - Type* get_father() const { return father_; } + Type* get_parent() const { return parent_; } const std::map, std::less<>>& get_children() const { return children_; } bool is_colored() const { return not color_.empty(); } @@ -64,15 +69,15 @@ public: class ContainerType : public Type { public: 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){}; + ContainerType(const std::string& name, Type* parent) + : Type(PajeEventType::DefineContainerType, name, name, "", parent){}; }; class VariableType : public Type { std::vector events_; public: - VariableType(const std::string& name, const std::string& color, Type* father) - : Type(PajeEventType::DefineVariableType, name, name, color, father) + VariableType(const std::string& name, const std::string& color, Type* parent) + : Type(PajeEventType::DefineVariableType, name, name, color, parent) { } void instr_event(double now, double delta, const char* resource, double value); @@ -84,38 +89,42 @@ public: class ValueType : public Type { public: std::map> values_; - ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* father) - : Type(event_type, name, alias, "", father){}; - ValueType(PajeEventType event_type, const std::string& name, Type* father) - : Type(event_type, name, name, "", father){}; - ~ValueType() override = default; + ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* parent) + : Type(event_type, name, alias, "", parent){}; + ValueType(PajeEventType event_type, const std::string& name, Type* parent) + : Type(event_type, name, name, "", parent){}; void add_entity_value(const std::string& name, const std::string& color); void add_entity_value(const std::string& name); EntityValue* get_entity_value(const std::string& name); }; class LinkType : public ValueType { -public: static xbt::signal on_creation; - LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* father) - : ValueType(PajeEventType::DefineLinkType, name, alias, father) + +public: + static void on_creation_cb(const std::function& cb) + { + on_creation.connect(cb); + } + LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* parent) + : ValueType(PajeEventType::DefineLinkType, name, alias, parent) { on_creation(*this, *source, *dest); } - void start_event(Container* startContainer, const std::string& value, const std::string& key); - void start_event(Container* startContainer, const std::string& value, const std::string& key, int size); + void start_event(Container* startContainer, const std::string& value, const std::string& key, + size_t size = static_cast(-1)); void end_event(Container* endContainer, const std::string& value, const std::string& key); }; class EventType : public ValueType { public: - EventType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineEventType, name, father) {} + EventType(const std::string& name, Type* parent) : ValueType(PajeEventType::DefineEventType, name, parent) {} }; class StateType : public ValueType { std::vector events_; public: - StateType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineStateType, name, father) {} + StateType(const std::string& name, Type* parent) : ValueType(PajeEventType::DefineStateType, name, parent) {} 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);