[Liblas-devel] pass a memory map pointer to uchar to lasreader

Andrew Bell andrew.bell.ia at gmail.com
Thu Jul 21 14:42:28 EDT 2011


On Thu, Jul 21, 2011 at 12:12 PM, francesco <francesco.pirotti at unipd.it> wrote:
> Hello,
> The error message from GetLastErrorMsg is always detail::liblas::read_n
> input stream is not readable
> So two questions to the list:
> 1 - do you think memory mapping can be a good solution to speed up
> processing data??

It depends what you are doing, but probably not.  The liblas calls
(like ReadPointAt) typically involve copying data from the stream to
user-space memory.  An important speedup from the mapped file is that
you don't copy the data at all.  It goes into memory from the file,
and that's it.  That's not what's happening here, though you could
probably write your own reader implementation to make this more
efficient.  Still, you typically copy the result of ReadPointAt to
some local memory (it returns a const ref).

To anyone in the know: Why is this done this way?  I don't think
you're going to get a return value optimization because you're
returning a reference rather than a temporary.

> 2 - Am I doing something obviously wrong??

I don't think the istringstream ctor takes a char * as it's argument,
it takes a string.  You could be invoking an implicit string ctor in
this case though, but the string that gets created is probably a mess,
as your pointer isn't really pointing to a string.  You would need
more of an example and test case for me to help you out.

Best,

-- 
Andrew Bell
andrew.bell.ia at gmail.com


More information about the Liblas-devel mailing list