GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

ByteOrderValues.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: io/ByteOrderValues.java rev. 1.3 (JTS-1.10)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_IO_BYTEORDERVALUES_H
21 #define GEOS_IO_BYTEORDERVALUES_H
22
23 #include <geos/export.h>
24 #include <geos/platform.h>
25
26 namespace geos {
27 namespace io {
28
29 /*
30 * \class ByteOrderValues io.h geos.h
31 *
32 * Methods to read and write primitive datatypes from/to byte
33 * sequences, allowing the byte order to be specified
34 *
35 * Similar to the standard Java <code>ByteBuffer</code> class.
36 */
37 class GEOS_DLL ByteOrderValues {
38
39 public:
40
41 enum EndianType
42 {
43 ENDIAN_BIG = 0,
44 ENDIAN_LITTLE = 1
45 };
46
47 static int getInt(const unsigned char *buf, int byteOrder);
48 static void putInt(int intValue, unsigned char *buf, int byteOrder);
49
50 static int64 getLong(const unsigned char *buf, int byteOrder);
51 static void putLong(int64 longValue, unsigned char *buf, int byteOrder);
52
53 static double getDouble(const unsigned char *buf, int byteOrder);
54 static void putDouble(double doubleValue, unsigned char *buf, int byteOrder);
55
56 };
57
58 } // namespace io
59 } // namespace geos
60
61 #endif // #ifndef GEOS_IO_BYTEORDERVALUES_H