X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5d83790fb256eb80359f354854fb553e36252272..dc9b8feaddd53842f6204f4f24409b2382393fa9:/include/simgrid/jedule/jedule_platform.hpp diff --git a/include/simgrid/jedule/jedule_platform.hpp b/include/simgrid/jedule/jedule_platform.hpp index 2c06a7524d..1c026df55d 100644 --- a/include/simgrid/jedule/jedule_platform.hpp +++ b/include/simgrid/jedule/jedule_platform.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2010-2012, 2014-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2019. 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,88 +6,76 @@ #ifndef JED_SIMGRID_PLATFORM_H_ #define JED_SIMGRID_PLATFORM_H_ -#include "simgrid_config.h" -#include "simgrid/forward.h" -#include "xbt/dynar.h" -#include "xbt/dict.h" +#include +#include + #include #include #include -#if HAVE_JEDULE - namespace simgrid { namespace jedule{ -XBT_PUBLIC_CLASS Container { +class XBT_PUBLIC Container { public: - Container(std::string name); - virtual ~Container()=default; + explicit Container(const std::string& name); + Container(const Container&) = delete; + Container& operator=(const Container&) = delete; + virtual ~Container(); private: - int last_id; - int is_lowest = 0; + int last_id_; + int is_lowest_ = 0; + public: std::string name; - std::unordered_map name2id; + std::unordered_map name2id; Container *parent = nullptr; std::vector children; std::vector resource_list; - void addChild(Container* child); - void addResources(std::vector hosts); - void createHierarchy(AS_t from_as); - std::vector getHierarchy(); - std::string getHierarchyAsString(); + void add_child(Container* child); + void add_resources(std::vector hosts); + void create_hierarchy(sg_netzone_t from_as); + std::vector get_hierarchy(); + std::string get_hierarchy_as_string(); void print(FILE *file); - void printResources(FILE *file); + void print_resources(FILE* file); + + // deprecated + XBT_ATTRIB_DEPRECATED_v323("Please use Container::add_child()") void addChild(Container* child) { add_child(child); } + XBT_ATTRIB_DEPRECATED_v323("Please use Container::add_resources()") void addResources(std::vector hosts) + { + add_resources(hosts); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Container::create_hierarchy()") void createHierarchy(sg_netzone_t from_as) + { + create_hierarchy(from_as); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Container::get_hierarchy()") std::vector getHierarchy() + { + return get_hierarchy(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Container::get_hierarchy_as_string()") std::string getHierarchyAsString() + { + return get_hierarchy_as_string(); + } + XBT_ATTRIB_DEPRECATED_v323("Please use Container::print_resources()") void printResources(FILE* file) + { + print_resources(file); + } }; -} -} -SG_BEGIN_DECL() -typedef simgrid::jedule::Container * jed_container_t; - -/* FIXME: jedule_container should be objectified too */ -/** selection of a subset of resources from the original set */ -struct jed_res_subset { - jed_container_t parent; +class XBT_PUBLIC Subset { +public: + Subset(int s, int n, Container* p); + virtual ~Subset()=default; int start_idx; // start idx in resource_list of container int nres; // number of resources spanning starting at start_idx + Container *parent; }; -typedef struct jed_res_subset s_jed_res_subset_t, *jed_res_subset_t; - -/* FIXME: jedule should be objectified too */ - -typedef struct jedule_struct { - jed_container_t root_container; - std::unordered_map jedule_meta_info; -} s_jedule_t; - -typedef s_jedule_t *jedule_t; - -void jed_create_jedule(jedule_t *jedule); -void jed_free_jedule(jedule_t jedule); -void jedule_add_meta_info(jedule_t jedule, char *key, char *value); - -/** - * it is assumed that the host_names in the entire system are unique that means that we don't need parent references - * - * subset_list must be allocated - * host_names is the list of host_names associated with an event - */ -void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, std::vector* host_list); - -/* - global: - hash host_id -> container - container: - hash host_id -> jed_host_id - list <- [ jed_host_ids ] - list <- sort( list ) - list_chunks <- chunk( list ) -> [ 1, 3-5, 7-9 ] -*/ - -SG_END_DECL() - -#endif +} +} +typedef simgrid::jedule::Container * jed_container_t; +typedef simgrid::jedule::Subset * jed_subset_t; +void get_resource_selection_by_hosts(std::vector* subset_list, std::vector *host_list); #endif /* JED_SIMGRID_PLATFORM_H_ */