[Gdal-dev] GDALDataset as a Base Class

Matt Hanson mhanson at photon.com
Tue Aug 29 20:52:30 EDT 2006


I'm writing a derived class of GDALDataset and I'm not sure how to implement the constructor.   I want to be able to take in a filename as an argument, and I should then have to explicitly call the GDALDataset ctor.   But GDALDataset doesn't have a public constructor that I can see as it uses GDALOpen and a cast to create it.
 
 
I've tried this line in the ctor:
*this = (GDALDataset *)GDALOpen( FileName(), GA_ReadOnly );

Along with a copy ctor:

GSImage(GDALDataset* ds) {

*this  = ds;

}

which compiles but of course doesn't work. I didn't think it would, but I'm not exactly sure why. Any ideas on what my derived class constructor should look like then?  

 

matt

 





More information about the Gdal-dev mailing list