<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hello, <br>
I am using Qt SDK for explicit run-time linking to LIBLAS
liblas_c.dll .<br>
Because Qt supports memory mapping of files (maps a file to a
unsigned char *) my idea was to pass a file map to create the reader
instead of passing the file name. I therefore cloned the
Create_reader function to the function at the end of this mail.<br>
The error message from <span style="color: rgb(128, 0, 0);">GetLastErrorMsg</span>
is always <u>detail::liblas::read_n input stream is not readable</u><br>
So two questions to the list:<br>
1 - do you think memory mapping can be a good solution to speed up
processing data??<br>
2 - Am I doing something obviously wrong??<br>
Thank you for your time and effort.<br>
Cheers,<br>
Francesco Pirotti<br>
<br>
in <small><b><big><big>liblas.h</big></big></b></small><br>
<span style="color: rgb(128, 128, 0);">typedef</span><span
style="color: rgb(192, 192, 192);"> </span><span style="color:
rgb(128, 128, 0);">const</span><span style="color: rgb(192, 192,
192);"> </span><span style="color: rgb(128, 0, 128);">LASReaderH</span><span
style="color: rgb(192, 192, 192);"> </span><span style="color:
rgb(128, 0, 128);">LASReader_Create_mapped</span><span
style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128,
128, 0);">unsigned</span><span style="color: rgb(192, 192, 192);">
</span><span style="color: rgb(128, 128, 0);">char</span><span
style="color: rgb(192, 192, 192);"> </span><span style="color:
rgb(0, 0, 0);">*</span><span style="color: rgb(192, 192, 192);"> </span>buffer<span
style="color: rgb(0, 0, 0);">);<br>
<br>
</span><font color="#330033"><big><b><span style="color: rgb(0, 128,
0);">in c_api.cpp</span></b></big></font><span style="color:
rgb(0, 128, 0);"></span>
<pre style="margin: 0px; text-indent: 0px;">LAS_DLL<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">LASReaderH</span><span style="color: rgb(192, 192, 192);"> </span>LASReader_Create_mapped<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 128, 0);">unsigned</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">char</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">buffer</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(192, 192, 192);"> </span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(0, 0, 0);">{</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span>VALIDATE_LAS_POINTER1<span style="color: rgb(0, 0, 0);">(((</span><span style="color: rgb(128, 128, 0);">char</span><span style="color: rgb(0, 0, 0);">*)</span><span style="color: rgb(0, 0, 0);">buffer</span><span style="color: rgb(0, 0, 0);">),</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"LASReader_Create_mapped"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(192, 192, 192);"> </span>NULL<span style="color: rgb(0, 0, 0);">);</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">try</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(192, 192, 192);"> </span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);">                </span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">istringstream</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">istrm</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">new</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">istringstream</span><span style="color: rgb(0, 0, 0);">((</span><span style="color: rgb(128, 128, 0);">char</span><span style="color: rgb(192, 192, 192);"> </span><span style="colo
r: rgb(0, 0, 0);">*)</span><span style="color: rgb(0, 0, 0);">buffer</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">ios</span><span style="color: rgb(0, 0, 0);">::</span>in<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">|</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">ios</span><span style="color: rgb(0, 0, 0);">::</span>binary<span style="color: rgb(0, 0, 0);">);</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">liblas</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">ReaderFactory</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">f</span><span style="color: rgb(0, 0, 0);">;</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);">                </span><span style="color: rgb(128, 0, 128);">liblas</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">Reader</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">reader</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">new</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">liblas</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">Reader</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">f</span><span style="color: rgb(0, 0, 0);">.</span>CreateWithStream<span style="color: rgb(0, 0, 0);">(*</span><span style="color: rgb(0,
0, 0);">istrm</span><span style="color: rgb(0, 0, 0);">));</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span>readers<span style="color: rgb(0, 0, 0);">.</span>insert<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">pair</span><span style="color: rgb(0, 0, 0);"><</span><span style="color: rgb(128, 0, 128);">liblas</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">Reader</span><span style="color: rgb(0, 0, 0);">*,</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">istream</span><span style="color: rgb(0, 0, 0);">*>(</span><span style="color: rgb(0, 0, 0);">reader</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rg
b(0, 0, 0);">istrm</span><span style="color: rgb(0, 0, 0);">));</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">return</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">LASReaderH</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">reader</span><span style="color: rgb(0, 0, 0);">;</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">catch</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">std</span><span style="color: rgb(0, 0, 0);">::</span><span style="color: rgb(128, 0, 128);">exception</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">const</span><span style="color: rgb(0, 0, 0);">&</span><span style="color: rgb(192, 192, 192);"> </span>e<span style="color: rgb(0, 0, 0);">)</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">{</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span>LASError_PushError<span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">LE_Failure</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(192, 192, 192);"> </span>e<span style="color: rgb(0, 0, 0);">.</span>what<span style="color: rgb(0, 0, 0);">(),</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"LASReader_Create"</span><span style="color: rgb(0, 0, 0);">);</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">return</span><span style="color: rgb(192, 192, 192);"> </span>NULL<span style="color: rgb(0, 0, 0);">;</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 0, 0);">}</span></pre>
<pre style="margin: 0px; text-indent: 0px;"><span style="color: rgb(0, 0, 0);">}</span></pre>
<br>
<div class="moz-signature">-- <br>
<font face="Arial, Helvetica, sans-serif" size="-1">
**************************************************<br>
<b>Francesco Pirotti</b> <br>
Dep. TESAF <br>
CIRGEO – Interdepartmental Research Center on Cartography
Photogrammetry <br>
Remote Sensing and G.I.S. <br>
University of Padova <br>
Web: <a
href="http://www.cirgeo.unipd.it/cirgeo/francescopirotti.htm">http://www.cirgeo.unipd.it/cirgeo/francescopirotti.htm</a>
<br>
Email: <a href="mailto:francesco.pirotti@unipd.it">francesco.pirotti@unipd.it</a>
<br>
Phone: +39 049 827 2710 <br>
Phone: +39 349 55 39 261<br>
**************************************************
</font></div>
</body>
</html>