OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
util.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  various little things
23 
24  Author: Ansgar Philippsen
25 */
26 
27 #ifndef IMG_UTIL_H
28 #define IMG_UTIL_H
29 
30 #include <cmath>
31 
32 #include <ost/img/module_config.hh>
33 
34 namespace ost { namespace img { namespace util {
35 
36 // byte swapping stuff
37 
38 template <typename T> void swap_buf(T* p, int n);
39 
40 inline
41 void swap_short(short int *p, short int n) {swap_buf<short int>(p,n);}
42 inline
43 void swap_ushort(ushort *p, short int n) {swap_buf<unsigned short int>(p,n);}
44 inline
45 void swap_int(int *p, int n) {swap_buf<int>(p,n);}
46 inline
47 void swap_uint(uint *p, int n) {swap_buf<uint>(p,n);}
48 inline
49 void swap_float(float *p, int n) {swap_buf<float>(p,n);}
50 inline
51 void swap_double(Real *p, int n) {swap_buf<Real>(p,n);}
52 inline
53 void swap_long(long *p, int n) {swap_buf<long>(p,n);}
54 
55 }}} // namespace img
56 
57 // definitions
58 #include "util.cc"
59 
60 #endif
61 
62 
float Real
Definition: base.hh:44
void swap_float(float *p, int n)
Definition: util.hh:49
void swap_double(Real *p, int n)
Definition: util.hh:51
unsigned short int ushort
Definition: base.hh:37
void swap_ushort(ushort *p, short int n)
Definition: util.hh:43
void swap_uint(uint *p, int n)
Definition: util.hh:47
void swap_int(int *p, int n)
Definition: util.hh:45
void swap_buf(T *p, int n)
Definition: swap_util.hh:55
void swap_short(short int *p, short int n)
Definition: util.hh:41
unsigned int uint
Definition: base.hh:29
void swap_long(long *p, int n)
Definition: util.hh:53