Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / smpi / include / smpi_datatype_derived.hpp
index 9e1f4c8..277c670 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team.
+/* Copyright (c) 2009-2023. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -9,8 +9,7 @@
 
 #include "smpi_datatype.hpp"
 
-namespace simgrid{
-namespace smpi{
+namespace simgrid::smpi {
 
 class Type_Contiguous: public Datatype {
   int block_count_;
@@ -18,51 +17,62 @@ class Type_Contiguous: public Datatype {
 
 public:
   Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
-  ~Type_Contiguous();
-  void serialize(void* noncontiguous, void* contiguous, int count);
-  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+  Type_Contiguous(const Type_Contiguous&) = delete;
+  Type_Contiguous& operator=(const Type_Contiguous&) = delete;
+  ~Type_Contiguous() override;
+  int clone(MPI_Datatype* type) override;
+  void serialize(const void* noncontiguous, void* contiguous, int count) override;
+  void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
 };
 
 class Type_Hvector: public Datatype{
+public:
   int block_count_;
   int block_length_;
   MPI_Aint block_stride_;
   MPI_Datatype old_type_;
 
-public:
   Type_Hvector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride,
                MPI_Datatype old_type);
-  ~Type_Hvector();
-  void serialize(void* noncontiguous, void* contiguous, int count);
-  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+  Type_Hvector(const Type_Hvector&) = delete;
+  Type_Hvector& operator=(const Type_Hvector&) = delete;
+  ~Type_Hvector() override;
+  int clone(MPI_Datatype* type) override;
+  void serialize(const void* noncontiguous, void* contiguous, int count) override;
+  void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
 };
 
 class Type_Vector : public Type_Hvector {
 public:
   Type_Vector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride,
               MPI_Datatype old_type);
+  int clone(MPI_Datatype* type) override;
 };
 
 class Type_Hindexed: public Datatype{
+public:
   int block_count_;
   int* block_lengths_;
   MPI_Aint* block_indices_;
   MPI_Datatype old_type_;
 
-public:
-  Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
-                MPI_Aint* block_indices, MPI_Datatype old_type);
-  Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
+  Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths,
+                const MPI_Aint* block_indices, MPI_Datatype old_type);
+  Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths, const int* block_indices,
                 MPI_Datatype old_type, MPI_Aint factor);
-  ~Type_Hindexed();
-  void serialize(void* noncontiguous, void* contiguous, int count);
-  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+  Type_Hindexed(const Type_Hindexed&) = delete;
+  Type_Hindexed& operator=(const Type_Hindexed&) = delete;
+  int clone(MPI_Datatype* type) override;
+  ~Type_Hindexed() override;
+  void serialize(const void* noncontiguous, void* contiguous, int count) override;
+  void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
 };
 
 class Type_Indexed : public Type_Hindexed {
 public:
-  Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
+  Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths, const int* block_indices,
                MPI_Datatype old_type);
+  int clone(MPI_Datatype* type) override;
 };
 
 class Type_Struct: public Datatype{
@@ -72,15 +82,16 @@ class Type_Struct: public Datatype{
   MPI_Datatype* old_types_;
 
 public:
-  Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
-              MPI_Aint* block_indices, MPI_Datatype* old_types);
-  ~Type_Struct();
-  void serialize(void* noncontiguous, void* contiguous, int count);
-  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
+  Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, const int* block_lengths,
+              const MPI_Aint* block_indices, const MPI_Datatype* old_types);
+  Type_Struct(const Type_Struct&) = delete;
+  Type_Struct& operator=(const Type_Struct&) = delete;
+  int clone(MPI_Datatype* type) override;
+  ~Type_Struct() override;
+  void serialize(const void* noncontiguous, void* contiguous, int count) override;
+  void unserialize(const void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op) override;
 };
 
-
-}
-}
+} // namespace simgrid::smpi
 
 #endif