rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
endian.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 
24 #ifndef _R_ENDIANTOOLS_HH_
25 #define _R_ENDIANTOOLS_HH_
26 
27 #include "raslib/odmgtypes.hh"
28 #include "raslib/mddtypes.hh"
29 
30 class r_Minterval;
31 class r_Base_Type;
32 class r_Primitive_Type;
33 
34 //@ManMemo: Module {\bf raslib}
44 class r_Endian
45 {
46 public:
49  {
52  };
53 
55  static r_Short swap(r_Short val);
56  static r_UShort swap(r_UShort val);
57  static r_Long swap(r_Long val);
58  static r_ULong swap(r_ULong val);
59  static r_Float swap(r_Float val);
60  static r_Double swap(r_Double val);
61 
64 
66  static void swap_array(const r_Primitive_Type *type, r_Bytes size, const void *src, void *dest);
67 
69  static void swap_array(r_Bytes size, const r_Octet *src, r_Octet *dest); // dummy
70  static void swap_array(r_Bytes size, const r_Char *src, r_Char *dest); // dummy
71  static void swap_array(r_Bytes size, const r_Short *src, r_Short *dest);
72  static void swap_array(r_Bytes size, const r_UShort *src, r_UShort *dest);
73  static void swap_array(r_Bytes size, const r_Long *src, r_Long *dest);
74  static void swap_array(r_Bytes size, const r_ULong *src, r_ULong *dest);
75  static void swap_array(r_Bytes size, const r_Float *src, r_Float *dest);
76  static void swap_array(r_Bytes size, const r_Double *src, r_Double *dest);
77 
79  static void swap_array(r_Bytes size, r_Bytes tsize, const void *src, void *dest);
80 
83  static void swap_array(const r_Primitive_Type *type, const r_Minterval &srcDom,
84  const r_Minterval &srcIterDom, const void *src, void *dest,
85  r_ULong step);
86 
88  static void swap_array(const r_Base_Type *type, const r_Minterval &srcDom,
89  const r_Minterval &srcIterDom, const void *src, void *dest);
90 
93  static void swap_array(const r_Primitive_Type *type, const r_Minterval &srcDom,
94  const r_Minterval &srcIterDom, const r_Minterval &destDom,
95  const r_Minterval &destIterDom, const void *src, void *dest,
96  r_ULong step);
97 
99  static void swap_array(const r_Base_Type *type, const r_Minterval &srcDom,
100  const r_Minterval &srcIterDom, const r_Minterval &destDom,
101  const r_Minterval &destIterDom, const void *src, void *dest);
102 };
103 
104 //@ManMemo: Module: {\bf raslib}
108 extern std::ostream &operator<<(std::ostream &s, r_Endian::r_Endianness &e);
109 
110 #endif
This class is the superclass of the types r_Structure_Type and r_Primitive_Type in the representation...
Definition: basetype.hh:40
Class to check the endianness of the host machine and to swap the endianness of types and arrays.
Definition: endian.hh:45
static void swap_array(const r_Primitive_Type *type, const r_Minterval &srcDom, const r_Minterval &srcIterDom, const void *src, void *dest, r_ULong step)
change the endianness of one type member of an array for identical domains for src and dest; step is ...
static void swap_array(const r_Base_Type *type, const r_Minterval &srcDom, const r_Minterval &srcIterDom, const void *src, void *dest)
change the endianness of the entire tile for identical domains for src and dest
static r_Float swap(r_Float val)
static r_ULong swap(r_ULong val)
static void swap_array(r_Bytes size, const r_Octet *src, r_Octet *dest)
change the endianness of a linear array of size size, type implicit
static void swap_array(r_Bytes size, const r_Char *src, r_Char *dest)
static r_Double swap(r_Double val)
static r_UShort swap(r_UShort val)
static void swap_array(const r_Base_Type *type, const r_Minterval &srcDom, const r_Minterval &srcIterDom, const r_Minterval &destDom, const r_Minterval &destIterDom, const void *src, void *dest)
change the endianness of the entire tile for the generic case
static void swap_array(r_Bytes size, const r_Double *src, r_Double *dest)
static void swap_array(const r_Primitive_Type *type, r_Bytes size, const void *src, void *dest)
change the endianness of a linear array of size size and type type
static void swap_array(r_Bytes size, r_Bytes tsize, const void *src, void *dest)
change the endianness of a linear array of size size with type size tsize
static r_Endianness get_endianness(void)
query host machine's endianness
static void swap_array(r_Bytes size, const r_UShort *src, r_UShort *dest)
static r_Long swap(r_Long val)
static void swap_array(r_Bytes size, const r_ULong *src, r_ULong *dest)
static void swap_array(const r_Primitive_Type *type, const r_Minterval &srcDom, const r_Minterval &srcIterDom, const r_Minterval &destDom, const r_Minterval &destIterDom, const void *src, void *dest, r_ULong step)
change the endianness of one type member of an array for the generic case; step is the increment betw...
static void swap_array(r_Bytes size, const r_Float *src, r_Float *dest)
r_Endianness
endianness identifiers
Definition: endian.hh:49
@ r_Endian_Little
Definition: endian.hh:51
@ r_Endian_Big
Definition: endian.hh:50
static r_Short swap(r_Short val)
swap endianness of atomic types
static void swap_array(r_Bytes size, const r_Short *src, r_Short *dest)
static void swap_array(r_Bytes size, const r_Long *src, r_Long *dest)
The spatial domain of an MDD is represented by an object of class r_Minterval.
Definition: minterval.hh:226
This class represents all primitive types in the ODMG conformant representation of the RasDaMan type ...
Definition: primitivetype.hh:42
std::ostream & operator<<(std::ostream &s, r_Endian::r_Endianness &e)
Output stream operator for enum of type const r_Minterval.
size_t r_Bytes
number of bytes in an tile or mdd or type.
Definition: mddtypes.hh:43
std::uint32_t r_ULong
Definition: odmgtypes.hh:38
double r_Double
Definition: odmgtypes.hh:40
std::uint16_t r_UShort
Definition: odmgtypes.hh:35
float r_Float
Definition: odmgtypes.hh:39
std::int8_t r_Octet
Definition: odmgtypes.hh:34
std::uint8_t r_Char
Definition: odmgtypes.hh:33
std::int32_t r_Long
Definition: odmgtypes.hh:37
std::int16_t r_Short
Definition: odmgtypes.hh:36