[Liblas-commits] hg-main-tree: add endian swapping for OCI. This should be updat...

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Apr 11 10:50:51 EDT 2011


details:   http://hg.libpc.orghg-main-tree/rev/ea0ac05d66c1
changeset: 519:ea0ac05d66c1
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Apr 11 09:50:35 2011 -0500
description:
add endian swapping for OCI.  This should be updated to just use boost's
Subject: hg-main-tree: merge

details:   http://hg.libpc.orghg-main-tree/rev/8edb8686f586
changeset: 520:8edb8686f586
user:      Howard Butler <hobu.inc at gmail.com>
date:      Mon Apr 11 09:50:44 2011 -0500
description:
merge

diffstat:

 .hgignore                            |   1 +
 include/libpc/drivers/oci/Endian.hpp |  71 ++++++++++++++++++++++++++++++++++++
 test/data/wkt/0102.las.wkt           |   1 +
 3 files changed, 73 insertions(+), 0 deletions(-)

diffs (90 lines):

diff -r 77e5ecc85843 -r 8edb8686f586 .hgignore
--- a/.hgignore	Sun Apr 10 21:10:59 2011 -0500
+++ b/.hgignore	Mon Apr 11 09:50:44 2011 -0500
@@ -36,3 +36,4 @@
 
 Makefile
 doc/build
