source: proiecte/hpl/openmpi_compiled/include/openmpi/ompi/mpi/cxx/datatype.h @ 97

Last change on this file since 97 was 97, checked in by (none), 14 years ago

Adding compiled files

File size: 7.6 KB
Line 
1// -*- c++ -*-
2//
3// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4//                         University Research and Technology
5//                         Corporation.  All rights reserved.
6// Copyright (c) 2004-2005 The University of Tennessee and The University
7//                         of Tennessee Research Foundation.  All rights
8//                         reserved.
9// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10//                         University of Stuttgart.  All rights reserved.
11// Copyright (c) 2004-2005 The Regents of the University of California.
12//                         All rights reserved.
13// Copyright (c) 2006-2008 Sun Microsystems, Inc.  All rights reserved.
14// Copyright (c) 2006-2007 Cisco Systems, Inc.  All rights reserved.
15// $COPYRIGHT$
16//
17// Additional copyrights may follow
18//
19// $HEADER$
20//
21
22
23class Datatype {
24#if 0 /* OMPI_ENABLE_MPI_PROFILING */
25  //  friend class PMPI::Datatype;
26#endif
27public:
28
29#if 0 /* OMPI_ENABLE_MPI_PROFILING */
30
31  // construction
32  inline Datatype() { }
33
34  // inter-language operability
35  inline Datatype(MPI_Datatype i) : pmpi_datatype(i) { }
36
37  // copy / assignment
38  inline Datatype(const Datatype& dt) : pmpi_datatype(dt.pmpi_datatype) { }
39
40  inline Datatype(const PMPI::Datatype& dt) : pmpi_datatype(dt) { }
41 
42  inline virtual ~Datatype() {}
43
44  inline Datatype& operator=(const Datatype& dt) {
45    pmpi_datatype = dt.pmpi_datatype; return *this; }
46
47  // comparison
48  inline bool operator== (const Datatype &a) const
49    { return (bool) (pmpi_datatype == a.pmpi_datatype); }
50
51  inline bool operator!= (const Datatype &a) const
52    { return (bool) !(*this == a); }
53
54  // inter-language operability
55  inline Datatype& operator= (const MPI_Datatype &i)
56    { pmpi_datatype = i; return *this; }
57
58  inline operator MPI_Datatype() const { return (MPI_Datatype)pmpi_datatype; }
59  //  inline operator MPI_Datatype* ()/* JGS const */ { return pmpi_datatype; }
60
61  inline operator const PMPI::Datatype&() const { return pmpi_datatype; }
62
63  inline const PMPI::Datatype& pmpi() const { return pmpi_datatype; }
64
65#else
66
67  // construction / destruction
68  inline Datatype() : mpi_datatype(MPI_DATATYPE_NULL) { }
69  inline virtual ~Datatype() {}
70  // inter-language operability
71  inline Datatype(MPI_Datatype i) : mpi_datatype(i) { }
72
73  // copy / assignment
74  inline Datatype(const Datatype& dt) : mpi_datatype(dt.mpi_datatype) { }
75  inline Datatype& operator=(const Datatype& dt) {
76    mpi_datatype = dt.mpi_datatype; return *this; }
77
78  // comparison
79  inline bool operator== (const Datatype &a) const
80    { return (bool) (mpi_datatype == a.mpi_datatype); }
81
82  inline bool operator!= (const Datatype &a) const
83    { return (bool) !(*this == a); }
84
85  // inter-language operability
86  inline Datatype& operator= (const MPI_Datatype &i) 
87    { mpi_datatype = i; return *this; }
88
89  inline operator MPI_Datatype () const { return mpi_datatype; }
90  // inline operator MPI_Datatype* ()/* JGS const */ { return &mpi_datatype; }
91
92#endif
93
94  //
95  // User Defined Functions
96  //
97  typedef int Copy_attr_function(const Datatype& oldtype,
98                                                int type_keyval,
99                                                void* extra_state,
100                                                const void* attribute_val_in,
101                                                void* attribute_val_out,
102                                                bool& flag);
103 
104  typedef int Delete_attr_function(Datatype& type, int type_keyval, 
105                                   void* attribute_val, void* extra_state);
106 
107  //
108  // Point-to-Point Communication
109  //
110 
111  virtual Datatype Create_contiguous(int count) const;
112 
113  virtual Datatype Create_vector(int count, int blocklength,
114                                 int stride) const;
115 
116  virtual Datatype Create_indexed(int count,
117                                  const int array_of_blocklengths[], 
118                                  const int array_of_displacements[]) const;
119
120  static Datatype Create_struct(int count, const int array_of_blocklengths[],
121                                const Aint array_of_displacements[],
122                                const Datatype array_if_types[]);
123 
124  virtual Datatype Create_hindexed(int count, const int array_of_blocklengths[],
125                                   const Aint array_of_displacements[]) const;
126
127  virtual Datatype Create_hvector(int count, int blocklength, Aint stride) const;
128
129  virtual Datatype Create_indexed_block(int count, int blocklength,
130                                        const int array_of_blocklengths[]) const;
131  virtual Datatype Create_resized(const Aint lb, const Aint extent) const;
132
133  virtual int Get_size() const;
134
135  virtual void Get_extent(Aint& lb, Aint& extent) const;
136
137  virtual void Get_true_extent(Aint&, Aint&) const;
138
139  virtual void Commit();
140 
141  virtual void Free();
142
143  virtual void Pack(const void* inbuf, int incount, void *outbuf, 
144                    int outsize, int& position, const Comm &comm) const;
145
146  virtual void Unpack(const void* inbuf, int insize, void *outbuf, int outcount,
147                      int& position, const Comm& comm) const;
148
149  virtual int Pack_size(int incount, const Comm& comm) const;
150
151  //
152  // Miscellany
153  //
154  virtual Datatype Create_subarray(int ndims, const int array_of_sizes[],
155                                   const int array_of_subsizes[], 
156                                   const int array_of_starts[], int order) 
157    const;   
158
159  //
160  // External Interfaces
161  //
162
163  virtual Datatype Dup() const;
164
165  // Need 4 overloaded versions of this function because per the
166  // MPI-2 spec, you can mix-n-match the C predefined functions with
167  // C++ functions.
168  static int Create_keyval(Copy_attr_function* type_copy_attr_fn,
169                           Delete_attr_function* type_delete_attr_fn,
170                           void* extra_state);
171  static int Create_keyval(MPI_Type_copy_attr_function* type_copy_attr_fn,
172                           MPI_Type_delete_attr_function* type_delete_attr_fn,
173                           void* extra_state);
174  static int Create_keyval(Copy_attr_function* type_copy_attr_fn,
175                           MPI_Type_delete_attr_function* type_delete_attr_fn,
176                           void* extra_state);
177  static int Create_keyval(MPI_Type_copy_attr_function* type_copy_attr_fn,
178                           Delete_attr_function* type_delete_attr_fn,
179                           void* extra_state);
180
181protected:
182  // Back-end function to do the heavy lifting for creating the
183  // keyval
184  static int do_create_keyval(MPI_Type_copy_attr_function* c_copy_fn,
185                              MPI_Type_delete_attr_function* c_delete_fn,
186                              Copy_attr_function* cxx_copy_fn,
187                              Delete_attr_function* cxx_delete_fn,
188                              void* extra_state, int &keyval);
189
190public:
191
192  virtual void Delete_attr(int type_keyval);
193
194  static void Free_keyval(int& type_keyval);
195
196  virtual bool Get_attr(int type_keyval, void* attribute_val) const;
197
198  virtual void Get_contents(int max_integers, int max_addresses,
199                            int max_datatypes, int array_of_integers[],
200                            Aint array_of_addresses[],
201                            Datatype array_of_datatypes[]) const;
202
203  virtual void Get_envelope(int& num_integers, int& num_addresses,
204                            int& num_datatypes, int& combiner) const;
205
206  virtual void Get_name(char* type_name, int& resultlen) const;
207
208  virtual void Set_attr(int type_keyval, const void* attribute_val);
209
210  virtual void Set_name(const char* type_name);
211
212
213
214#if 0 /* OMPI_ENABLE_MPI_PROFILING */
215private:
216  PMPI::Datatype pmpi_datatype;
217#else
218protected:
219  MPI_Datatype mpi_datatype;
220#endif
221
222public:
223    // Data that is passed through keyval create when C++ callback
224    // functions are used
225    struct keyval_intercept_data_t {
226        MPI_Type_copy_attr_function *c_copy_fn;
227        MPI_Type_delete_attr_function *c_delete_fn;
228        Copy_attr_function* cxx_copy_fn;
229        Delete_attr_function* cxx_delete_fn;
230        void *extra_state;
231    };
232
233    // Protect the global list from multiple thread access
234    static opal_mutex_t cxx_extra_states_lock;
235};
Note: See TracBrowser for help on using the repository browser.