Geoiterators: Remove unused data members

This commit is contained in:
shahramn 2024-10-22 11:53:50 +01:00
parent 095eff61e2
commit 1790fbe2f8
13 changed files with 29 additions and 32 deletions

View File

@ -25,19 +25,17 @@ int Iterator::init(grib_handle* h, grib_arguments* args)
/* For this one, ALL destroy are called */
int Iterator::destroy()
{
delete context_;
delete this;
return GRIB_SUCCESS;
}
eccodes::geo_iterator::Iterator* gribIteratorNew(const grib_handle* ch, unsigned long flags, int* error)
{
grib_handle* h = (grib_handle*)ch;
grib_accessor* a = NULL;
grib_accessor_iterator_t* ita = NULL;
*error = GRIB_NOT_IMPLEMENTED;
a = grib_find_accessor(h, "ITERATOR");
ita = (grib_accessor_iterator_t*)a;
*error = GRIB_NOT_IMPLEMENTED;
grib_handle* h = (grib_handle*)ch;
grib_accessor* a = grib_find_accessor(h, "ITERATOR");
grib_accessor_iterator_t* ita = (grib_accessor_iterator_t*)a;
if (!a)
return NULL;

View File

@ -33,7 +33,6 @@ public:
unsigned long flags_;
protected:
grib_context* context_;
grib_handle* h_;
double* data_; /** data values */
mutable long e_; /** current element */

View File

@ -366,8 +366,8 @@ finalise:
int GaussianReduced::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -15,25 +15,25 @@ namespace eccodes::geo_iterator {
int Gen::init(grib_handle* h, grib_arguments* args)
{
int err = GRIB_SUCCESS;
lats_ = lons_ = NULL;
lats_ = lons_ = data_ = NULL;
if ((err = Iterator::init(h, args)) != GRIB_SUCCESS)
return err;
size_t dli = 0;
const char* s_rawData = NULL;
const char* s_numPoints = NULL;
long numberOfPoints = 0;
carg_ = 1;
// Skip the 1st argument which is the name of the iterator itself
// e.g., latlon, gaussian_reduced etc
carg_ = 1; // start from 1 and not 0
s_numPoints = grib_arguments_get_name(h, args, carg_++);
missingValue_ = grib_arguments_get_name(h, args, carg_++);
s_rawData = grib_arguments_get_name(h, args, carg_++);
const char* s_numPoints = grib_arguments_get_name(h, args, carg_++);
// The missingValue argument is not currently used. Skip it
carg_++; //const char* s_missingValue = grib_arguments_get_name(h, args, carg_++);
const char* s_rawData = grib_arguments_get_name(h, args, carg_++);
data_ = NULL;
size_t dli = 0;
if ((err = grib_get_size(h, s_rawData, &dli)) != GRIB_SUCCESS)
return err;
long numberOfPoints = 0;
if ((err = grib_get_long_internal(h, s_numPoints, &numberOfPoints)) != GRIB_SUCCESS)
return err;

View File

@ -34,8 +34,7 @@ protected:
double* lons_;
private:
const char* missingValue_;
// int get(double*, double*, double*);
//int get(double*, double*, double*);
};
} // namespace eccodes::geo_iterator

View File

@ -280,9 +280,7 @@ int Healpix::init(grib_handle* h, grib_arguments* args)
return GRIB_WRONG_GRID;
}
char ordering[32] = {
0,
};
char ordering[32] = {0,};
size_t slen = sizeof(ordering);
if ((err = grib_get_string_internal(h, sorder, ordering, &slen)) != GRIB_SUCCESS) {
return err;
@ -349,8 +347,10 @@ int Healpix::next(double* lat, double* lon, double* val) const
int Healpix::destroy()
{
grib_context_free(context_, lats_);
grib_context_free(context_, lons_);
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);
return Gen::destroy();
}

View File

@ -429,8 +429,8 @@ int LambertAzimuthalEqualArea::init(grib_handle* h, grib_arguments* args)
int LambertAzimuthalEqualArea::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -478,8 +478,8 @@ int LambertConformal::next(double* lat, double* lon, double* val) const
int LambertConformal::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -130,8 +130,8 @@ int LatlonReduced::init(grib_handle* h, grib_arguments* args)
int LatlonReduced::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -273,8 +273,8 @@ int Mercator::next(double* lat, double* lon, double* val) const
int Mercator::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -302,8 +302,8 @@ int PolarStereographic::init(grib_handle* h, grib_arguments* args)
int PolarStereographic::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -48,6 +48,7 @@ int Regular::previous(double* lat, double* lon, double* val) const
int Regular::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);

View File

@ -313,8 +313,8 @@ int SpaceView::init(grib_handle* h, grib_arguments* args)
int SpaceView::destroy()
{
DEBUG_ASSERT(h_);
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);