PDI 0.4.1

Data exchange made easy

datatype.h
1 /*******************************************************************************
2  * Copyright (C) 2015-2019 Commissariat a l'energie atomique et aux energies alternatives (CEA)
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of CEA nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific
14  * prior written permission.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  ******************************************************************************/
24 
25 #ifndef PDI_DATATYPE_H_
26 #define PDI_DATATYPE_H_
27 
28 #include <pdi/pdi_fwd.h>
29 #include <pdi/datatype_template.h>
30 
31 
32 namespace PDI {
33 
40 class PDI_EXPORT Datatype:
41  public Datatype_template
42 {
43 public:
44  ~Datatype() override;
45 
50  virtual Datatype_uptr clone_type() const = 0;
51 
57  virtual bool operator== (const Datatype& other) const = 0;
58 
64  bool operator!=(const Datatype& other) const;
65 
70  virtual Datatype_uptr densify() const = 0;
71 
76  virtual bool dense() const = 0;
77 
83  virtual size_t datasize() const = 0;
84 
90  virtual size_t buffersize() const = 0;
91 
96  virtual size_t alignment() const = 0;
97 
103  virtual bool simple() const = 0;
104 
112  virtual void* data_to_dense_copy(void* to, const void* from) const = 0;
113 
121  virtual void* data_from_dense_copy(void* to, const void* from) const = 0;
122 
128  virtual void destroy_data(void* ptr) const = 0;
129 
134  virtual std::string debug_string() const = 0;
135 
136 };
137 
138 } // namespace PDI
139 
140 #endif // PDI_DATATYPE_H_
A Datatype is a Datatype_template that accepts no argument.
Definition: datatype.h:40
std::unique_ptr< Datatype > Datatype_uptr
Definition: pdi_fwd.h:62
Definition: datatype_template.h:34
Definition: array_datatype.h:31