[Liblas-devel] PIMPL based prototype
Mateusz Loskot
mateusz at loskot.net
Mon Dec 17 08:15:15 EST 2007
Folks,
I submitted compilable but not runnable skeleton of prototype
based on PIMPL idiom:
http://liblas.org/browser/branches/mloskot-prototype
I decided to prepare this prototype outside the trunk to not to mess
current stuff in trunk and give as simple and clean picture of the idea
as possible.
This prototype does not use any factories, but there is regular concrete
class liblas::LASFile. This class is a thin wrapper on interface
defined by liblas::details::LASFile and implemented by
specialized classes:
liblas::details::LASFileImplV1
liblas::details::LASFileImplV2
The liblas::LASFile holds implementation by PIMPL [1] and delegates all
calls to specific implementation through pointer to the common interface
- liblas::details::LASFile. On liblas::LASFile object construction,
decision is made on what implementation object to construct and use,
V1 or V2.
This mechanism of selection of implementation is transparent to a user
as long as we will keep single & common interface defined as:
liblas::details::LASFile interface.
>From client's perspective, LASFile instance can be used as regular C++
object:
LASFile las(myfile.las, "r");
las.GetVersion();
las. ... // requests
or
LASFile* p = new LASFile(myfile.las, "r");
p->GetVersion();
p->... // make requests
delete p;
No other constructions are required.
Looking forward your comments.
Cheers
--
Mateusz Loskot
http://mateusz.loskot.net
More information about the Liblas-devel
mailing list