Re: [Libosmscout-development] Writing and reading to dat files
Library for OpenStreetMap offline rendering and routing
Status: Beta
Brought to you by:
tteuling
|
From: Tim T. <ti...@fr...> - 2016-09-08 19:44:00
|
Hello Adrian,
> can i simply add writer.Write(x) and scanner.Read(x) or is there
> something else i have to take care of?
>
> In NodeLocationProcessorFilter::Process() i have something like this
> writer.Write(name);
> writer.Write(location);
> writer.Write(address);
> writer.Write(postalCode);
The original code also wrote the coord. I assume you simply missed to
quote that.
> And in LocationIndexGenerator::IndexAddressNodes i want to read it like this
> scanner.Read(name);
> scanner.Read(location);
> scanner.Read(address);
> scanner.Read(postalCode);
>
> Is this ok or is everything breaking with this? :)
No, that is OK. Because of the signature of some of the Read/Write
methods you must make sure that read and write data types are
matching. If you write it as uint32_t, you should read it with the
same datatype :-) For enumeration values or similar the effective
datatype are not always obvious so in that case you should explicitly
cast.
--
Gruß...
Tim
|