Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / include / simgrid / jedule / jedule_platform.hpp
index 195ca91..9566380 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2010-2012, 2014-2016. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2010-2020. 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,42 +6,42 @@
 #ifndef JED_SIMGRID_PLATFORM_H_
 #define JED_SIMGRID_PLATFORM_H_
 
-#include "simgrid_config.h"
-#include "simgrid/forward.h"
-#include "xbt/dynar.h"
+#include <simgrid/forward.h>
+
+#include <memory>
+#include <string>
 #include <unordered_map>
 #include <vector>
-#include <string>
-#if HAVE_JEDULE
 
 namespace simgrid {
 namespace jedule{
-XBT_PUBLIC_CLASS Container {
+class XBT_PUBLIC Container {
 public:
-  Container(std::string name);
-  virtual ~Container();
+  explicit Container(const std::string& name);
+  Container(const Container&) = delete;
+  Container& operator=(const Container&) = delete;
+
 private:
-  int last_id;
-  int is_lowest = 0;
+  int last_id_   = 0;
+
 public:
   std::string name;
   std::unordered_map<const char*, unsigned int> name2id;
   Container *parent = nullptr;
-  std::vector<Container*> children;
+  std::vector<std::unique_ptr<Container>> children;
   std::vector<sg_host_t> resource_list;
-  void addChild(Container* child);
-  void addResources(std::vector<sg_host_t> hosts);
-  void createHierarchy(sg_netzone_t from_as);
-  std::vector<int> getHierarchy();
-  std::string getHierarchyAsString();
+  void add_child(Container* child);
+  void add_resources(std::vector<sg_host_t> hosts);
+  void create_hierarchy(const_sg_netzone_t from_as);
+  std::vector<int> 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;
@@ -50,13 +49,8 @@ public:
 
 }
 }
-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<jed_subset_t>* subset_list, std::vector<sg_host_t> *host_list);
-
-SG_END_DECL()
-
-#endif
+void get_resource_selection_by_hosts(std::vector<simgrid::jedule::Subset>& subset_list,
+                                     const std::vector<sg_host_t>& host_list);
 
 #endif /* JED_SIMGRID_PLATFORM_H_ */