PDI 0.6.1

Data exchange made easy

array_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_ARRAY_DATATYPE_H_
26 #define PDI_ARRAY_DATATYPE_H_
27 
28 #include <string>
29 
30 #include <pdi/pdi_fwd.h>
31 #include <pdi/datatype.h>
32 
33 namespace PDI {
34 
39 class PDI_EXPORT Array_datatype:
40  public Datatype
41 {
43  Datatype_uptr m_subtype;
44 
46  size_t m_size;
47 
49  size_t m_start;
50 
52  size_t m_subsize;
53 
54 public:
62  Array_datatype(Datatype_uptr subtype, size_t size, size_t start, size_t subsize);
63 
69  Array_datatype(Datatype_uptr subtype, size_t size);
70 
75  const Datatype& subtype() const;
76 
80  size_t size() const;
81 
86  size_t start() const;
87 
92  size_t subsize() const;
93 
94  Datatype_template_uptr clone() const override;
95 
96  Datatype_uptr clone_type() const override;
97 
98  Datatype_uptr densify() const override;
99 
100  Datatype_uptr evaluate(Context&) const override;
101 
102  bool dense() const override;
103 
104  size_t datasize() const override;
105 
106  size_t buffersize() const override;
107 
108  size_t alignment() const override;
109 
110  bool simple() const override;
111 
112  void* data_to_dense_copy(void*, const void*) const override;
113 
114  void* data_from_dense_copy(void*, const void*) const override;
115 
116  void destroy_data(void*) const override;
117 
118  std::string debug_string() const override;
119 
120  bool operator== (const Datatype&) const override;
121 
122 };
123 
124 } // namespace PDI
125 
126 #endif // PDI_ARRAY_DATATYPE_H_
Definition: context.h:41
A Datatype is a Datatype_template that accepts no argument.
Definition: datatype.h:42
an Array_datatype is a Datatype that represents an array: i.e storage of multiple elements of the sam...
Definition: array_datatype.h:39
std::unique_ptr< Datatype_template > Datatype_template_uptr
Definition: pdi_fwd.h:58
std::unique_ptr< Datatype > Datatype_uptr
Definition: pdi_fwd.h:62
Definition: array_datatype.h:33