ByteOrderValues.h

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

Generated on 15 May 2014 for GEOS by  doxygen 1.4.7