GEOS
3.3.1
|
00001 /********************************************************************** 00002 * $Id: ByteOrderValues.h 3253 2011-03-01 17:50:36Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: io/ByteOrderValues.java rev. 1.3 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 #ifndef GEOS_IO_BYTEORDERVALUES_H 00022 #define GEOS_IO_BYTEORDERVALUES_H 00023 00024 #include <geos/export.h> 00025 #include <geos/platform.h> 00026 00027 namespace geos { 00028 namespace io { 00029 00030 /* 00031 * \class ByteOrderValues io.h geos.h 00032 * 00033 * Methods to read and write primitive datatypes from/to byte 00034 * sequences, allowing the byte order to be specified 00035 * 00036 * Similar to the standard Java <code>ByteBuffer</code> class. 00037 */ 00038 class GEOS_DLL ByteOrderValues { 00039 00040 public: 00041 00042 enum EndianType 00043 { 00044 ENDIAN_BIG = 0, 00045 ENDIAN_LITTLE = 1 00046 }; 00047 00048 static int getInt(const unsigned char *buf, int byteOrder); 00049 static void putInt(int intValue, unsigned char *buf, int byteOrder); 00050 00051 static int64 getLong(const unsigned char *buf, int byteOrder); 00052 static void putLong(int64 longValue, unsigned char *buf, int byteOrder); 00053 00054 static double getDouble(const unsigned char *buf, int byteOrder); 00055 static void putDouble(double doubleValue, unsigned char *buf, int byteOrder); 00056 00057 }; 00058 00059 } // namespace io 00060 } // namespace geos 00061 00062 #endif // #ifndef GEOS_IO_BYTEORDERVALUES_H 00063 00064 /********************************************************************** 00065 * $Log$ 00066 * Revision 1.1 2006/03/20 18:18:14 strk 00067 * io.h header split 00068 * 00069 **********************************************************************/