OpenStructure
Loading...
Searching...
No Matches
convert.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//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License as published by the Free
8// Software Foundation; either version 3.0 of the License, or (at your option)
9// any later version.
10// This library is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this library; if not, write to the Free Software Foundation, Inc.,
17// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//------------------------------------------------------------------------------
19
20#ifndef OST_IO_CONVERT_H
21#define OST_IO_CONVERT_H
22
23// endian macros deprecated in Boost 1.68
24#include <boost/version.hpp>
25#if BOOST_VERSION<106800
26#include <boost/detail/endian.hpp>
27// recent Boost versions use boost/predef/other/endian.h anyway
28#ifndef BOOST_ENDIAN_BIG_BYTE
29#ifdef BOOST_BIG_ENDIAN
30#define BOOST_ENDIAN_BIG_BYTE 1
31#else
32#define BOOST_ENDIAN_BIG_BYTE 0
33#endif
34#endif
35#else
36// see https://www.boost.org/doc/libs/1_68_0/doc/html/predef/reference.html#predef.reference.other_macros.boost_endian
37// defines BOOST_ENDIAN_BIG_BYTE and BOOST_ENDIAN_LITTLE_BYTE
38// -> set to 1 or 0 respectively of endianness of machine
39#include <boost/predef/other/endian.h>
40#endif
41
42namespace ost { namespace io {
43
52
53
54
55template<int CONVERSIONTYPE, class VALUETYPE>
56class Convert{
57public:
58 static VALUETYPE From(const VALUETYPE& value);
59 static VALUETYPE To(const VALUETYPE& value);
60 static void FromIP(VALUETYPE* value);
61 static void ToIP(VALUETYPE* value);
62};
63
64
65} // io ns
66
67
68
69} // ost ns
70
71
72#endif
73
74
static void ToIP(VALUETYPE *value)
static void FromIP(VALUETYPE *value)
static VALUETYPE From(const VALUETYPE &value)
static VALUETYPE To(const VALUETYPE &value)
@ OST_VAX_DATA
Definition convert.hh:45
@ OST_LITTLE_ENDIAN
Definition convert.hh:45
@ OST_BIG_ENDIAN
Definition convert.hh:45
@ OST_LOCAL_ENDIAN
Definition convert.hh:49
Definition base.dox:1