X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ce9fe8ed764878bee5d61a7720f124245cea072e..9fd6cbc6c3b06f4b09e3c3339ffb3cc8a68f9bfa:/src/instr/instr_paje_types.hpp diff --git a/src/instr/instr_paje_types.hpp b/src/instr/instr_paje_types.hpp index 6d9a9bffcb..7784cfa881 100644 --- a/src/instr/instr_paje_types.hpp +++ b/src/instr/instr_paje_types.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2018. 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. */ @@ -7,20 +7,14 @@ #define INSTR_PAJE_TYPES_HPP #include "src/instr/instr_private.hpp" +#include #include #include namespace simgrid { namespace instr { -enum e_event_type : unsigned int; -class EntityValue; class ContainerType; class EventType; -class LinkType; -class StateType; -class VariableType; -class StateEvent; -class VariableEvent; class Type { long long int id_; @@ -30,30 +24,31 @@ class Type { public: std::map children_; + Container* issuer_ = nullptr; + std::stringstream stream_; Type(std::string name, std::string alias, std::string color, Type* father); virtual ~Type(); - std::string getName() { return name_; } - const char* getCname() { return name_.c_str(); } - long long int getId() { return id_; } - bool isColored() { return not color_.empty(); } - - Type* byName(std::string name); - ContainerType* getOrCreateContainerType(std::string name); - EventType* getOrCreateEventType(std::string name); - LinkType* getOrCreateLinkType(std::string name, Type* source, Type* dest); + std::string get_name() { return name_; } + const char* get_cname() { return name_.c_str(); } + long long int get_id() { return id_; } + bool is_colored() { return not color_.empty(); } - StateType* getOrCreateStateType(std::string name); - StateType* getState(std::string name); + Type* by_name(std::string name); + LinkType* by_name_or_create(std::string name, Type* source, Type* dest); + VariableType* by_name_or_create(std::string name, std::string color); - VariableType* getOrCreateVariableType(std::string name, std::string color); + template T* by_name_or_create(std::string name) + { + auto cont = children_.find(name); + return cont == children_.end() ? new T(name, this) : static_cast(cont->second); + } - void logDefinition(e_event_type event_type); - void logDefinition(Type* source, Type* dest); + void set_calling_container(Container* container) { issuer_ = container; } - static ContainerType* createRootType(); - static ContainerType* getRootType(); + void log_definition(e_event_type event_type); + void log_definition(Type* source, Type* dest); }; class ContainerType : public Type { @@ -64,13 +59,13 @@ public: class VariableType : public Type { std::vector events_; - public: VariableType(std::string name, std::string color, Type* father); ~VariableType(); - void setEvent(double timestamp, Container* container, double value); - void addEvent(double timestamp, Container* container, double value); - void subEvent(double timestamp, Container* container, double value); + 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); + void sub_event(double timestamp, double value); }; class ValueType : public Type { @@ -79,18 +74,17 @@ public: ValueType(std::string name, std::string alias, Type* father) : Type(name, alias, "", father){}; ValueType(std::string name, Type* father) : Type(name, name, "", father){}; virtual ~ValueType(); - void addEntityValue(std::string name, std::string color); - void addEntityValue(std::string name); - EntityValue* getEntityValue(std::string name); + void add_entity_value(std::string name, std::string color); + void add_entity_value(std::string name); + EntityValue* get_entity_value(std::string name); }; class LinkType : public ValueType { public: LinkType(std::string name, std::string alias, Type* father); - void startEvent(Container* source_container, Container* sourceContainer, std::string value, std::string key); - void startEvent(Container* source_container, Container* sourceContainer, std::string value, std::string key, - int size); - void endEvent(Container* source_container, Container* destContainer, std::string value, std::string key); + void start_event(Container* startContainer, std::string value, std::string key); + void start_event(Container* startContainer, std::string value, std::string key, int size); + void end_event(Container* endContainer, std::string value, std::string key); }; class EventType : public ValueType { @@ -100,16 +94,14 @@ public: class StateType : public ValueType { std::vector events_; - Container* issuer_ = nullptr; - public: StateType(std::string name, Type* father); ~StateType(); - void setCallingContainer(Container* container) { issuer_ = container; } - void setEvent(std::string value_name); - void pushEvent(std::string value_name); - void pushEvent(std::string value_name, void* extra); - void popEvent(); + void set_event(std::string value_name); + void push_event(std::string value_name); + void push_event(std::string value_name, TIData* extra); + void pop_event(); + void pop_event(TIData* extra); }; } }