mirror of https://github.com/ecmwf/eccodes.git
update
This commit is contained in:
parent
f0c68fd733
commit
5369f35139
|
@ -49,6 +49,7 @@ class Method:
|
||||||
self.lines = []
|
self.lines = []
|
||||||
|
|
||||||
args = [a.strip() for a in args.split(",")]
|
args = [a.strip() for a in args.split(",")]
|
||||||
|
self.full_args = ", ".join(args)
|
||||||
self.args = ", ".join(args[1:])
|
self.args = ", ".join(args[1:])
|
||||||
self.args_list = []
|
self.args_list = []
|
||||||
for arg in [re.sub(r"\s+", " ", a).strip() for a in args]:
|
for arg in [re.sub(r"\s+", " ", a).strip() for a in args]:
|
||||||
|
@ -69,12 +70,7 @@ class Method:
|
||||||
|
|
||||||
def has_this(self):
|
def has_this(self):
|
||||||
return True
|
return True
|
||||||
if self.template is not None:
|
|
||||||
return False
|
|
||||||
for line in self.lines:
|
|
||||||
if "this->" in line:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
class SimpleMethod(Method):
|
class SimpleMethod(Method):
|
||||||
|
@ -107,19 +103,24 @@ class CompareMethod(Method):
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
|
|
||||||
self.lines = lines
|
self.lines = lines
|
||||||
self.args_list[0] = ('Accessor*','this')
|
self.args_list[0] = ("Accessor*", "this")
|
||||||
self.args_list[1] = ('const Accessor*', 'other')
|
self.args_list[1] = ("const Accessor*", "other")
|
||||||
self.args = 'const Accessor* other'
|
self.args = "const Accessor* other"
|
||||||
|
|
||||||
|
|
||||||
class DumpMethod(Method):
|
class DumpMethod(Method):
|
||||||
def tidy_lines(self, klass):
|
def tidy_lines(self, klass):
|
||||||
# For now, just remove the method
|
# For now, just remove the method
|
||||||
self.lines = []
|
self.lines = ['#if 0'] + self.lines[1:-1] + ['#endif']
|
||||||
|
|
||||||
|
|
||||||
class StaticProc(Method):
|
class StaticProc(Method):
|
||||||
def has_this(self):
|
def has_this(self):
|
||||||
|
if self.template is not None:
|
||||||
|
return False
|
||||||
|
for line in self.lines:
|
||||||
|
if "this->" in line:
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def tidy_lines(self, klass):
|
def tidy_lines(self, klass):
|
||||||
|
@ -295,7 +296,7 @@ class Class:
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
def tidy_line(self, line, this):
|
def tidy_line(self, line, this=[]):
|
||||||
line = re.sub(r"\bsuper->\b", f"{self.super}::", line)
|
line = re.sub(r"\bsuper->\b", f"{self.super}::", line)
|
||||||
|
|
||||||
for n in this:
|
for n in this:
|
||||||
|
@ -356,7 +357,8 @@ class Accessor(Class):
|
||||||
r"\bgrib_pack_long\((\w+)\s*,": r"\1->pack_long(",
|
r"\bgrib_pack_long\((\w+)\s*,": r"\1->pack_long(",
|
||||||
r"\bgrib_unpack_long\((\w+)\s*,": r"\1->unpack_long(",
|
r"\bgrib_unpack_long\((\w+)\s*,": r"\1->unpack_long(",
|
||||||
r"\bgrib_value_count\((\w+)\s*,": r"\1->value_count(",
|
r"\bgrib_value_count\((\w+)\s*,": r"\1->value_count(",
|
||||||
r"\bDebugAssert\b": "ASSERT",
|
r"\bpreferred_size\(this,": r"this->preferred_size(",
|
||||||
|
r"\bDebugAssert\b": "DEBUG_ASSERT",
|
||||||
r"\bAssert\b": "ASSERT",
|
r"\bAssert\b": "ASSERT",
|
||||||
r"\bunpack_long\(this,": "this->unpack_long(",
|
r"\bunpack_long\(this,": "this->unpack_long(",
|
||||||
r"\bDBL_MAX\b": "std::numeric_limits<double>::max()",
|
r"\bDBL_MAX\b": "std::numeric_limits<double>::max()",
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "grib_api_internal.h"
|
#include "grib_api_internal.h"
|
||||||
|
|
||||||
#define ASSERT(a) /* */
|
#define ASSERT(a) /* */
|
||||||
|
#define DEBUG_ASSERT(a) /* */
|
||||||
|
|
||||||
namespace eccodes
|
namespace eccodes
|
||||||
{
|
{
|
||||||
|
@ -102,6 +103,10 @@ public:
|
||||||
mutable size_t length_;
|
mutable size_t length_;
|
||||||
|
|
||||||
grib_handle* handle() const;
|
grib_handle* handle() const;
|
||||||
|
grib_handle* h;
|
||||||
|
Accessor* parent;
|
||||||
|
int carg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{% for m in static_procs %}
|
{% for m in static_procs %}
|
||||||
{% for line in top_level[m.name] %}{{ line }}
|
{% for line in top_level[m.name] %}{{ line }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
static {{ m.result }} {{ m.name }}({{ m.args }}) const {
|
static {{ m.result }} {{ m.name }}({{ m.args }}) {
|
||||||
{{ m.body }}
|
{{ m.body }}
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue