X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/149c63f36e15b8500b1e826bda5138318ff7ba2b..9a35e3d4e5aed80e7b3fab624547ab045dc00f8a:/src/instr/instr_paje_types.hpp diff --git a/src/instr/instr_paje_types.hpp b/src/instr/instr_paje_types.hpp index 877abc94ad..7d9fa60ee7 100644 --- a/src/instr/instr_paje_types.hpp +++ b/src/instr/instr_paje_types.hpp @@ -8,7 +8,6 @@ #include "src/instr/instr_private.hpp" #include -#include #include #include @@ -24,16 +23,19 @@ class Type { Type* father_; public: + static xbt::signal on_creation; std::map> children_; Container* issuer_ = nullptr; - std::stringstream stream_; - Type(const std::string& name, const std::string& alias, const std::string& color, Type* father); + Type(e_event_type event_type, const std::string& name, const std::string& alias, const std::string& color, + Type* father); virtual ~Type() = default; + long long int get_id() { return id_; } const std::string& get_name() const { return name_; } const char* get_cname() { return name_.c_str(); } - long long int get_id() { return id_; } + const std::string& get_color() const { return color_; } + Type* get_father() const { return father_; } bool is_colored() { return not color_.empty(); } Type* by_name(const std::string& name); @@ -46,22 +48,26 @@ public: return cont == children_.end() ? new T(name, this) : static_cast(cont->second.get()); } - void set_calling_container(Container* container) { issuer_ = container; } - - void log_definition(e_event_type event_type); - void log_definition(Type* source, Type* dest); + Type* set_calling_container(Container* container) + { + issuer_ = container; + return this; + } }; class ContainerType : public Type { public: - explicit ContainerType(const std::string& name) : Type(name, name, "", nullptr){}; - ContainerType(const std::string& name, Type* father); + 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){}; }; class VariableType : public Type { std::vector events_; public: - VariableType(const std::string& name, const std::string& color, Type* father); + VariableType(const std::string& name, const std::string& color, Type* father) + : Type(PAJE_DefineVariableType, name, name, color, father) + { + } void instr_event(double now, double delta, const char* resource, double value); void set_event(double timestamp, double value); void add_event(double timestamp, double value); @@ -71,8 +77,10 @@ public: class ValueType : public Type { public: std::map values_; - ValueType(const std::string& name, const std::string& alias, Type* father) : Type(name, alias, "", father){}; - ValueType(const std::string& name, Type* father) : Type(name, name, "", father){}; + ValueType(e_event_type 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) + : Type(event_type, name, name, "", father){}; virtual ~ValueType() = default; void add_entity_value(const std::string& name, const std::string& color); void add_entity_value(const std::string& name); @@ -81,7 +89,12 @@ public: class LinkType : public ValueType { public: - LinkType(const std::string& name, const std::string& alias, Type* father); + static xbt::signal on_creation; + LinkType(const std::string& name, Type* source, Type* dest, const std::string& alias, Type* father) + : ValueType(PAJE_DefineLinkType, name, alias, father) + { + 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 end_event(Container* endContainer, const std::string& value, const std::string& key); @@ -89,19 +102,19 @@ public: class EventType : public ValueType { public: - EventType(const std::string& name, Type* father); + EventType(const std::string& name, Type* father) : ValueType(PAJE_DefineEventType, name, father) {} }; class StateType : public ValueType { std::vector events_; public: - StateType(const std::string& name, Type* father); + StateType(const std::string& name, Type* father) : ValueType(PAJE_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); void pop_event(); void pop_event(TIData* extra); }; -} -} +} // namespace instr +} // namespace simgrid #endif