X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ec83ae9a081ffd1d19bfecaf81cb99c32bdf6b83..83f030eeb0e339f9dd779251fb507756faaeb2e8:/include/simgrid/jedule/jedule_platform.hpp diff --git a/include/simgrid/jedule/jedule_platform.hpp b/include/simgrid/jedule/jedule_platform.hpp index caaf67225b..945f56127f 100644 --- a/include/simgrid/jedule/jedule_platform.hpp +++ b/include/simgrid/jedule/jedule_platform.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2010-2012, 2014-2016. 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. */ @@ -7,56 +6,55 @@ #ifndef JED_SIMGRID_PLATFORM_H_ #define JED_SIMGRID_PLATFORM_H_ -#include "simgrid_config.h" -#include "simgrid/forward.h" -#include "xbt/dynar.h" +#include + +#include +#include #include #include -#include -#if SIMGRID_HAVE_JEDULE namespace simgrid { namespace jedule{ -XBT_PUBLIC_CLASS Container { -public: - Container(std::string name); - virtual ~Container(); -private: - int last_id; - int is_lowest = 0; -public: +class XBT_PUBLIC Container { + int last_id_ = 0; std::string name; std::unordered_map name2id; - Container *parent = nullptr; - std::vector children; + Container* parent_ = nullptr; + std::vector> children_; std::vector resource_list; - void addChild(Container* child); - void addResources(std::vector hosts); - void createHierarchy(sg_netzone_t from_as); - std::vector getHierarchy(); - std::string getHierarchyAsString(); + +public: + explicit Container(const std::string& name); + Container(const Container&) = delete; + Container& operator=(const Container&) = delete; + + const char* get_cname() const { return name.c_str(); } + void set_parent(Container* parent) { parent_ = parent; } + bool has_children() const { return not children_.empty(); } + int get_child_position(const Container* child) const; + unsigned int get_id_by_name(const char* name) const { return name2id.at(name); } + + void add_child(Container* child); + void add_resources(const std::vector& hosts); + void create_hierarchy(const_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); }; -XBT_PUBLIC_CLASS Subset { +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; }; -} -} -SG_BEGIN_DECL() -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); - -SG_END_DECL() - -#endif +} // namespace jedule +} // namespace simgrid +using jed_container_t = simgrid::jedule::Container*; +void get_resource_selection_by_hosts(std::vector& subset_list, + const std::vector& host_list); #endif /* JED_SIMGRID_PLATFORM_H_ */