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

francesco francesco.pirotti at unipd.it
Thu Jul 21 13:12:12 EDT 2011


Hello,
I am using Qt SDK for explicit run-time linking to LIBLAS liblas_c.dll .
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.
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??
2 - Am I doing something obviously wrong??
Thank you for your time and effort.
Cheers,
Francesco Pirotti

in *liblas.h*
typedefconstLASReaderHLASReader_Create_mapped(unsignedchar*buffer);

*in c_api.cpp*

LAS_DLL  LASReaderH  LASReader_Create_mapped(unsigned  char  *  buffer)  

{

     VALIDATE_LAS_POINTER1(((char*)buffer),  "LASReader_Create_mapped",  NULL);

     try  {  

		std::istringstream  *  istrm  =  new  std::istringstream((char  *)buffer,   std::ios::in  |  std::ios::binary);

         liblas::ReaderFactory  f;

		liblas::Reader*  reader  =  new  liblas::Reader(f.CreateWithStream(*istrm));

         readers.insert(std::pair<liblas::Reader*,  std::istream*>(reader,  istrm));

         return  (LASReaderH)  reader;

     

     }  catch  (std::exception  const&  e)

      {

          LASError_PushError(LE_Failure,  e.what(),  "LASReader_Create");

          return  NULL;

      }

}


-- 
**************************************************
*Francesco Pirotti*
Dep. TESAF
CIRGEO -- Interdepartmental Research Center on Cartography Photogrammetry
Remote Sensing and G.I.S.
University of Padova
Web: http://www.cirgeo.unipd.it/cirgeo/francescopirotti.htm
Email: francesco.pirotti at unipd.it <mailto:francesco.pirotti at unipd.it>
Phone: +39 049 827 2710
Phone: +39 349 55 39 261
**************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/liblas-devel/attachments/20110721/d3c5bcb0/attachment.html


More information about the Liblas-devel mailing list