+bin/
diff -r 77e5ecc85843 -r 8edb8686f586 include/libpc/drivers/oci/Endian.hpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/libpc/drivers/oci/Endian.hpp	Mon Apr 11 09:50:44 2011 -0500
@@ -0,0 +1,71 @@
+// Stolen from libLAS' endian.hpp
+/******************************************************************************
+ * $Id$
+ *
+ * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
+ * Purpose:  Endian macros
+ * Author:   Mateusz Loskot, mateusz at loskot.net
+ *
+ * This file has been stolen from <boost/endian.hpp> and
+ * modified for libLAS purposes.
+ * 
+ * (C) Copyright Mateusz Loskot 2007, mateusz at loskot.net
+ * (C) Copyright Caleb Epstein 2005
+ * (C) Copyright John Maddock 2006
+ * Distributed under the Boost  Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ * 
+ * Revision History
+ * 06 Feb 2006 - Initial Revision
+ * 09 Nov 2006 - fixed variant and version bits for v4 guids
+ * 13 Nov 2006 - added serialization
+ * 17 Nov 2006 - added name-based guid creation
+ * 20 Nov 2006 - add fixes for gcc (from Tim Blechmann)
+ * 07 Mar 2007 - converted to header only
+ * 20 Jan 2008 - removed dependency of Boost and modified for libLAS (by Mateusz Loskot)
+ ******************************************************************************
+ *
+ * Copyright (c) 1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation.  Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied warranty.
+ *
+ * 
+ *
+ * Copyright notice reproduced from <boost/detail/limits.hpp>, from
+ * which this code was originally taken.
+ *
+ * Modified by Caleb Epstein to use <endian.h> with GNU libc and to
+ * defined the BOOST_ENDIAN macro.
+ ****************************************************************************/
+#ifndef INCLUDED_DRIVER_OCI_ENDIAN_HPP
+#define INCLUDED_DRIVER_OCI_ENDIAN_HPP
+
+# define SWAP_BE_TO_LE(p) \
+    do { \
+        char* first = static_cast<char*>(static_cast<void*>(&p)); \
+        char* last = first + sizeof(p) - 1; \
+        for(; first < last; ++first, --last) { \
+            char const x = *last; \
+            *last = *first; \
+            *first = x; \
+        }} while(false)
+
+# define SWAP_BE_TO_LE_N(p, n) \
+    do { \
+        char* first = static_cast<char*>(static_cast<void*>(&p)); \
+        char* last = first + n - 1; \
+        for(; first < last; ++first, --last) { \
+            char const x = *last; \
+            *last = *first; \
+            *first = x; \
+        }} while(false)
+
+#endif
\ No newline at end of file
diff -r 77e5ecc85843 -r 8edb8686f586 test/data/wkt/0102.las.wkt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/data/wkt/0102.las.wkt	Mon Apr 11 09:50:44 2011 -0500
@@ -0,0 +1,1 @@
+POLYGON ((-71.609744516719971 43.304973585411346,-71.609612478188822 43.3049765999708,-71.609603979403232 43.304976794000552,-71.608786744191093 43.304995448763208,-71.608707669007273 43.304997253476301,-71.59646197966083 43.305276072748903,-71.595047469806332 43.30530819476855,-71.592819525118472 43.305358753488562,-71.591924551508939 43.30537905087202,-71.590827574515714 43.305403919982446,-71.589281998948607 43.305438941197075,-71.589157254998142 43.305442487183271,-71.589127355543766 43.30544973739417,-71.589119277537137 43.305459824824858,-71.589112170471424 43.305486997960756,-71.589113441334035 43.305545945713405,-71.589126728418236 43.305858805677801,-71.589139026227286 43.306148367506886,-71.589165353092596 43.30676824025705,-71.589206757236497 43.307743071333228,-71.589207773544842 43.30776699897401,-71.589233716689961 43.308377786149507,-71.589255694503549 43.308895201311707,-71.589326797766915 43.310569063457336,-71.589341024496008 43.310903961605931,-71.58935187
 718933 43.311159430843752,-71.589384313807827 43.311922959349076,-71.589460075526148 43.31370620433097,-71.589465540845211 43.313834838199192,-71.589487696808206 43.314356300801109,-71.589489114763779 43.314389673316839,-71.589525948446138 43.315256558135864,-71.589533115094753 43.315425221510793,-71.589542991827358 43.315657662911725,-71.589591555223095 43.316800525062405,-71.589625633510906 43.317602463102105,-71.589637778185718 43.317888246351878,-71.589638989956541 43.317916760989561,-71.589661081752055 43.318436604042255,-71.589688067463101 43.319071587157381,-71.589701405828805 43.319385435845376,-71.589726504251544 43.319975982222374,-71.589768261427864 43.320958456312084,-71.589828767587903 43.322381973313433,-71.589856557953425 43.323035757010537,-71.589874274420993 43.323449631047112,-71.589877006550239 43.323508095328897,-71.589884483847101 43.323518640178158,-71.589902913661504 43.323522814723816,-71.590887239071222 43.323500597296501,-71.591935382659358 43.32347
 6834110487,-71.592143113444948 43.323472123359963,-71.595438093636716 43.323397351917485,-71.596295996604553 43.323377868322531,-71.59711693612789 43.323359218157513,-71.6091629588323 43.323084876844518,-71.609163205480172 43.323084871214235,-71.60916357508853 43.323084862777115,-71.609163821366778 43.323084857155273,-71.609164190975136 43.323084848718146,-71.60916456058348 43.32308484028102,-71.609165053509614 43.323084829028893,-71.609165546448054 43.323084817776483,-71.609191173308389 43.323084232783749,-71.60919265172943 43.323084199035179,-71.609194253480538 43.323084162471268,-71.609195731901579 43.323084128722648,-71.609197333652688 43.323084092158702,-71.609198935403811 43.323084055594727,-71.609200660103085 43.323084016224129,-71.60920238518429 43.323083976844785,-71.60920411026548 43.323083937465412,-71.609205834964726 43.323083898094737,-71.610489033629094 43.323054598577791,-71.610832533899327 43.323046752923943,-71.611178867906276 43.323038841500228,-71.61232505
 7936346 43.323012651204486,-71.614681497112088 43.322958680588521,-71.614759209286817 43.32295618292914,-71.614760633644266 43.322920404660302,-71.614752268936456 43.322665152036421,-71.6147475469771 43.322549377265396,-71.61468818770129 43.321163305987447,-71.614686906167421 43.321133442430089,-71.614659488311915 43.320494513708233,-71.614647221393511 43.320208646229872,-71.614579965038587 43.31864123363308,-71.614545321920602 43.317833824706916,-71.61453140489472 43.317509458450004,-71.61443057300913 43.315159192314638,-71.614375272693039 43.313870089727729,-71.614369820419142 43.313742987438403,-71.614301405725072 43.312148047398779,-71.614287531308165 43.311824579511516,-71.61428006176115 43.311650432405244,-71.614261415171526 43.311215693786245,-71.614013458643214 43.305433749628676,-71.614002185233446 43.305176581888595,-71.613994446397925 43.305019098116226,-71.613989768135667 43.304955996729184,-71.613981943826346 43.304877030133035,-71.613885124770889 43.30487906412
 7817,-71.612791373708333 43.30490398048039,-71.612217402123093 43.304917098980511,-71.612076865410643 43.304920310600195,-71.611519890853273 43.30493303717742,-71.611284389668356 43.304938417438869,-71.611184375661054 43.304940702212491,-71.611081528595207 43.304943051614643,-71.610352115189784 43.304959711418746,-71.610198645251515 43.304963216079088,-71.610034705756405 43.304966959595745,-71.609744516719971 43.304973585411346))
\ No newline at end of file


More information about the Liblas-commits mailing list