GEOS  3.8.0dev
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/constants.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  ENDIAN_BIG = 0,
43  ENDIAN_LITTLE = 1
44  };
45 
46  static int getInt(const unsigned char* buf, int byteOrder);
47  static void putInt(int intValue, unsigned char* buf, int byteOrder);
48 
49  static int64 getLong(const unsigned char* buf, int byteOrder);
50  static void putLong(int64 longValue, unsigned char* buf, int byteOrder);
51 
52  static double getDouble(const unsigned char* buf, int byteOrder);
53  static void putDouble(double doubleValue, unsigned char* buf, int byteOrder);
54 
55 };
56 
57 } // namespace io
58 } // namespace geos
59 
60 #endif // #ifndef GEOS_IO_BYTEORDERVALUES_H
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25