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